使用Docker部署Django频道
我正在尝试将我的应用程序移动到Docker。我目前正在使用fabric部署我的Django应用程序。 我创建了一个docker compose文件:使用Docker部署Django频道,django,docker,docker-compose,django-channels,Django,Docker,Docker Compose,Django Channels,我正在尝试将我的应用程序移动到Docker。我目前正在使用fabric部署我的Django应用程序。 我创建了一个docker compose文件: version: '3' volumes: static-files: services: nginx: image: nginx:latest volumes: - ./deploy/conf/nginx.conf.template:/etc/nginx/conf.d/mysite.template
version: '3'
volumes:
static-files:
services:
nginx:
image: nginx:latest
volumes:
- ./deploy/conf/nginx.conf.template:/etc/nginx/conf.d/mysite.template
- static-files:/app/static
ports:
- "80:80"
environment:
- NGINX_HOST='localhost'
command: /bin/bash -c "envsubst '\$NGINX_HOST' < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
depends_on:
- interface
redis:
image: redis:latest
db:
restart: always
image: mdillon/postgis:9.5
environment:
- POSTGRES_USER=production
- POSTGRES_PASSWORD=production
- POSTGRES_DB=production
interface:
restart: always
build: .
working_dir: /app/code/src
command: ["../../../wait-for-db.sh", "db", "./interface-entrypoint.sh"]
volumes:
- static-files:/app/static
environment:
- DJANGO_SETTINGS_MODULE=restapi.settings.production_settings
expose:
- "8001"
depends_on:
- db
- redis
workerserver:
restart: always
build: .
working_dir: /app/code/src
command: ["./worker-entrypoint.sh"]
environment:
- DJANGO_SETTINGS_MODULE=restapi.settings.production_settings
depends_on:
- db
- redis
- interface
版本:“3”
卷数:
静态文件:
服务:
nginx:
图片:nginx:latest
卷数:
-./deploy/conf/nginx.conf.template:/etc/nginx/conf.d/mysite.template
-静态文件:/app/static
端口:
- "80:80"
环境:
-NGINX_HOST='localhost'
命令:/bin/bash-c“envsubt'\$NGINX\u HOST'/etc/NGINX/conf.d/default.conf&&NGINX-g“daemon off;””
取决于:
-接口
redis:
图片:redis:最新版本
db:
重新启动:始终
图片:mdillon/postgis:9.5
环境:
-POSTGRES_用户=生产
-POSTGRES_密码=生产
-POSTGRES_DB=生产
接口:
重新启动:始终
生成:。
工作目录:/app/code/src
命令:[“../../../wait for db.sh”、“db”、“/interface entrypoint.sh”]
卷数:
-静态文件:/app/static
环境:
-DJANGO_设置_模块=restapi.SETTINGS.production_设置
揭露:
- "8001"
取决于:
-分贝
-雷迪斯
workerserver:
重新启动:始终
生成:。
工作目录:/app/code/src
命令:[“/worker entrypoint.sh”]
环境:
-DJANGO_设置_模块=restapi.SETTINGS.production_设置
取决于:
-分贝
-雷迪斯
-接口
这个docker组件工作正常,我可以连接到服务器和所有。因此,我的问题是:
请一次只问一个问题。堆栈溢出用于特定问题。