
Deploy Multica
Multica on Railway with automatic URL/daemon setup, OpenCode, and Postgres.
Frontend
Just deployed
Backend
Just deployed
/app/data
PG Vector
Just deployed
/var/lib/postgresql
Deploy and Host Multica on Railway
Deploys Multica as three Railway services:
- Backend — builds the Multica Go server and CLI from the
railway-templatebranch ofaalfath/multica-railway. The runtime image includes OpenCode1.18.23, Git, and persistent daemon/workspace state under/app/data. - Frontend — builds the Next.js web application from
Dockerfile.web. - PG Vector — runs
pgvector/pgvector:pg17with persistent PostgreSQL storage.
The Backend volume is mounted at /app/data; the PG Vector volume is mounted at /var/lib/postgresql. The Backend automatically writes its Railway API/app URLs into the persistent Multica CLI profile and retries daemon startup after authentication is available. No manual setup command is needed just to point the CLI at this deployment. For unattended CLI authentication, set the optional MULTICA_DAEMON_TOKEN Railway secret; OpenCode provider login is still interactive.
About Hosting
Railway hosts the Multica web application, API, daemon runtime, and PostgreSQL-compatible vector database as managed services. Public domains are provisioned automatically, while service-to-service traffic uses Railway's private network.
Why Deploy
This template provides a reproducible self-hosted Multica installation with persistent backend state, database storage, healthchecks, and an OpenCode-enabled backend image.
Common Use Cases
- Run a private Multica workspace for engineering or operations teams.
- Run the Multica agent daemon inside the Railway Backend container.
- Keep uploads, OpenCode credentials, workspaces, and PostgreSQL data across redeployments.
Dependencies for Multica
Deployment Dependencies
- A Railway account and a workspace with permission to create services and volumes.
- Generated PostgreSQL, JWT, and VCS secret values during deployment.
- OpenCode provider credentials configured after connecting to the Backend with
railway ssh.
Configure the Backend daemon
After deployment, use the Railway CLI to open a shell in the Backend and register the LLM provider used by OpenCode:
railway ssh --service Backend
opencode auth login
opencode auth list
The Railway API/app URLs are configured automatically at boot. To authenticate the Multica CLI against this self-hosted server and start the daemon immediately, run:
multica setup self-host \
--server-url "$MULTICA_SERVER_URL" \
--app-url "$MULTICA_APP_URL"
multica daemon status
With both Railway URL variables present, plain multica setup also selects the
self-hosted flow automatically. Use multica setup cloud only when you want to
connect this container to Multica Cloud.
If the OAuth callback cannot reach the SSH session directly, follow the tunnel hint printed by multica setup self-host, or use multica login --token= for an interactive token prompt.
For future restarts, set MULTICA_DAEMON_TOKEN as a Railway secret containing a
Multica personal access token. The Backend entrypoint uses it to authenticate
the persisted CLI profile before retrying daemon startup. It never replaces
opencode auth login, which must be completed interactively to register an LLM
provider.
Required environment variables
Railway may ask for values that are intentionally not embedded in the template. Use generated values for passwords and secrets.
# PG Vector
POSTGRES_DB=multica
POSTGRES_USER=multica
POSTGRES_PASSWORD=
# Backend
ALLOW_SIGNUP=true
APP_ENV=production
CORS_ALLOWED_ORIGINS=https://${{Frontend.RAILWAY_PUBLIC_DOMAIN}}
DATABASE_URL=postgres://${{PG Vector.POSTGRES_USER}}:${{PG Vector.POSTGRES_PASSWORD}}@${{PG Vector.RAILWAY_PRIVATE_DOMAIN}}:5432/${{PG Vector.POSTGRES_DB}}?sslmode=disable
FRONTEND_ORIGIN=https://${{Frontend.RAILWAY_PUBLIC_DOMAIN}}
JWT_SECRET=
MULTICA_APP_URL=https://${{Frontend.RAILWAY_PUBLIC_DOMAIN}}
MULTICA_DAEMON_SERVER_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
MULTICA_DATABASE_CONNECT_TIMEOUT=5s
MULTICA_DATABASE_STARTUP_TIMEOUT=3m
MULTICA_DAEMON_TOKEN=
MULTICA_OPENCODE_PATH=/usr/local/bin/opencode
MULTICA_PUBLIC_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
MULTICA_SERVER_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
MULTICA_VCS_INTEGRATION_ENABLED=true
MULTICA_VCS_SECRET_KEY=
PORT=8080
# Frontend
HOSTNAME=0.0.0.0
NODE_ENV=production
PORT=3000
RAILWAY_DOCKERFILE_PATH=Dockerfile.web
REMOTE_API_URL=http://${{Backend.RAILWAY_PRIVATE_DOMAIN}}:8080
The template creates public service domains automatically. The Backend healthcheck is /healthz, and the Frontend healthcheck is /.
Template Content
