2020-04-05 02:58:41 +00:00
|
|
|
version: "3.4"
|
2018-04-23 15:29:07 +00:00
|
|
|
|
|
|
|
services:
|
2020-04-05 02:58:41 +00:00
|
|
|
#
|
2020-04-08 19:25:24 +00:00
|
|
|
# Main services
|
2020-04-05 02:58:41 +00:00
|
|
|
#
|
2020-04-08 19:25:24 +00:00
|
|
|
production:
|
2020-04-11 12:45:17 +00:00
|
|
|
# command: "bundle exec puma"
|
|
|
|
command: "/var/www/bin/script/entry.sh"
|
2020-04-08 19:25:24 +00:00
|
|
|
tty: true
|
|
|
|
stdin_open: true
|
|
|
|
container_name: "ensl_production"
|
|
|
|
user: "web:web"
|
|
|
|
build:
|
|
|
|
context: ./
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
target: ensl_production
|
|
|
|
volumes:
|
|
|
|
- ".:/var/www/"
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
|
|
|
ports:
|
|
|
|
- "${PUMA_PORT}:${PUMA_PORT}"
|
|
|
|
# Guard livereload
|
|
|
|
# - "35729:35729"
|
|
|
|
links:
|
|
|
|
- db
|
|
|
|
- memcached
|
|
|
|
- smtp
|
|
|
|
|
|
|
|
staging:
|
2020-04-11 12:45:17 +00:00
|
|
|
command: "/var/www/bin/script/entry.sh"
|
|
|
|
# command: "bundle exec puma"
|
2020-04-08 19:25:24 +00:00
|
|
|
# command: "/bin/bash"
|
|
|
|
tty: true
|
|
|
|
stdin_open: true
|
|
|
|
container_name: "ensl_staging"
|
|
|
|
user: "web:web"
|
|
|
|
build:
|
|
|
|
context: ./
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
target: ensl_staging
|
|
|
|
volumes:
|
|
|
|
- ".:/var/www/"
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: staging
|
|
|
|
ports:
|
|
|
|
- "9000:${PUMA_PORT}"
|
|
|
|
links:
|
|
|
|
- db
|
|
|
|
- memcached
|
|
|
|
- smtp
|
|
|
|
|
|
|
|
development:
|
2020-04-05 02:58:41 +00:00
|
|
|
# For debug; Use attach rather than this
|
|
|
|
# command: /bin/bash
|
|
|
|
command: "bundle exec puma"
|
|
|
|
tty: true
|
|
|
|
stdin_open: true
|
2020-04-08 19:25:24 +00:00
|
|
|
container_name: "ensl_development"
|
2020-04-05 02:58:41 +00:00
|
|
|
user: "web:web"
|
|
|
|
build:
|
|
|
|
context: ./
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
target: ensl_${RAILS_ENV}
|
2018-04-25 16:41:22 +00:00
|
|
|
volumes:
|
2020-04-05 02:58:41 +00:00
|
|
|
- ".:/var/www/"
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: $RAILS_ENV
|
2018-04-23 15:29:07 +00:00
|
|
|
ports:
|
2020-04-05 02:58:41 +00:00
|
|
|
- "${PUMA_PORT}:${PUMA_PORT}"
|
|
|
|
- "35729:35729"
|
|
|
|
links:
|
2018-04-23 15:29:07 +00:00
|
|
|
- db
|
|
|
|
- memcached
|
2020-04-06 00:31:05 +00:00
|
|
|
|
2020-04-05 02:58:41 +00:00
|
|
|
#
|
|
|
|
# Testing
|
|
|
|
#
|
|
|
|
|
|
|
|
# Seperate test container so dev / test don't cause problems
|
|
|
|
test:
|
|
|
|
command: ["bash", "-c", "while true; do sleep 100; done;"]
|
|
|
|
container_name: ensl_test
|
|
|
|
build:
|
|
|
|
context: ./
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
target: ensl_development
|
|
|
|
env_file:
|
|
|
|
- .env.test
|
|
|
|
ports:
|
|
|
|
- ${TEST_APP_PORT}:${TEST_APP_PORT} # Capybara listens here
|
|
|
|
links:
|
|
|
|
- db
|
|
|
|
- memcached
|
|
|
|
- selenium
|
|
|
|
volumes:
|
|
|
|
- ".:/var/www"
|
|
|
|
# command: bin/spring server
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: test
|
|
|
|
networks:
|
|
|
|
default:
|
|
|
|
aliases:
|
|
|
|
- test
|
|
|
|
|
|
|
|
selenium:
|
|
|
|
image: selenium/standalone-chrome-debug
|
2020-04-06 00:31:05 +00:00
|
|
|
container_name: ensl_selenium
|
2020-04-05 02:58:41 +00:00
|
|
|
ports:
|
|
|
|
- 5900:5900
|
|
|
|
- 4444:4444
|
|
|
|
|
|
|
|
#
|
|
|
|
# Common services: These are shared by all envs.
|
|
|
|
#
|
|
|
|
|
|
|
|
memcached:
|
|
|
|
image: memcached:alpine
|
2020-04-06 00:31:05 +00:00
|
|
|
container_name: ensl_memcached
|
2020-04-05 02:58:41 +00:00
|
|
|
|
|
|
|
redis:
|
|
|
|
image: 'redis:4.0-alpine'
|
2020-04-06 00:31:05 +00:00
|
|
|
container_name: ensl_redis
|
2020-04-05 02:58:41 +00:00
|
|
|
|
2018-04-23 15:29:07 +00:00
|
|
|
db:
|
|
|
|
image: mariadb:latest
|
2020-04-06 00:31:05 +00:00
|
|
|
container_name: ensl_db
|
2020-04-05 02:58:41 +00:00
|
|
|
user: "mysql:mysql"
|
|
|
|
# debug; command: mysqld_safe --skip-grant-tables
|
2018-04-23 15:29:07 +00:00
|
|
|
volumes:
|
2020-04-05 02:58:41 +00:00
|
|
|
- "./db/data:/var/lib/mysql"
|
|
|
|
- "./db/initdb.d:/docker-entrypoint-initdb.d"
|
2018-04-25 16:41:22 +00:00
|
|
|
- "./ext/mysql.conf.d:/etc/mysql/conf.d"
|
2018-04-23 15:29:07 +00:00
|
|
|
environment:
|
2020-04-05 02:58:41 +00:00
|
|
|
- MYSQL_DATABASE=$MYSQL_DATABASE
|
|
|
|
- MYSQL_USER=$MYSQL_USER
|
|
|
|
- MYSQL_PASSWORD=$MYSQL_PASSWORD
|
2020-04-12 10:39:10 +00:00
|
|
|
- MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
|
2020-04-05 02:58:41 +00:00
|
|
|
- MYSQL_ROOT_HOST=$MYSQL_ROOT_HOST
|
|
|
|
|
2019-10-14 20:26:43 +00:00
|
|
|
smtp:
|
|
|
|
image: mwader/postfix-relay:latest
|
2020-04-06 00:31:05 +00:00
|
|
|
container_name: ensl_smtp
|
2019-10-14 20:26:43 +00:00
|
|
|
restart: always
|
|
|
|
volumes:
|
2020-04-05 02:58:41 +00:00
|
|
|
- "./ext/dkim:/etc/opendkim/keys"
|
2019-10-14 20:26:43 +00:00
|
|
|
environment:
|
2020-04-08 19:25:24 +00:00
|
|
|
- POSTFIX_myhostname=$MAIL_DOMAIN
|
|
|
|
- OPENDKIM_DOMAINS=$MAIL_DOMAIN
|
|
|
|
|
|
|
|
nginx:
|
|
|
|
image: nginx:latest
|
|
|
|
container_name: ensl_nginx
|
|
|
|
tty: true
|
|
|
|
stdin_open: true
|
2020-10-09 20:06:08 +00:00
|
|
|
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
|
2020-04-08 19:25:24 +00:00
|
|
|
volumes:
|
2020-10-09 20:06:08 +00:00
|
|
|
- ../../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
|
2020-04-08 19:25:24 +00:00
|
|
|
ports:
|
2020-10-09 20:06:08 +00:00
|
|
|
- 80:80
|
|
|
|
- 443:443
|
|
|
|
- 5000:5000
|
2020-04-08 19:25:24 +00:00
|
|
|
environment:
|
2020-10-09 20:06:08 +00:00
|
|
|
- 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
|
2020-04-08 19:25:24 +00:00
|
|
|
- STAGING_ROOT_DOMAIN=$STAGING_ROOT_DOMAIN
|
|
|
|
- STAGING_DOMAIN=$STAGING_DOMAIN
|
|
|
|
- STAGING_PORT=$STAGING_PORT
|
|
|
|
- STAGING_PORT_SSL=$STAGING_PORT_SSL
|
2020-10-09 20:06:08 +00:00
|
|
|
- STAGING_NGINX_PUBLIC=$STAGING_APP_PATH_PUBLIC
|
2020-04-05 02:58:41 +00:00
|
|
|
|
|
|
|
# spring:
|
|
|
|
# build:
|
|
|
|
# context: ./
|
|
|
|
# dockerfile: Dockerfile.dev
|
|
|
|
# args:
|
|
|
|
# buildno: 1
|
|
|
|
# volumes:
|
|
|
|
# - .:/var/www
|
|
|
|
# command: spring server
|
|
|
|
# This ensures that the pid namespace is shared between the host
|
|
|
|
# and the container. It's not necessary to be able to run spring
|
|
|
|
# commands, but it is necessary for "spring status" and "spring stop"
|
|
|
|
# to work properly.
|
2020-04-09 00:36:19 +00:00
|
|
|
# pid: host
|