Files
HaitiData/deployment/docker-compose.yml
T
2017-08-01 11:58:15 +07:00

191 lines
4.7 KiB
YAML

#
# Production server with UWSGI configured to run on port 8080
#
# docker-compose build
# docker-compose up -d web
#
# See accompanying Make commands for easy collectstatic etc.
rabbitmq:
image: library/rabbitmq
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
smtp:
# Note you cannot scale if you use conteiner_name
container_name: haitidata-smtp
image: catatnight/postfix
hostname: postfix
environment:
# You could change this to something more suitable
- maildomain=kartoza.com
- smtp_user=noreply:docker
restart: always
db:
# Note you cannot scale if you use conteiner_name
container_name: haitidata-db
image: kartoza/postgis:9.4-2.1
volumes:
- ./pg/postgres_data:/var/lib/postgresql
- ./backups:/backups
environment:
- USERNAME=docker
- PASS=docker
restart: always
uwsgi-base:
# Note you cannot scale if you use conteiner_name
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- RABBITMQ_HOST=rabbitmq
- DJANGO_SETTINGS_MODULE=core.settings.prod_docker
- VIRTUAL_HOST=haitidata.com
- VIRTUAL_PORT=8080
# Set your locale - you need to ensure this is created in Dockerfile too...
- LC_ALL=en_ZA.UTF-8
volumes:
- ../django_project:/home/web/django_project
- ./static:/home/web/static:rw
- ./media:/home/web/media:rw
- ./reports:/home/web/reports
- ./logs:/var/log/
user: root
uwsgi-ephemeral:
extends: uwsgi-base
links:
- smtp:smtp
- db:db
user: root
restart: on-failure:5
uwsgi:
# Note you cannot scale if you use conteiner_name
extends: uwsgi-base
container_name: haitidata-uwsgi
links:
- smtp:smtp
- db:db
- geoserver:geoserver
restart: always
dbbackups:
# Note you cannot scale if you use conteiner_name
container_name: haitidata-db-backups
image: kartoza/pg-backup:9.4
hostname: pg-backups
volumes:
- ./backups:/backups
links:
- db:db
environment:
# take care to let the project name below match that
# declared in the top of the makefile
- DUMPPREFIX=PG_haiti
# These are all defaults anyway, but setting explicitly in
# case we ever want to ever use different credentials
- PGUSER=docker
- PGPASSWORD=docker
- PGPORT=5432
- PGHOST=db
- PGDATABASE=gis
restart: always
# This is normally the main entry point for a production server
web:
# Note you cannot scale if you use conteiner_name
container_name: haitidata-web
image: nginx
hostname: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
# I dont use volumes_from as I want to use the ro modifier
- ./static:/home/web/static:ro
- ./media:/home/web/media:ro
- ./logs:/var/log/nginx
# - /etc/letsencrypt:/etc/letsencrypt
- ./webroot-path:/home/web/webroot-path
links:
- uwsgi:uwsgi
ports:
- "33300:8080"
restart: always
# This is the entry point for a development server.
# Run with --no-deps to run attached to the services
# from produ environment if wanted
devweb:
# Note you cannot scale if you use conteiner_name
container_name: haitidata-dev-web
build: docker
dockerfile: Dockerfile-dev
hostname: haitidata-dev-web
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- RABBITMQ_HOST=rabbitmq
- DJANGO_SETTINGS_MODULE=core.settings.prod_docker
- PYTHONPATH=/home/web/django_project
- VIRTUAL_HOST=haitidata.com
- VIRTUAL_PORT=8080
volumes:
- ../django_project:/home/web/django_project
- ./static:/home/web/static
- ./media:/home/web/media
- ./reports:/home/web/reports
- ./logs:/var/log/
links:
- smtp:smtp
- db:db
- rabbitmq:rabbitmq
ports:
# for django test server
- "33303:8080"
# for ssh
- "33302:22"
worker:
build: docker
hostname: worker
command: celery worker -A config.celery -l info --beat
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DATABASE_QGIS_HOST=db_gis
- RABBITMQ_HOST=rabbitmq
- DJANGO_SETTINGS_MODULE=core.settings.prod_docker
- VIRTUAL_HOST=haitidata.com
- VIRTUAL_PORT=8080
- C_FORCE_ROOT=true
volumes:
- ../django_project:/home/web/django_project
- ./static:/home/web/static
- ./media:/home/web/media
- ./reports:/home/web/reports
- ./logs:/var/log/
links:
- smtp:smtp
- db:db
- rabbitmq:rabbitmq
restart: on-failure:5
geoserver:
image: kartoza/geoserver
container_name: haitidata-geoserver
ports:
- "33308:8080"