我想完全通过 docker 部署我的 saleor-shop 应用程序。所以我为销售或后端、店面和仪表板构建了各自的图像。
在本地运行应用程序工作正常。后端在 localhost:8000/graphql 上可用 店面在 localhost:3000 运行 仪表板在 localhost:9000 运行
如果我想在 droplet IP 上运行应用程序 --> 我遇到了运行 saleor 后端的问题。截至目前,尝试访问 XXX.XX.XXX.XXX:8000 会导致“无法访问此站点”。店面和仪表板可在 XXX.XX.XXX.XXX:3000 和 XXX.XX.XXX.XXX:9000 上访问,但没有与后端进行任何交互,导致其不可用。这就是为什么 graphql 调用在店面不起作用并且登录到仪表板也不起作用,因为后端不可用。我想我在这里遗漏了一些东西,希望能得到任何帮助。
在我的液滴中,我使用以下 docker-compose.yml 文件来启动我的 docker 容器:
services:
api:
ports:
- 8000:8000
image: XXX/murukku-shop
restart: unless-stopped
networks:
- saleor-backend-tier
depends_on:
- db
- redis
- jaeger
env_file: common.env
environment:
- JAEGER_AGENT_HOST=jaeger
- STOREFRONT_URL=http://XXX.XX.XXX.XXX:3000/
- DASHBOARD_URL=http://XXX.XX.XXX.XXX:9000/
storefront:
image: XXX/murukku-storefront
ports:
- 3000:80
restart: unless-stopped
dashboard:
image: XXX/murukku-dashboard
ports:
- 9000:80
restart: unless-stopped
db:
image: library/postgres:11.1-alpine
ports:
- 5432:5432
restart: unless-stopped
networks:
- saleor-backend-tier
volumes:
- saleor-db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=saleor
- POSTGRES_PASSWORD=saleor
redis:
image: library/redis:5.0-alpine
ports:
- 6379:6379
restart: unless-stopped
networks:
- saleor-backend-tier
volumes:
- saleor-redis:/data
worker:
image: XXX/murukku-shop
restart: unless-stopped
networks:
- saleor-backend-tier
env_file: common.env
depends_on:
- redis
- mailhog
environment:
- EMAIL_URL=smtp://mailhog:1025
jaeger:
image: jaegertracing/all-in-one
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "9411:9411"
restart: unless-stopped
networks:
- saleor-backend-tier
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025 # smtp server
- 8025:8025 # web ui. Visit http://localhost:8025/ to check emails
restart: unless-stopped
networks:
- saleor-backend-tier
volumes:
saleor-db:
driver: local
saleor-redis:
driver: local
saleor-media:
networks:
saleor-backend-tier:
driver: bridge