# Twenty (Railway) GitOps (CLI-only)

This folder documents and snapshots our **Railway** configuration for the Twenty CRM project.
We intentionally use the **Railway CLI only** (no repo scripts) for day-2 operations.

## Files

- `config.json`
  - Convenience reference: projectId, environment name, and Railway service names.

## One-time setup

1) Login:
```bash
railway login
```

2) (Optional) Update `config.json` if project/service names change.

## Dump (variables)

Railway CLI does not have a built-in “redact-and-export” command.
To avoid committing secrets, do **not** redirect raw CLI output to a file or save it into the repo.

Use this for inspection:
```bash
cd twenty/web
railway link --project <projectId> --environment production --service "Twenty"
railway variables --json
```
Repeat for `twenty/worker` (`service "Twenty Worker"`).

## Apply (update variables)

You apply variables by running `railway variables --set ...` in each service directory:

```bash
cd twenty/web
railway link --project <projectId> --environment production --service "Twenty"
railway variables --set "PG_DATABASE_URL=${{Postgres.DATABASE_URL}}" \
  --set "REDIS_URL=${{Redis.REDIS_URL}}" \
  --set "SERVER_URL=https://cultscale.org" \
  --set "FRONTEND_URL=https://cultscale.org" \
  --set "STORAGE_TYPE=local" \
  --skip-deploys
```

Repeat for `twenty/worker` with `--service "Twenty Worker"`.
