把django-realworld-example-app整个服务进行docker化.
docker-compose启动, 包括前后端, 数据库等:
docker-compose up在启动服务后, 创建表:
docker-compose exec backend python manage.py migrate相对原项目做了以下修改:
- 把conduit/settings.py里的DEBUG, SECRET_KEY, DATABASES改成环境变量.
- requirements.txt新增
- psycopg2-binary==2.8.3
- gunicorn==19.9.0
- frontend, 前端项目: http://localhost
- db, Postgresql数据库, 初始化时新建数据库
conduit, 当前设置用户名为postgres, 密码为pwd - pgadmin, PostgreSQL的Web管理界面: http://localhost:5050, 当前设置用户名为
admin, 密码为pwd. 连接数据库,Host name/address设为db,Port为5432,Username为postgres,Password为pwd - backend, 后端项目: http://localhost/api/
- proxy, 反向代理、负载均衡, traefik, Dashboard界面: http://localhost:8090/dashboard