Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix: support deploying outside the compose stack (#151)

Croff6245e8d48820
diff --git a/.env.example b/.env.example
index e9ece2f2..9f26a6b4 100644
--- a/.env.example
+++ b/.env.example
@@ -48,6 +48,9 @@ S3_BUCKET=planner-attachments
S3_ACCESS_KEY_ID=minioadmin
S3_SECRET_ACCESS_KEY=minioadmin
S3_REGION=us-east-1 # required by the SDK, ignored by MinIO
+# Set to false for a hosted store that serves only virtual-host-style buckets
+# (Railway buckets, Cloudflare R2). MinIO needs the default.
+# S3_FORCE_PATH_STYLE=false
# ── Secret encryption (AI provider API keys at rest) ──
# 32-byte AES key derived from this via SHA-256. Changing it makes stored
diff --git a/apps/api/src/shared/s3.ts b/apps/api/src/shared/s3.ts
index 85466603..a711b261 100644
--- a/apps/api/src/shared/s3.ts
+++ b/apps/api/src/shared/s3.ts
@@ -10,8 +10,10 @@ import {
// (see ../attachments/store.ts).
//
// Config comes from env. forcePathStyle is required for MinIO (and most
-// self-hosted S3 gateways) because they do not serve virtual-host-style buckets.
-// region is sent but ignored by MinIO; a value is still required by the SDK.
+// self-hosted S3 gateways) because they do not serve virtual-host-style buckets;
+// hosted stores that only serve virtual-host-style buckets set
+// S3_FORCE_PATH_STYLE=false. region is sent but ignored by MinIO; a value is
+// still required by the SDK.
let cached: { client: S3Client; bucket: string } | null = null;
@@ -31,7 +33,7 @@ function getClient(): { client: S3Client; bucket: string } {
endpoint,
region: process.env.S3_REGION || 'us-east-1',
credentials: { accessKeyId, secretAccessKey },
- forcePathStyle: true,
+ forcePathStyle: process.env.S3_FORCE_PATH_STYLE !== 'false',
}),
bucket,
};
diff --git a/docker-compose.coolify.yml b/docker-compose.coolify.yml
index 2f622e28..05536d01 100644
--- a/docker-compose.coolify.yml
+++ b/docker-compose.coolify.yml
@@ -101,6 +101,7 @@ services:
S3_ACCESS_KEY_ID: ${SERVICE_USER_MINIO}
S3_SECRET_ACCESS_KEY: ${SERVICE_PASSWORD_MINIO}
S3_REGION: ${S3_REGION:-us-east-1}
+ S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE:-}
# start_period covers the migrations the container applies before it listens.
healthcheck:
test: ['CMD', 'wget', '-q', '-O', '/dev/null', 'http://127.0.0.1:3000/']
diff --git a/docker-compose.yml b/docker-compose.yml
index c497c68e..77a92349 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -104,6 +104,7 @@ services:
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
S3_REGION: ${S3_REGION:-us-east-1}
+ S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE:-}
# start_period covers the migrations the container applies before it listens.
healthcheck:
test: ['CMD', 'wget', '-q', '-O', '/dev/null', 'http://127.0.0.1:3000/']
diff --git a/packages/db/src/migrate.ts b/packages/db/src/migrate.ts
index 0da5cff5..6b989c16 100644
--- a/packages/db/src/migrate.ts
+++ b/packages/db/src/migrate.ts
@@ -14,6 +14,24 @@ const db = drizzle(migrationClient);
const migrationsFolder = new URL('../drizzle', import.meta.url).pathname;
+// Compose orders the api behind a healthy postgres, but a platform without that
+// guarantee (Railway, plain `docker run`) starts both at once and the first
+// connections are refused. Wait for the server separately so a failing migration
+// still reports on the first attempt.
+const ATTEMPTS = 15;
+const RETRY_DELAY_MS = 2000;
+
+for (let attempt = 1; ; attempt++) {
+ try {
+ await migrationClient`select 1`;
+ break;
+ } catch (error) {
+ if (attempt === ATTEMPTS) throw error;
+ console.log(`⏳ Waiting for the database (${attempt}/${ATTEMPTS})...`);
+ await Bun.sleep(RETRY_DELAY_MS);
+ }
+}
+
console.log('⏳ Running migrations...');
await migrate(db, { migrationsFolder });
await migrationClient.end();