Hi!
I'm new using deployment technologies and I'm trying to upload my api-webpage via Digital Ocean.
My API is dockerized and implemented with a django and a vue instances (with its correspondent postgresql db). My app works fine in local but I'm actually very stucked with the final deployment and the ssl configuration via traefik.
I was following this tutorial (Django-Vue-Docker-Deployment) and triyng all the different configurations possible even reading all the documentation and similar errors but I keep having the same problem generating the keys via ACME:
time="2023-06-25T17:22:50Z" level=error msg="Unable to obtain ACME certificate for domains \"apphistologia.top,www.apphistologia.top\": unable to generate a certificate for the domains [apphistologia.top www.apphistologia.top]: error: one or more domains had a problem:\n[apphistologia.top] acme: error: 403 :: urn:ietf:params:acme:error:unauthorized :: 91.195.240.123: Invalid response from http://apphistologia.top/.well-known/acme-challenge/8vAKRzUnYwypTPL2ALsijBfkxGVIfOSzy2h-rZXN7lo: \"<!DOCTYPE html><html lang=\\\"en\\\" data-adblockkey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANnylWw2vLY4hUn9w06zQKbhKBfvjFUCsdFlb6TdQhxb9RXW\"\n[www.apphistologia.top] acme: error: 403 :: urn:ietf:params:acme:error:unauthorized :: 91.195.240.123: Invalid response from http://www.apphistologia.top/.well-known/acme-challenge/D7rrobo7c-m3IzqXVhpaJoaI43iI8u8Ezn52VHmvA68: \"<!DOCTYPE html><html lang=\\\"en\\\" data-adblockkey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANnylWw2vLY4hUn9w06zQKbhKBfvjFUCsdFlb6TdQhxb9RXW\"\n" ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=frontend@file rule="Host(`apphistologia.top`) || Host(`www.apphistologia.top`)" providerName=letsencrypt.acme
My hosting provider and DNS server is Digital Ocean
And my production.yml file looks like this:
version: "3"
volumes:
media:
db_postgres_data:
production_traefik:
services:
db:
container_name: db_postgres
image: postgres:13.0-alpine
volumes:
- db_postgres_data:/var/lib/postgresql/data:Z
ports:
- "5432:5432"
env_file:
- ./tfg/.env
django:
container_name: backend_django
build:
context: .
dockerfile: ./Dockerfile
image: backend_django
volumes:
- media:/home/app/backend/data:Z
ports:
- "8050:8040"
depends_on:
- db
frontend:
container_name: frontend
restart: always
build:
context: ./tfg_front
dockerfile: Dockerfile
image: vue_frontend
depends_on:
- django
expose:
- "80"
traefik:
container_name: traefik
build:
context: .
dockerfile: ./traefik/Dockerfile
image: traefik_front
depends_on:
- django
volumes:
- production_traefik:/etc/traefik/acme:z
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
The traefik.yml looks like this:
log:
level: INFO
entryPoints:
# https://docs.traefik.io/routing/entrypoints/#entrypoint
web:
# http
address: ":80"
http:
redirections:
entryPoint:
to: websecure
websecure:
# https
address: ":443"
certificatesResolvers:
letsencrypt:
# https://docs.traefik.io/master/https/acme/#lets-encrypt
acme:
email: "javiexalonso@gmail.com"
storage: /etc/traefik/acme/acme.json
# https://docs.traefik.io/master/https/acme/#httpchallenge
httpChallenge:
entryPoint: web
http:
routers:
# https://docs.traefik.io/master/routing/routers/#certresolver
django:
rule: "Host(`api.apphistologia.top`)"
entryPoints:
- websecure
middlewares:
- csrf
service: django
tls:
certResolver: letsencrypt
frontend:
rule: "Host(`apphistologia.top`) || Host(`www.apphistologia.top`)"
entryPoints:
- websecure
middlewares:
- csrf
service: frontend
tls:
certResolver: letsencrypt
middlewares:
csrf:
# https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
headers:
hostsProxyHeaders: ["X-CSRFToken"]
services:
django:
loadBalancer:
servers:
- url: http://django:8050
frontend:
loadBalancer:
servers:
- url: http://frontend:80
providers:
# https://docs.traefik.io/master/providers/file/
file:
filename: /etc/traefik/traefik.yml
watch: true
I'll appreciate any type of help, I'm a newbie with all these deployment technologies and I need it for a university project. Thank you in advance
For some other reason the "api.apphistologia.top" it's giving me a 400 error too creating the key, but I think it's a minor inconvenience:
time="2023-06-25T17:22:43Z" level=error msg="Unable to obtain ACME certificate for domains \"api.apphistologia.top\": unable to generate a certificate for the domains [api.apphistologia.top]: error: one or more domains had a problem:\n[api.apphistologia.top] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up A for api.apphistologia.top - check that a DNS record exists for this domain; DNS problem: NXDOMAIN looking up AAAA for api.apphistologia.top - check that a DNS record exists for this domain\n" rule="Host(`api.apphistologia.top`)" providerName=letsencrypt.acme ACME CA="https://acme-v02.api.letsencrypt.org/directory" routerName=django@file