Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
COMPOSE_PROJECT_NAME=metacpan
API_SERVER="morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose"
COLUMNS=80
ES=elasticsearch:9200
ES_TEST=elasticsearch_test:9200
MINICPAN=/CPAN
MOJO_MODE=development
NET_ASYNC_HTTP_MAXCONNS=1
PERL_CARTON_PATH=/carton
PERL_MM_USE_DEFAULT=1
PG_DATABASE=metacpan
PG_HOST=pghost
PG_PASSWORD=t00lchain
PG_PORT=5432
PG_USER=metacpan
PLACK_ENV=development
PGDB=pgdb:5432
API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose
25 changes: 14 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---

x-project:
name: metacpan
# ____ _____ ______ _____ ____ _____ ____
# / ___|| ____| _ \ \ / /_ _/ ___| ____/ ___|
# \___ \| _| | |_) \ \ / / | | | | _| \___ \
Expand Down Expand Up @@ -100,16 +101,18 @@ services:
api:
depends_on:
- elasticsearch
- pgdb
- pghost
- traefik
image: metacpan/metacpan-api:latest
build:
context: ./src/metacpan-api
# put variables for compose inside a .env file
# use env_file for variables to be set inside the container
env_file:
- localapi.env
- .env
command: >
/metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" --
/metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} --
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
${API_SERVER} ./bin/api.pl
volumes:
- type: volume
Expand Down Expand Up @@ -154,15 +157,15 @@ services:
api_test:
depends_on:
- elasticsearch_test
- pgdb
- pghost
image: metacpan/metacpan-api:latest
build:
context: ./src/metacpan-api
env_file:
- localapi_test.env
command: >
/metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" --
/metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} --
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
${API_SERVER} ./bin/api.pl
volumes:
- type: volume
Expand Down Expand Up @@ -315,16 +318,16 @@ services:
# |_| |___/ |_|
#

pgdb:
hostname: pgdb
pghost:
hostname: pghost
image: "postgres:${PG_VERSION_TAG:-9.6-alpine}"
build:
context: "./pg"
args:
PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}"
environment:
POSTGRES_PASSWORD: metacpan
POSTGRES_USERNAME: metacpan123
POSTGRES_USER: metacpan123
POSTGRES_DB: metacpan
networks:
- database
Expand All @@ -336,7 +339,7 @@ services:
test: ["CMD", "/healthcheck.sh"]
volumes:
- type: volume
source: pgdb-data
source: pghost-data
target: /var/lib/postgresql/data
- type: bind
source: ./pg/docker-entrypoint-initdb.d
Expand Down Expand Up @@ -373,6 +376,6 @@ volumes:
cpan:
elasticsearch:
elasticsearch_test:
pgdb-data:
pghost-data:
metacpan_git_shared:
external: true
9 changes: 0 additions & 9 deletions localapi.env

This file was deleted.

2 changes: 1 addition & 1 deletion pg/docker-entrypoint-initdb.d/100-roles.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE ROLE metacpan WITH LOGIN PASSWORD 'metacpan';
CREATE ROLE metacpan WITH LOGIN PASSWORD 't00lchain';
CREATE ROLE "metacpan-api" WITH LOGIN;

-- make things easier for when we're poking around from inside the container
Expand Down