docker-compose.yml 2.22 KB
Newer Older
guglielmo's avatar
guglielmo committed
1 2 3 4 5 6
version: "3.5"

services:

  web:
    restart: always
7
    container_name: opsv_web
guglielmo's avatar
guglielmo committed
8
    image: openpolis/opsv
guglielmo's avatar
guglielmo committed
9 10 11 12
    expose:
      - "8000"
    links:
      - postgres:postgres
13 14 15 16
      - redis:redis
    depends_on:
      - postgres
      - redis
guglielmo's avatar
guglielmo committed
17 18
    environment:
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@postgres/${POSTGRES_DB}
19
      - REDIS_HOST=redis
guglielmo's avatar
guglielmo committed
20 21 22
      - DEBUG=${DEBUG}
      - DEBUG_TOOLBAR_INTERNAL_IPS=${DEBUG_TOOLBAR_INTERNAL_IPS}
      - DJANGO_LOG_LEVEL=INFO
23
      - SECRET_KEY=${SECRET_KEY}
guglielmo's avatar
guglielmo committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37
      - LOGS_PATH=/var/log
      - ALLOWED_HOSTS=${ALLOWED_HOSTS}
      - MEDIA_ROOT=/app/public/media
      - STATIC_ROOT=/app/public/static
      - DEFAULT_FROM_EMAIL=${DEFAULT_FROM_EMAIL}
      - SERVER_EMAIL=${SERVER_EMAIL}
      - ADMIN_EMAIL=${ADMIN_EMAIL}
      - EMAIL_HOST=${EMAIL_HOST}
      - EMAIL_HOST_PORT=${EMAIL_HOST_PORT}
      - EMAIL_HOST_USE_TLS=${EMAIL_HOST_USE_TLS}
      - CI_COMMIT_SHA=${CI_COMMIT_SHA}
    volumes:
      - public:/app/public
      - weblogs:/var/log
guglielmo's avatar
guglielmo committed
38
    command: /usr/local/bin/uwsgi --socket=:8000 --master --logto=/var/log/uwsgi.log --env DJANGO_SETTINGS_MODULE=config.settings --pythonpath=/app --module=wsgi --callable=application --processes=4 --spooler=/var/lib/uwsgi --spooler-processes=2
guglielmo's avatar
guglielmo committed
39 40 41

  nginx:
    restart: always
42
    container_name: opsv_nginx
guglielmo's avatar
guglielmo committed
43 44 45 46 47 48 49 50 51 52 53
    build: compose/nginx/
    expose:
      - "80"
    environment:
      - VIRTUAL_HOST=${DOMAINS}
      - LETSENCRYPT_HOST=${DOMAINS}
      - LETSENCRYPT_EMAIL= ${LETSENCRYPT_EMAIL}
    volumes:
      - public:/app/public
    links:
      - web:web
54 55
    depends_on:
      - web
guglielmo's avatar
guglielmo committed
56 57 58

  postgres:
    restart: always
59
    container_name: opsv_postgres
guglielmo's avatar
guglielmo committed
60 61 62 63 64 65 66 67 68 69
    image: mdillon/postgis:9.6-alpine
    volumes:
      - pg_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASS=${POSTGRES_PASS}
    expose:
      - "5432"

70 71 72 73 74 75 76 77 78
  redis:
    container_name: opsv_redis
    restart: always
    image: redis:latest
    volumes:
      - redis_data:/data
    expose:
      - "6379"

guglielmo's avatar
guglielmo committed
79 80
volumes:
  public:
81
    name: opsv_public
guglielmo's avatar
guglielmo committed
82
  pg_data:
83
    name: opsv_pg_data
84 85
  redis_data:
    name: opsv_redis_data
guglielmo's avatar
guglielmo committed
86
  weblogs:
87
    name: opsv_weblogs
guglielmo's avatar
guglielmo committed
88 89 90 91 92 93

networks:
  default:
    external:
      name: webproxy