From e944603f99df989772fd14945ab317d7b1064733 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 6 Jun 2026 14:49:24 -0600 Subject: [PATCH] fix: use stop-first update order for all database services (#4560) Docker Swarm's default start-first update order causes new database containers to fail with 'DBPathInUse' because two containers compete for the same data volume simultaneously. Docker then rolls back the update, silently reverting any env var or config changes. Using stop-first ensures the old container is stopped before the new one starts, preventing volume lock conflicts across all database types. Fixes #4550 --- packages/server/src/utils/databases/libsql.ts | 6 +++++- packages/server/src/utils/databases/mariadb.ts | 6 +++++- packages/server/src/utils/databases/mongo.ts | 6 +++++- packages/server/src/utils/databases/mysql.ts | 6 +++++- packages/server/src/utils/databases/postgres.ts | 6 +++++- packages/server/src/utils/databases/redis.ts | 6 +++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/server/src/utils/databases/libsql.ts b/packages/server/src/utils/databases/libsql.ts index e3074ceca..70937c64e 100644 --- a/packages/server/src/utils/databases/libsql.ts +++ b/packages/server/src/utils/databases/libsql.ts @@ -140,7 +140,11 @@ export const buildLibsql = async (libsql: LibsqlNested) => { : []), ], }, - UpdateConfig, + UpdateConfig: libsql.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try { const service = docker.getService(appName); diff --git a/packages/server/src/utils/databases/mariadb.ts b/packages/server/src/utils/databases/mariadb.ts index bd3ba31f6..3e5a9ef49 100644 --- a/packages/server/src/utils/databases/mariadb.ts +++ b/packages/server/src/utils/databases/mariadb.ts @@ -111,7 +111,11 @@ export const buildMariadb = async (mariadb: MariadbNested) => { ] : [], }, - UpdateConfig, + UpdateConfig: mariadb.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try { const service = docker.getService(appName); diff --git a/packages/server/src/utils/databases/mongo.ts b/packages/server/src/utils/databases/mongo.ts index 6644ea5c4..c1617fac0 100644 --- a/packages/server/src/utils/databases/mongo.ts +++ b/packages/server/src/utils/databases/mongo.ts @@ -167,7 +167,11 @@ ${command ?? "wait $MONGOD_PID"}`; ] : [], }, - UpdateConfig, + UpdateConfig: mongo.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try { diff --git a/packages/server/src/utils/databases/mysql.ts b/packages/server/src/utils/databases/mysql.ts index f68cb42de..34dd6c21e 100644 --- a/packages/server/src/utils/databases/mysql.ts +++ b/packages/server/src/utils/databases/mysql.ts @@ -117,7 +117,11 @@ export const buildMysql = async (mysql: MysqlNested) => { ] : [], }, - UpdateConfig, + UpdateConfig: mysql.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try { const service = docker.getService(appName); diff --git a/packages/server/src/utils/databases/postgres.ts b/packages/server/src/utils/databases/postgres.ts index 6be8f19c3..6eddb4581 100644 --- a/packages/server/src/utils/databases/postgres.ts +++ b/packages/server/src/utils/databases/postgres.ts @@ -109,7 +109,11 @@ export const buildPostgres = async (postgres: PostgresNested) => { ] : [], }, - UpdateConfig, + UpdateConfig: postgres.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try { const service = docker.getService(appName); diff --git a/packages/server/src/utils/databases/redis.ts b/packages/server/src/utils/databases/redis.ts index fd358ee51..21388c848 100644 --- a/packages/server/src/utils/databases/redis.ts +++ b/packages/server/src/utils/databases/redis.ts @@ -115,7 +115,11 @@ export const buildRedis = async (redis: RedisNested) => { ] : [], }, - UpdateConfig, + UpdateConfig: redis.updateConfigSwarm ?? { + Parallelism: 1, + Order: "stop-first" as const, + FailureAction: "rollback" as const, + }, }; try {