From e94065fb443be052334692b4d5a305115ef58bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Wed, 2 Apr 2025 15:37:51 +0200 Subject: [PATCH] Auto-run migration script on docker entrypoint (#11338) A small PR but a big step towards making Twenty easier to self-host and upgrade! Now changing the tag and pulling a new version should be the only step to upgrade as migrations script will be ran automatically upon starting the containers. It was already the case for typeorm migrations, but not for standard objects migration and data migration scripts. It is still possible to disable this behavior for the most complex deployments such as our own cloud. --- packages/twenty-docker/twenty/entrypoint.sh | 1 + .../content/developers/self-hosting/upgrade-guide.mdx | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/packages/twenty-docker/twenty/entrypoint.sh b/packages/twenty-docker/twenty/entrypoint.sh index 537e2ce2b..97560f710 100755 --- a/packages/twenty-docker/twenty/entrypoint.sh +++ b/packages/twenty-docker/twenty/entrypoint.sh @@ -17,6 +17,7 @@ if [ "${DISABLE_DB_MIGRATIONS}" != "true" ] && [ ! -f /app/docker-data/db_status # Run setup and migration scripts NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts yarn database:migrate:prod + yarn command:prod upgrade # Mark initialization as done echo "Successfuly migrated DB!" diff --git a/packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx b/packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx index f51df971d..15472e0fc 100644 --- a/packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx +++ b/packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx @@ -24,7 +24,16 @@ If you used Docker Compose, follow these steps: If you want to upgrade your instance by few versions, e.g. from 0.33.0 to 0.35.0, you have to upgrade your instance sequentially, in this example from 0.33.0 to 0.34.0, then from 0.34.0 to 0.35.0. + ## Version-specific upgrade steps +{/* +### v0.50.0 to v0.51.0 + +We've now added `yarn command:prod upgrade` to the entrypoint.sh[https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/twenty/entrypoint.sh#L19] file. +This means from now on, you shouldn't have to run any command manually anymore. +Just make sure to keep upgrading your instance sequentially, without skipping any major version (e.g. 0.43.3 to 0.44.0 is allowed, but 0.43.1 to 0.45.0 is not). +You can view your instance version in the admin panel (at /settings/admin-panel, accessible if your user has canImpersonate property set to true in the database). +*/} ### v0.44.0 to v0.50.0