|
@@ -1,24 +1,24 @@
|
|
|
version: "3.7"
|
|
|
|
|
|
services:
|
|
|
- zitap:
|
|
|
- container_name: django
|
|
|
+ zitap-django:
|
|
|
+ container_name: zitap-django
|
|
|
|
|
|
build: .
|
|
|
|
|
|
restart: on-failure
|
|
|
|
|
|
environment:
|
|
|
- DJANGO_SECRET_KEY: <SECRET_KEY>
|
|
|
+ DJANGO_SECRET_KEY: <SECRET-KEY>
|
|
|
DJANGO_DEBUG: "False"
|
|
|
- DJANGO_ALLOWED_HOSTS: <IP>,<DOMAIN>,localhost
|
|
|
- DJANGO_CSRF_TRUSTED_ORIGINS: <DOMAIN>
|
|
|
+ DJANGO_ALLOWED_HOSTS: <IP>,zitap.example.com,localhost
|
|
|
+ DJANGO_CSRF_TRUSTED_ORIGINS: https://zitap.example.com
|
|
|
|
|
|
- DATABASE_ENGINE: mysql
|
|
|
- DATABASE_NAME: django
|
|
|
+ DATABASE_ENGINE: django.db.backends.mysql
|
|
|
+ DATABASE_NAME: <DATABASE-NAME>
|
|
|
DATABASE_USERNAME: <USERNAME>
|
|
|
DATABASE_PASSWORD: <PASSWORD>
|
|
|
- DATABASE_HOST: <IP>
|
|
|
+ DATABASE_HOST: <IP-ADDRESS>
|
|
|
DATABASE_PORT: 3306
|
|
|
DATABASE_OPTIONS: "{\"init_command\": \"SET sql_mode='STRICT_TRANS_TABLES'\"}"
|
|
|
|
|
@@ -26,9 +26,43 @@ services:
|
|
|
- ./project:/app/project
|
|
|
- ./zitap:/app/zitap
|
|
|
- ./static:/static
|
|
|
- - ./data:/data
|
|
|
|
|
|
- ports:
|
|
|
- - 8000:8000
|
|
|
+ networks:
|
|
|
+ - mysql
|
|
|
+ - proxy
|
|
|
+
|
|
|
+ labels:
|
|
|
+ - 'traefik.enable=true'
|
|
|
+ - 'traefik.http.routers.zitap.rule=Host(`zitap.example.com`)'
|
|
|
+ - 'traefik.http.routers.zitap.tls=true'
|
|
|
+ - 'traefik.http.routers.zitap.service=zitap'
|
|
|
+ - 'traefik.http.services.zitap.loadbalancer.server.port=8000'
|
|
|
+
|
|
|
+ zitap-static:
|
|
|
+ container_name: zitap-static
|
|
|
+ image: nginx
|
|
|
|
|
|
- command: ["/code/production.sh"]
|
|
|
+ restart: unless-stopped
|
|
|
+
|
|
|
+ volumes:
|
|
|
+ - ./nginx.conf:/etc/nginx/conf.d/default.conf
|
|
|
+ - ./static:/etc/nginx/html/static
|
|
|
+
|
|
|
+ networks:
|
|
|
+ - proxy
|
|
|
+
|
|
|
+ depends_on:
|
|
|
+ - zitap-django
|
|
|
+
|
|
|
+ labels:
|
|
|
+ - 'traefik.enable=true'
|
|
|
+ - 'traefik.http.routers.zitap-static.rule=Host(`zitap.example.com`) && PathPrefix(`/static/`)'
|
|
|
+ - 'traefik.http.routers.zitap-static.tls=true'
|
|
|
+ - 'traefik.http.routers.zitap-static.service=zitap-static'
|
|
|
+ - 'traefik.http.services.zitap-static.loadbalancer.server.port=8000'
|
|
|
+
|
|
|
+networks:
|
|
|
+ mysql:
|
|
|
+ external: True
|
|
|
+ proxy:
|
|
|
+ external: True
|