Getting 503 Service Temporarily Unavailable upon deploying at DigitalOcean
arycloud opened this issue · 5 comments
First of all, thanks a lot for this great tutorial.
I'm following along, then I setup a domain name at Namecheap.com and setup Linux instance at DigitalOcean with docker and docker compose.
Here's my docker-compose.staging.yml
:
---
services:
db:
env_file:
- ./.env.staging.db
image: "postgres:13.0-alpine"
volumes:
- "postgres_data:/var/lib/postgresql/data/"
nginx-proxy:
build: nginx
container_name: nginx-proxy
depends_on:
- web
ports:
- "443:443"
- "80:80"
restart: always
volumes:
- "static_volume:/home/app/web/staticfiles"
- "media_volume:/home/app/web/mediafiles"
- "certs:/etc/nginx/certs"
- "html:/usr/share/nginx/html"
- "vhost:/etc/nginx/vhost.d"
- "/var/run/docker.sock:/tmp/docker.sock:ro"
nginx-proxy-letsencrypt:
depends_on:
- nginx-proxy
env_file:
- ./.env.staging.proxy-companion
image: jrcs/letsencrypt-nginx-proxy-companion
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "certs:/etc/nginx/certs"
- "html:/usr/share/nginx/html"
- "vhost:/etc/nginx/vhost.d"
- "acme:/etc/acme.sh"
web:
build:
context: ./app
dockerfile: Dockerfile.prod
command: "gunicorn dokerify.wsgi:application --bind 0.0.0.0:8000"
depends_on:
- db
env_file:
- ./.env.staging
expose:
- 8000
volumes:
- "static_volume:/home/app/web/staticfiles"
- "media_volume:/home/app/web/mediafiles"
version: "3.3"
volumes:
acme:
certs:
html:
media_volume:
postgres_data:
static_volume:
vhost:
Inside the app
direcotry my django app name is dockerify
.
Now, when I run:
docker-compose -f docker-compose.staging.yml up -d --build
If I hit my domain name at: https://<DOMAIN_NAME>, it returns:
503 Service Temporarily Unavailable
nginx
Couldn't found any error in logs.
What might be wrong?
same here! 503 in a ubuntu 20.04 droplet of digital ocean :( any luck getting the ssl?
Same here!! please help, anyone could resolve? i have the same error with aws
Same here 🥲 with AWS
I have repeated the process ( like setup a new server instance & re-build images) solved the problem. It's annoying but couldn't catch the exact problem may be we are doing something wrong...
The issue I had that caused the 503 error was that the host variables in .env.staging were pointing to the domain I was going to use for production, instead of the IP of the staging server hosting the application.
Basically, I had set up a test/staging server and needed the IP of that server to be set for the DJANGO_ALLOWED_HOSTS, VIRTUAL_HOST, and LETSENCRYPT_HOST variables.