Fix local env in docker-compose.yaml (#1085)
* Allow docker env override via .env.local * Make .env.local optional * Fix env var expansion ignoring .env.local * Rename .env.development to .env.docker * Use YAML anchors * Revert rename of .env.development
This commit is contained in:
parent
0ea261428c
commit
dd6e921e2e
|
@ -1,20 +1,38 @@
|
||||||
|
x-env_file: &env_file
|
||||||
|
- .env.development
|
||||||
|
- path: .env.local
|
||||||
|
required: false
|
||||||
|
x-healthcheck: &healthcheck
|
||||||
|
interval: 10s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
start_period: 1m
|
||||||
|
x-depends-on-db: &depends_on_db
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: true
|
||||||
|
x-depends-on-app: &depends_on_app
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: true
|
||||||
|
x-depends-on-bitcoin: &depends_on_bitcoin
|
||||||
|
bitcoin:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
container_name: db
|
container_name: db
|
||||||
build: ./docker/db
|
build: ./docker/db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "PGPASSWORD=${POSTGRES_PASSWORD} pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h 127.0.0.1 && psql -U ${POSTGRES_USER} ${POSTGRES_DB} -c 'SELECT 1 FROM users LIMIT 1'"]
|
test: ["CMD-SHELL", "PGPASSWORD=${POSTGRES_PASSWORD} pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h 127.0.0.1 && psql -U ${POSTGRES_USER} ${POSTGRES_DB} -c 'SELECT 1 FROM users LIMIT 1'"]
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
expose:
|
expose:
|
||||||
- "5432"
|
- "5432"
|
||||||
ports:
|
ports:
|
||||||
- "5431:5432"
|
- "5431:5432"
|
||||||
env_file:
|
env_file: *env_file
|
||||||
- .env.development
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/db/seed.sql:/docker-entrypoint-initdb.d/seed.sql
|
- ./docker/db/seed.sql:/docker-entrypoint-initdb.d/seed.sql
|
||||||
- db:/var/lib/postgresql/data
|
- db:/var/lib/postgresql/data
|
||||||
|
@ -29,17 +47,10 @@ services:
|
||||||
- GID=${CURRENT_GID}
|
- GID=${CURRENT_GID}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
||||||
interval: 10s
|
depends_on: *depends_on_db
|
||||||
timeout: 10s
|
env_file: *env_file
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env.development
|
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
ports:
|
ports:
|
||||||
|
@ -53,19 +64,13 @@ services:
|
||||||
build:
|
build:
|
||||||
context: ./capture
|
context: ./capture
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on: *depends_on_app
|
||||||
app:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
profiles:
|
profiles:
|
||||||
- capture
|
- capture
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:5678/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:5678/health"]
|
||||||
interval: 10s
|
env_file: *env_file
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
env_file: .env.development
|
|
||||||
environment:
|
environment:
|
||||||
# configure to screenshot production, because local dev is too slow
|
# configure to screenshot production, because local dev is too slow
|
||||||
- CAPTURE_URL=http://stacker.news
|
- CAPTURE_URL=http://stacker.news
|
||||||
|
@ -84,14 +89,10 @@ services:
|
||||||
- GID=${CURRENT_GID}
|
- GID=${CURRENT_GID}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
<<:
|
||||||
condition: service_healthy
|
- *depends_on_db
|
||||||
restart: true
|
- *depends_on_app
|
||||||
app:
|
env_file: *env_file
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env.development
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app
|
- ./:/app
|
||||||
entrypoint: ["/bin/sh", "-c"]
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
@ -103,14 +104,10 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- images
|
- images
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: [ "CMD", "imgproxy", "health" ]
|
test: [ "CMD", "imgproxy", "health" ]
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file: *env_file
|
||||||
- .env.development
|
|
||||||
ports:
|
ports:
|
||||||
- "3001:8080"
|
- "3001:8080"
|
||||||
expose:
|
expose:
|
||||||
|
@ -129,8 +126,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
profiles:
|
profiles:
|
||||||
- images
|
- images
|
||||||
env_file:
|
env_file: *env_file
|
||||||
- .env.development
|
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=1
|
- DEBUG=1
|
||||||
ports:
|
ports:
|
||||||
|
@ -149,14 +145,10 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- search
|
- search
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "curl -ku admin:${OPENSEARCH_INITIAL_ADMIN_PASSWORD} --silent --fail localhost:9200/_cluster/health || exit 1"]
|
test: ["CMD-SHELL", "curl -ku admin:${OPENSEARCH_INITIAL_ADMIN_PASSWORD} --silent --fail localhost:9200/_cluster/health || exit 1"]
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file: *env_file
|
||||||
- .env.development
|
|
||||||
environment:
|
environment:
|
||||||
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=mVchg1T5oA9wudUh
|
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=mVchg1T5oA9wudUh
|
||||||
ports:
|
ports:
|
||||||
|
@ -194,8 +186,7 @@ services:
|
||||||
opensearch:
|
opensearch:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: true
|
restart: true
|
||||||
env_file:
|
env_file: *env_file
|
||||||
- .env.development
|
|
||||||
environment:
|
environment:
|
||||||
- opensearch.ssl.verificationMode=none
|
- opensearch.ssl.verificationMode=none
|
||||||
- OPENSEARCH_HOSTS=http://opensearch:9200
|
- OPENSEARCH_HOSTS=http://opensearch:9200
|
||||||
|
@ -213,11 +204,8 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- payments
|
- payments
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} getblockchaininfo"]
|
test: ["CMD-SHELL", "bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} getblockchaininfo"]
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
command:
|
command:
|
||||||
- 'bitcoind'
|
- 'bitcoind'
|
||||||
- '-server=1'
|
- '-server=1'
|
||||||
|
@ -275,17 +263,10 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- payments
|
- payments
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "lncli", "getinfo"]
|
test: ["CMD-SHELL", "lncli", "getinfo"]
|
||||||
interval: 10s
|
depends_on: *depends_on_bitcoin
|
||||||
timeout: 10s
|
env_file: *env_file
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
depends_on:
|
|
||||||
bitcoin:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env.development
|
|
||||||
command:
|
command:
|
||||||
- 'lnd'
|
- 'lnd'
|
||||||
- '--noseedbackup'
|
- '--noseedbackup'
|
||||||
|
@ -339,17 +320,10 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- payments
|
- payments
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "lncli", "getinfo"]
|
test: ["CMD-SHELL", "lncli", "getinfo"]
|
||||||
interval: 10s
|
depends_on: *depends_on_bitcoin
|
||||||
timeout: 10s
|
env_file: *env_file
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
depends_on:
|
|
||||||
bitcoin:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env.development
|
|
||||||
command:
|
command:
|
||||||
- 'lnd'
|
- 'lnd'
|
||||||
- '--noseedbackup'
|
- '--noseedbackup'
|
||||||
|
@ -401,17 +375,10 @@ services:
|
||||||
profiles:
|
profiles:
|
||||||
- payments
|
- payments
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD-SHELL", "su clightning -c 'lightning-cli --network=regtest getinfo'"]
|
test: ["CMD-SHELL", "su clightning -c 'lightning-cli --network=regtest getinfo'"]
|
||||||
interval: 10s
|
depends_on: *depends_on_bitcoin
|
||||||
timeout: 10s
|
env_file: *env_file
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
depends_on:
|
|
||||||
bitcoin:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: true
|
|
||||||
env_file:
|
|
||||||
- .env.development
|
|
||||||
command:
|
command:
|
||||||
- 'lightningd'
|
- 'lightningd'
|
||||||
- '--network=regtest'
|
- '--network=regtest'
|
||||||
|
@ -462,11 +429,8 @@ services:
|
||||||
- email
|
- email
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
<<: *healthcheck
|
||||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8025"]
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8025"]
|
||||||
interval: 10s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
ports:
|
ports:
|
||||||
- "8025:8025"
|
- "8025:8025"
|
||||||
- "1025:1025"
|
- "1025:1025"
|
||||||
|
|
2
sndev
2
sndev
|
@ -13,7 +13,7 @@ docker__compose() {
|
||||||
COMPOSE_PROFILES="images,search,payments,email,capture"
|
COMPOSE_PROFILES="images,search,payments,email,capture"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CURRENT_UID=$(id -u) CURRENT_GID=$(id -g) COMPOSE_PROFILES=$COMPOSE_PROFILES command docker compose --env-file .env.development "$@"
|
CURRENT_UID=$(id -u) CURRENT_GID=$(id -g) COMPOSE_PROFILES=$COMPOSE_PROFILES command docker compose --env-file .env.development --env-file .env.local "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
docker__exec() {
|
docker__exec() {
|
||||||
|
|
Loading…
Reference in New Issue