T
Twentyβ€’7d ago
Dultus

Can't host Twenty - twenty-db-1 is unhealthy

Hey, I've been following this guide here via Option 2. https://twenty.com/developers/section/self-hosting/docker-compose I use Portainer to host it. In the end I run into the following error: Pull complete server Pulled worker Pulled Network twenty_default Creating Network twenty_default Created Container twenty-change-vol-ownership-1 Creating Container twenty-db-1 Creating Container twenty-change-vol-ownership-1 Created Container twenty-db-1 Created Container twenty-server-1 Creating Container twenty-server-1 Created Container twenty-worker-1 Creating Container twenty-worker-1 Created Container twenty-change-vol-ownership-1 Starting Container twenty-db-1 Starting Container twenty-change-vol-ownership-1 Started Container twenty-db-1 Started Container twenty-db-1 Waiting Container twenty-change-vol-ownership-1 Waiting Container twenty-change-vol-ownership-1 Exited Container twenty-db-1 Error dependency failed to start: container twenty-db-1 is unhealthy It's the same compose and env file as in the example and changed the strings as asked.
35 Replies
Freebios
Freebiosβ€’7d ago
Hi there, do you have any error log on the database container ? If not, another lead could be that by default the health check expect the database to be healthy in about 50s, depending on your setup it might be a bit too short.
Dultus
Dultusβ€’7d ago
I can't get it deployed so there's no container yet. :/ I set it up to 150 seconds. Still no success though. Still the same error. Tried removing the health check to see any error logs:
postgresql 09:41:44.99 ERROR ==> The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development.
Tried setting the password on the stack and container. In both cases the environment for the container doesn't take it it seems.
Dultus
Dultusβ€’7d ago
No description
Dultus
Dultusβ€’7d ago
It just nulls the password and/or the ALLOW_EMPTY_PASSWORD flag.
Dultus
Dultusβ€’7d ago
No description
Dultus
Dultusβ€’7d ago
The logs of the server:
[Nest] 1 - 09/13/2024, 9:44:47 AM ERROR [TypeOrmModule] Unable to connect to the database (metadata). Retrying (9)... Error: getaddrinfo ENOTFOUND db at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) [Nest] 1 - 09/13/2024, 9:44:47 AM ERROR [ExceptionHandler] getaddrinfo ENOTFOUND db Error: getaddrinfo ENOTFOUND db at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
As URL I tried it with http://localhost:3000 and http://server.local:3000 (how I'll actually access it in the end)
Freebios
Freebiosβ€’7d ago
It seems to try to resolve the database address using 'db'. I’m not familiar with portainer, but I would say that the right domain in your case would be twenty-db-1 You could try to update the PG_DATABASE_HOST env?
Dultus
Dultusβ€’7d ago
[Nest] 1 - 09/13/2024, 11:02:20 AM ERROR [ExceptionHandler] getaddrinfo ENOTFOUND twenty-db-1 Error: getaddrinfo ENOTFOUND twenty-db-1 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
Basically the same error. Though that's probably because the db can't run?
postgresql 11:02:54.76 INFO ==> Starting PostgreSQL setup postgresql 11:02:54.78 INFO ==> Validating settings in POSTGRESQL_* env vars.. postgresql 11:02:54.78 ERROR ==> The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development. postgresql 11:02:54.78 ERROR ==> The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development.
The network settings say that they're all in the same network but the database doesn't seem to get any address.
Dultus
Dultusβ€’7d ago
No description
Dultus
Dultusβ€’7d ago
No description
Dultus
Dultusβ€’7d ago
Portainer in generell is just an interface that basically does the commands via UI. So there shouldn't be any difference. It's a regular Docker compose.
Freebios
Freebiosβ€’7d ago
Then ok the domain isn’t the issue πŸ˜… On your screen I see the db as running, but you don’t have any meaningful log? It’s not hanging either?
Dultus
Dultusβ€’7d ago
The DB error is the POSTGRESQL_PASSWORD issue And the DB can't draw a network address either. The server and worker can.
Freebios
Freebiosβ€’7d ago
Oh I see, have you tried to set the POSTGRES_ADMIN_PASSWORD env?
Dultus
Dultusβ€’7d ago
Ah, yeah. Now it's running. Just asked ChatGPT as well and gave me that info haha. Might want to add that to the startup guide. Okay, now the three are running - the "twenty-change-vol-ownership-1" exits itself. How do I access the twenty interface now? http://server.local:3000/ refuses the connection.
Want results from more Discord servers?
Add your server