Open prolix-oc opened 6 days ago
To resolve the issue with the twenty-db
service being unhealthy, follow these steps:
Check Healthcheck Command: Ensure the healthcheck command in the docker-compose.yml
file is correct. It should be:
healthcheck:
test: pg_isready -U twenty -d default
interval: 5s
timeout: 5s
retries: 10
Database Initialization: Verify that the database is properly initialized using the init.sql
script. Ensure the init.sql
script is correctly copied and executed in the Dockerfile:
COPY ./packages/twenty-docker/twenty-postgres/init.sql /docker-entrypoint-initdb.d/
Environment Variables: Ensure all necessary environment variables are correctly set in the stack.env
file, especially POSTGRES_PASSWORD
and PG_DATABASE_HOST
.
Volume Bindings: Ensure the volume bindings for the database data directory are correctly set and accessible:
volumes:
db-data:/bitnami/postgresql
Network Configuration: Ensure the network configuration is correct and the db
service can communicate with other services. Check the networks
section in the docker-compose.yml
file.
If the issue persists, consider increasing the timeout
and retries
values in the healthcheck configuration to allow more time for the database to become healthy.
/packages/twenty-docker/docker-compose.yml /packages/twenty-postgres/docker/docker-compose.yml /packages/twenty-docker/twenty-postgres/Dockerfile /packages/twenty-docker /packages/twenty-postgres
I think it would be useful to get the logs from the db to further debug the issue. It could work easier if you comment out the worker and the server so that when you redeploy it gives you time to check the logs of the db without the stack auto destroying because of the failed health check.
Bug Description
Using the Docker Compose file provided, running Twenty for the first time is impossible due to the db service always coming back as unhealthy. Since this is a hard requirement for the other services to run, it will not run the stack.
Example:
I can't really provide an example of the app when it's not launching, but here is my Compose file. I am using Portainer Stacks, the provided example docker-compose.yml with some modifications to fit our setup, and then loading the envs using Portainer's stack.env file
stack.env file:
Expected behavior
The stack should launch, and Twenty should be operational with healthy containers since there has been zero prior manipulation of such containers.
Example:
Again... I don't have a reference for a working copy of Twenty.
Technical inputs
This is not a resource issue, as this is being run on a production server with 36 cores, 192GB of RAM, and 100Gbit networking. I've got plenty of resources to run 3 simple containers.
If there's a hard-coded requirement for a health check, perhaps we address the health checks by hostnames only or approach the health-checks without using networking. Some of us use macvlan networks to route container traffic, and they should be considered when offering a business-class software from a security standpoint alone. I find it hard to believe a lumbering beast like Authentik would cope with my interlinked macvlan/internal bridge setup, and not this.
If that's not the case, then I'm honestly stumped. I used a volume bind for the db's data directory to a path on our ZFS app pool as well, with no luck. I removed that mapping as a test.