Files
HaitiData/deployment/docker-compose.yml
T
2017-09-19 17:03:50 +07:00

202 lines
5.1 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
- ./fresh-backups:/fresh-backups
environment:
- USERNAME=docker
- PASS=docker
restart: always
ports:
- "33305:5432"
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
# Ensure to change these based on server domain
- SITEURL=http://0.0.0.0:33300/ # change this to ip or domain location
- GEOSERVER_BASE_URL=http://0.0.0.0:33308/geoserver/ # change this to ip or domain geoserver
# Set your locale - you need to ensure this is created in Dockerfile too...
- LC_ALL=en_US.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
- geoserver:geoserver
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.dev_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
- geoserver:geoserver
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:
build: docker-geoserver
container_name: haitidata-geoserver
links:
- db:db
ports:
- "33308:8080"