Open patschwork opened 3 months ago
To resolve the issue with user login when using a local directory for db-data
, update the docker-compose.yml
file as follows:
In the db
service, ensure the volume is correctly mapped:
db:
image: twentycrm/twenty-postgres:${TAG}
volumes:
- ./db-data:/bitnami/postgresql # local directory with file permissions for UID 1001
environment:
POSTGRES_PASSWORD: ${POSTGRES_ADMIN_PASSWORD}
healthcheck:
test: pg_isready -U twenty -d default
interval: 5s
timeout: 5s
retries: 10
restart: always
In the worker
service, set ENABLE_DB_MIGRATIONS
to true
:
worker:
image: twentycrm/twenty:${TAG}
command: ["yarn", "worker:prod"]
environment:
PG_DATABASE_URL: postgres://twenty:twenty@${PG_DATABASE_HOST}/default
SERVER_URL: ${SERVER_URL}
FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL}
MESSAGE_QUEUE_TYPE: ${MESSAGE_QUEUE_TYPE}
ENABLE_DB_MIGRATIONS: "true" # Set this to true
STORAGE_TYPE: ${STORAGE_TYPE}
STORAGE_S3_REGION: ${STORAGE_S3_REGION}
STORAGE_S3_NAME: ${STORAGE_S3_NAME}
STORAGE_S3_ENDPOINT: ${STORAGE_S3_ENDPOINT}
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET}
LOGIN_TOKEN_SECRET: ${LOGIN_TOKEN_SECRET}
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET}
FILE_TOKEN_SECRET: ${FILE_TOKEN_SECRET}
depends_on:
db:
condition: service_healthy
server:
condition: service_healthy
restart: always
This should allow login/signup to work as expected.
/packages/twenty-docker/docker-compose.yml /packages/twenty-postgres/docker/docker-compose.yml /packages/twenty-docker/.env.example /packages/twenty-server/.env.example /packages/twenty-website/src/content/developers/self-hosting/docker-compose.mdx
Hey there, that's odd, the migration should be running on the server container and worker is waiting for the server to be healthy. I could not reproduce on a fresh install on my end.
Did you get any logs that could help us pinpoint the issue ?
Hey there, that's odd, the migration should be running on the server container and worker is waiting for the server to be healthy. I could not reproduce on a fresh install on my end.
Did you get any logs that could help us pinpoint the issue ?
Hi, I looked into my notes, but I didn't save any output or logs. 🤷♂️
If you can't reproduce the error, feel free to close this issue.
Thanks for looking at it.
Bug Description
When using a local directory for storing the db-data content, you can't login after fresh setup. The hint here doesn't work: https://twenty.com/developers/section/self-hosting/docker-compose#not-able-to-login
Example:
Excerpt from
docker-compose.yml
Expected behavior
Login/signup is possible as if it would be a docker managed volume
Workaround
It will work, when set the parameter
ENABLE_DB_MIGRATIONS: "true"
in the worker section ofdocker-compose.yml
Example: