D
Dokploy•6mo ago
Alex100dre

Deploying Strapi x PostgreSQL x Docker [Resolved]

Hello 👋 I'm trying to deploy a Strapi 5 app and a corresponding postgres database using docker but I'm facing some issues. The build and deployment process seems to work properly but when it tries to start the strapi container. I got this error :
yarn run v1.22.22
$ strapi start
[2024-11-28 13:33:49.187] error: getaddrinfo ENOTFOUND strapiDB
Error: getaddrinfo ENOTFOUND strapiDB
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[2024-11-28 13:33:49.192] info: Shutting down Strapi
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.22
$ strapi start
[2024-11-28 13:33:49.187] error: getaddrinfo ENOTFOUND strapiDB
Error: getaddrinfo ENOTFOUND strapiDB
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[2024-11-28 13:33:49.192] info: Shutting down Strapi
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It seems like there is only the strapi container that start but not the psql one. I'm using dokploy v0.10.1 I uploaded my Dockerfile and docker-compose.yml with the post
16 Replies
Alex100dre
Alex100dreOP•6mo ago
Same error when I try to connect to a db created directly on dokploy.
yarn run v1.22.22
$ strapi start
[2024-11-28 15:16:35.802] error: getaddrinfo ENOTFOUND postgresql://user:password@portfolio-ldev-portfolio-db-bg3h8d:5432/ldev-portfolio
Error: getaddrinfo ENOTFOUND postgresql://user:password@portfolio-ldev-portfolio-db-bg3h8d:5432/ldev-portfolio
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[2024-11-28 15:16:35.807] info: Shutting down Strapi
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.22
$ strapi start
[2024-11-28 15:16:35.802] error: getaddrinfo ENOTFOUND postgresql://user:password@portfolio-ldev-portfolio-db-bg3h8d:5432/ldev-portfolio
Error: getaddrinfo ENOTFOUND postgresql://user:password@portfolio-ldev-portfolio-db-bg3h8d:5432/ldev-portfolio
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[2024-11-28 15:16:35.807] info: Shutting down Strapi
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Ok, I managed to make it work using the Internal Host key insteaof the Internal Connection URL which look something like portfolio-ldev-portfolio-db-bg3h8d So I can access to my Strapi admin but the https is broken even if I crated a domain with traefik and selected the auto https certificate option. Also I would like to understand why I had to create my DB separately and why docker didn't created it automatically?
Alex100dre
Alex100dreOP•6mo ago
So I changed my docker-compose.yml to fit the recomandations in the doc for traefik but HTTPS is still broken and the A DNS rule on my cloudflare is not working neither :/
Siumauricio
Siumauricio•6mo ago
What’s the error you are facing with https?
Alex100dre
Alex100dreOP•6mo ago
No description
Siumauricio
Siumauricio•6mo ago
You are using generated domains?
Alex100dre
Alex100dreOP•6mo ago
Hum there is two things. I have one generated domain but the https is broken on it and I have my own domain set with cloudflare DNS but i'm getting this error on it
No description
Siumauricio
Siumauricio•6mo ago
Generated domains cannot have https In the docs we mention if I’m not wrong Have you followed the docs? We have a guide for cloudflare specific
Siumauricio
Siumauricio•6mo ago
Cloudflare | Dokploy
This guide will cover how to configure a Cloudflare domain for your applications in dokploy or panel.
Alex100dre
Alex100dreOP•6mo ago
I followed this one : https://docs.dokploy.com/docs/core/docker-compose/example I'll check your link sorry ^^
Example | Dokploy
Learn how to use Docker Compose with Dokploy
Alex100dre
Alex100dreOP•6mo ago
Ok, so I followed the documentation but still have an issue. The is exposed on my domain but the SSL certificate is broken https://portfolio.le-dev.com/admin/auth/login I'm using the flexible mode
Siumauricio
Siumauricio•6mo ago
I guess you cannot generate certificates for 2 domain level I guess You are using a domain with two levels I guess cloudflare restrict to a 1 level Only if you pay you can get certificates for deep domain levels
Alex100dre
Alex100dreOP•6mo ago
Actually I already have a same level of subdomain for a project on firebase with cloudflare and it's working properly https://cv.le-dev.com/
Développeur web Paris | CV Alexandre Hachim
CV Hachim Alexandre, développeur web JS Fullstack à Paris
Siumauricio
Siumauricio•6mo ago
How did you create the domain, can you show?
Alex100dre
Alex100dreOP•6mo ago
oh wait, the difference is that with this domain i'm using DNS only without the proxy. Same for https://roue.le-dev.com
Kikidaily?
Une roue pour determiner qui animera la prochaine réunion
Siumauricio
Siumauricio•6mo ago
For me is working that domain I can see the strapi login page
Alex100dre
Alex100dreOP•6mo ago
Ah YES, it's working now. maybe it just took time. Thanks dude and sorry for missing the doc at first time. I'll close this and let it here for other people

Did you find this page helpful?