mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
Configure the deployment so Ghostfolio deploys from the main branch and the ghostfolio-agent submodule uses the ghostfolio-main branch: - Add .gitmodules defining ghostfolio-agent on ghostfolio-main branch - Add scripts/railway-build.sh for local/CI builds with submodule init - Add scripts/railway-deploy.sh as container runtime entry-point - Update Dockerfile to clone ghostfolio-agent during the build stage when the submodule is not pre-initialized in the build context - Update railway.toml with branch strategy documentation https://claude.ai/code/session_01Gk8caDep1ufgTpkYgEPnXepull/6450/head
6 changed files with 113 additions and 1 deletions
@ -0,0 +1,4 @@ |
|||
[submodule "ghostfolio-agent"] |
|||
path = ghostfolio-agent |
|||
url = https://github.com/RajatA98/ghostfolio-agent.git |
|||
branch = ghostfolio-main |
|||
@ -0,0 +1,52 @@ |
|||
#!/bin/sh |
|||
# railway-build.sh |
|||
# Railway build script for Ghostfolio |
|||
# Ensures the main branch is used for Ghostfolio and the ghostfolio-main |
|||
# branch is used for the ghostfolio-agent submodule. |
|||
|
|||
set -e |
|||
|
|||
GHOSTFOLIO_BRANCH="main" |
|||
AGENT_SUBMODULE="ghostfolio-agent" |
|||
AGENT_BRANCH="ghostfolio-main" |
|||
|
|||
echo "=== Ghostfolio Railway Build ===" |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 1. Validate / report the current Ghostfolio branch |
|||
# --------------------------------------------------------------------------- |
|||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown") |
|||
echo "Ghostfolio branch: $CURRENT_BRANCH (expected: $GHOSTFOLIO_BRANCH)" |
|||
|
|||
if [ "$CURRENT_BRANCH" != "$GHOSTFOLIO_BRANCH" ]; then |
|||
echo "WARNING: Current branch is '$CURRENT_BRANCH', expected '$GHOSTFOLIO_BRANCH'." |
|||
echo "Railway should be configured to deploy from the '$GHOSTFOLIO_BRANCH' branch." |
|||
fi |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 2. Initialize and update the ghostfolio-agent submodule |
|||
# --------------------------------------------------------------------------- |
|||
echo "Initializing submodule: $AGENT_SUBMODULE ..." |
|||
git submodule init "$AGENT_SUBMODULE" |
|||
git submodule update --remote --checkout "$AGENT_SUBMODULE" |
|||
|
|||
# Ensure the submodule is on the correct branch |
|||
cd "$AGENT_SUBMODULE" |
|||
echo "Checking out $AGENT_BRANCH for $AGENT_SUBMODULE ..." |
|||
git fetch origin "$AGENT_BRANCH" |
|||
git checkout "$AGENT_BRANCH" |
|||
git pull origin "$AGENT_BRANCH" |
|||
cd .. |
|||
|
|||
echo "$AGENT_SUBMODULE is on branch: $(cd "$AGENT_SUBMODULE" && git rev-parse --abbrev-ref HEAD)" |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 3. Install dependencies and build |
|||
# --------------------------------------------------------------------------- |
|||
echo "Installing dependencies ..." |
|||
npm ci |
|||
|
|||
echo "Building Ghostfolio for production ..." |
|||
npm run build:production |
|||
|
|||
echo "=== Build complete ===" |
|||
@ -0,0 +1,31 @@ |
|||
#!/bin/sh |
|||
# railway-deploy.sh |
|||
# Railway deployment entry-point for Ghostfolio. |
|||
# This script is executed inside the running container. It runs database |
|||
# migrations, seeds the database, and starts the application server. |
|||
# |
|||
# Branch configuration (build-time): |
|||
# - Ghostfolio: main |
|||
# - ghostfolio-agent: ghostfolio-main |
|||
|
|||
set -e |
|||
|
|||
echo "=== Ghostfolio Railway Deployment ===" |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 1. Database migrations |
|||
# --------------------------------------------------------------------------- |
|||
echo "Running database migrations ..." |
|||
npx prisma migrate deploy |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 2. Seed the database |
|||
# --------------------------------------------------------------------------- |
|||
echo "Seeding the database ..." |
|||
npx prisma db seed |
|||
|
|||
# --------------------------------------------------------------------------- |
|||
# 3. Start the server |
|||
# --------------------------------------------------------------------------- |
|||
echo "Starting the Ghostfolio server ..." |
|||
exec node main |
|||
Loading…
Reference in new issue