From 0891552af16a97a81974114f07a163a81be98d82 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Fri, 9 Oct 2020 23:06:08 +0300 Subject: [PATCH] Update docker-compose to include nginx Also fix .env.production ENV var name --- .env.production | 4 ++-- docker-compose.yml | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.env.production b/.env.production index be5c321..f49b88a 100644 --- a/.env.production +++ b/.env.production @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 917c382..59afca9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: