Update docker-compose to include nginx

Also fix .env.production ENV var name
This commit is contained in:
Ari Timonen 2020-10-09 23:06:08 +03:00
parent 506caad06a
commit 0891552af1
2 changed files with 20 additions and 12 deletions

View file

@ -7,11 +7,11 @@ ASSETS_PRECOMPILE=1
SCRYPT_MAX_TIME=0.001
# FIXME Disable workers + cluster mode for now.
# FIXME Disable workers + cluster mode for now. They break start up.
PUMA_WORKERS=0
PUMA_MIN_THREADS=1
PUMA_MAX_THREADS=32
PUMA_PORT=4000
PRODUCTION_PUMA_PORT=4000
PUMA_TIMEOUT=30
PRODUCTION_ROOT_DOMAIN=ensl.org

View file

@ -154,23 +154,31 @@ services:
container_name: ensl_nginx
tty: true
stdin_open: true
command: /bin/bash -c "envsubst '$$PUMA_PORT $$APP_PATH $$APP_PATH_PUBLIC $$STAGING_ROOT_DOMAIN $$STAGING_DOMAIN $$STAGING_PORT $$STAGING_PORT_SSL' < /etc/nginx/conf.d/*.conf.template > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/*.conf && nginx -g 'daemon off;'"
command: /bin/bash -c "cat /etc/nginx/conf.d/ensl_production/*.conf.template|envsubst '$$PRODUCTION_PUMA_PORT $$PRODUCTION_ROOT_DOMAIN $$PRODUCTION_DOMAIN $$PRODUCTION_PORT $$PRODUCTION_PORT_SSL $$PUMA_PORT $$APP_PATH $$APP_PATH_PUBLIC $$STAGING_ROOT_DOMAIN $$STAGING_DOMAIN $$STAGING_PORT $$STAGING_PORT_SSL' > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/*.conf && nginx -g 'daemon off;'"
# TODO: use env vars here
volumes:
- ./ext/ssl:/etc/ssl/ensl
- ./ext/nginx.conf.d/:/etc/nginx/conf.d/
- ./public:/var/www/public
- ../../ensl/ensl.org/ext/ssl:/etc/ssl/ensl
- ../../ensl/ensl.org/public:/var/www/public
- ../../ensl/ensl.org/ext/nginx.conf.d:/etc/nginx/conf.d/ensl_production
- ../../ensl/ensl.org.staging/ext/nginx.conf.d:/etc/nginx/conf.d/ensl_staging
- ../../ensl/ensl.org.staging/app/public:/var/staging/public
# TODO: use env vars here
ports:
- $STAGING_PORT:$STAGING_PORT
- $STAGING_PORT_SSL:$STAGING_PORT_SSL
- 80:80
- 443:443
- 5000:5000
environment:
- PUMA_PORT=$PUMA_PORT
- PRODUCTION_PUMA_PORT=$PRODUCTION_PUMA_PORT
- PRODUCTION_ROOT_DOMAIN=$PRODUCTION_ROOT_DOMAIN
- PRODUCTION_DOMAIN=$PRODUCTION_DOMAIN
- PRODUCTION_PORT=$PRODUCTION_PORT
- PRODUCTION_PORT_SSL=$PRODUCTION_PORT_SSL
- STAGING_PUMA_PORT=$STAGING_PUMA_PORT
- STAGING_ROOT_DOMAIN=$STAGING_ROOT_DOMAIN
- STAGING_DOMAIN=$STAGING_DOMAIN
- STAGING_PORT=$STAGING_PORT
- STAGING_PORT_SSL=$STAGING_PORT_SSL
- RAILS_ENV=$RAILS_ENV
- APP_PATH=$APP_PATH
- APP_PATH_PUBLIC=$APP_PATH_PUBLIC
- STAGING_NGINX_PUBLIC=$STAGING_APP_PATH_PUBLIC
# spring:
# build: