Skip to content

Commit 6a34c33

Browse files
committed
Consolidate env vars + fix minion under compose
Since we're not deploying this, we can try to set environment variables in fewer places.
1 parent 97ea0a1 commit 6a34c33

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

.env

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
COMPOSE_PROJECT_NAME=metacpan
1+
API_SERVER="morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose"
2+
COLUMNS=80
3+
ES=elasticsearch:9200
4+
ES_TEST=elasticsearch_test:9200
5+
MINICPAN=/CPAN
6+
MOJO_MODE=development
7+
NET_ASYNC_HTTP_MAXCONNS=1
8+
PERL_CARTON_PATH=/carton
9+
PERL_MM_USE_DEFAULT=1
10+
PG_DATABASE=metacpan
11+
PG_HOST=pghost
12+
PG_PASSWORD=t00lchain
13+
PG_PORT=5432
14+
PG_USER=metacpan
215
PLACK_ENV=development
3-
PGDB=pgdb:5432
4-
API_SERVER=morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose

docker-compose.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
2+
x-project:
3+
name: metacpan
34
# ____ _____ ______ _____ ____ _____ ____
45
# / ___|| ____| _ \ \ / /_ _/ ___| ____/ ___|
56
# \___ \| _| | |_) \ \ / / | | | | _| \___ \
@@ -100,16 +101,18 @@ services:
100101
api:
101102
depends_on:
102103
- elasticsearch
103-
- pgdb
104+
- pghost
104105
- traefik
105106
image: metacpan/metacpan-api:latest
106107
build:
107108
context: ./src/metacpan-api
109+
# put variables for compose inside a .env file
110+
# use env_file for variables to be set inside the container
108111
env_file:
109-
- localapi.env
112+
- .env
110113
command: >
111114
/metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" --
112-
/metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} --
115+
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
113116
${API_SERVER} ./bin/api.pl
114117
volumes:
115118
- type: volume
@@ -154,15 +157,15 @@ services:
154157
api_test:
155158
depends_on:
156159
- elasticsearch_test
157-
- pgdb
160+
- pghost
158161
image: metacpan/metacpan-api:latest
159162
build:
160163
context: ./src/metacpan-api
161164
env_file:
162165
- localapi_test.env
163166
command: >
164167
/metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" --
165-
/metacpan-api/wait-for-it.sh -t 15 -s ${PGDB} --
168+
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
166169
${API_SERVER} ./bin/api.pl
167170
volumes:
168171
- type: volume
@@ -315,16 +318,16 @@ services:
315318
# |_| |___/ |_|
316319
#
317320

318-
pgdb:
319-
hostname: pgdb
321+
pghost:
322+
hostname: pghost
320323
image: "postgres:${PG_VERSION_TAG:-9.6-alpine}"
321324
build:
322325
context: "./pg"
323326
args:
324327
PG_TAG: "${PG_VERSION_TAG:-9.6-alpine}"
325328
environment:
326329
POSTGRES_PASSWORD: metacpan
327-
POSTGRES_USERNAME: metacpan123
330+
POSTGRES_USER: metacpan123
328331
POSTGRES_DB: metacpan
329332
networks:
330333
- database
@@ -336,7 +339,7 @@ services:
336339
test: ["CMD", "/healthcheck.sh"]
337340
volumes:
338341
- type: volume
339-
source: pgdb-data
342+
source: pghost-data
340343
target: /var/lib/postgresql/data
341344
- type: bind
342345
source: ./pg/docker-entrypoint-initdb.d
@@ -373,6 +376,6 @@ volumes:
373376
cpan:
374377
elasticsearch:
375378
elasticsearch_test:
376-
pgdb-data:
379+
pghost-data:
377380
metacpan_git_shared:
378381
external: true

localapi.env

Lines changed: 0 additions & 9 deletions
This file was deleted.

pg/docker-entrypoint-initdb.d/100-roles.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE ROLE metacpan WITH LOGIN PASSWORD 'metacpan';
1+
CREATE ROLE metacpan WITH LOGIN PASSWORD 't00lchain';
22
CREATE ROLE "metacpan-api" WITH LOGIN;
33

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

0 commit comments

Comments
 (0)