Pckd
Pckd copied to clipboard
Docker frontend crashing
Using either the latest docker image or building it myself, I get this error:
frontend_1 | 2022/06/04 12:57:12 [emerg] 1#1: no host in upstream ":4000" in /etc/nginx/conf.d/default.conf:16
frontend_1 | nginx: [emerg] no host in upstream ":4000" in /etc/nginx/conf.d/default.conf:16
frontend_1 | Starting NGINX...
pckd-url-shortener_frontend_1 exited with code 1
Which makes Pckd unreachable from the web.
Make sure you've set the env variable "BACKEND_URL" in your front container, it should fix the "nginx: [emerg] no host in upstream ":4000"" error.
This is because in docker-compose the client must depend on the server
version: "3"
services:
server:
build:
context: ./server
volumes:
- ./logs:/home/node/app/logs
environment:
- DATABASE_URL=postgresql://postgres:postgres@db/pckd
- DATABASE_TYPE=postgres
- JWT_SECRET=verysecurestring
- IPREGISTRY_API_KEY=f1ntkcjoqaazglj7
depends_on:
- db
frontend:
build:
context: ./client
ports:
- 80:80
environment:
- BACKEND_URL=http://server:4000
depends_on:
- server
db:
image: postgres:13-alpine
volumes:
- ./db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=pckd