-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
21 lines (15 loc) · 854 Bytes
/
start.sh
File metadata and controls
21 lines (15 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# This file is how Fly starts the server (configured in fly.toml). Before starting
# the server though, we need to run any Atlas migrations that haven't yet been
# run, which is why this file exists in the first place.
# Learn more: https://community.fly.io/t/sqlite-not-getting-setup-properly/4386
set -ex
# 1. Apply shared DB migrations
atlas migrate apply --env local --url "sqlite://${UPFLOW_DATA_DIR}/data.db"
# 2. Migrate integrations data from tenant DBs to shared DB (idempotent, safe to re-run)
node build/db/migrate-integrations-to-shared.js
# 3. Apply tenant migrations to all existing tenant DBs
node build/db/apply-tenant-migrations.js
# Load Sentry before server (same as pnpm start). No-op when SENTRY_DSN is unset.
export NODE_OPTIONS="--import ./instrument.server.mjs${NODE_OPTIONS:+ $NODE_OPTIONS}"
exec node server.mjs