|
1 | 1 | # Publishing the LibreDB Studio Railway Template |
2 | 2 |
|
3 | | -A Railway **marketplace template** is built in the visual composer, not from a |
4 | | -repo file. This is the exact checklist to create and publish it. The values to |
5 | | -enter are in [`template.json`](./template.json). |
| 3 | +A Railway **marketplace template** is built in the visual template editor, not |
| 4 | +from a repo file. This is the exact checklist to create and publish it. The |
| 5 | +values to enter are in [`template.json`](./template.json). |
6 | 6 |
|
7 | | -## 1. Open the composer |
| 7 | +## 1. Open the template editor |
8 | 8 |
|
9 | | -- Go to https://railway.com/compose (or Workspace → **Templates** → **New Template**). |
| 9 | +- Go to your **Workspace → Templates** page: <https://railway.com/workspace/templates> |
| 10 | +- Click **New Template**. This opens the template editor (a canvas, like a project). |
10 | 11 |
|
11 | 12 | ## 2. Add the Studio service |
12 | 13 |
|
13 | | -- Click **Add New → Docker Image**. |
14 | | -- Image: `ghcr.io/libredb/libredb-studio:0.9.19` (pinned — never `:latest`). |
| 14 | +- In the editor, click **+ New** (top-right), or open the command palette |
| 15 | + (`⌘K` / `Ctrl+K`) → **+ New Service** → **Docker Image**. |
| 16 | +- Image: `ghcr.io/libredb/libredb-studio:0.9.22` (pinned — never `:latest`). |
15 | 17 | - Rename the service to `libredb-studio`. |
16 | 18 |
|
17 | | -## 3. Configure the service (match `template.json`) |
18 | | - |
19 | | -- **Variables** tab — add each variable from `template.json`. For the generated |
20 | | - ones, type the function literally: |
21 | | - - `JWT_SECRET` = `${{ secret(48) }}` |
22 | | - - `ADMIN_PASSWORD` = `${{ secret(16) }}` |
23 | | - - `USER_PASSWORD` = `${{ secret(16) }}` |
24 | | - - `ADMIN_EMAIL` = `admin@libredb.org`, `USER_EMAIL` = `user@libredb.org` |
25 | | - - `NEXT_PUBLIC_AUTH_PROVIDER` = `local` |
26 | | - - `STORAGE_PROVIDER` = `sqlite`, `STORAGE_SQLITE_PATH` = `/app/data/libredb-storage.db` |
27 | | - - `PORT` = `3000` |
28 | | - - `LLM_PROVIDER`, `LLM_API_KEY`, `LLM_MODEL`, `LLM_API_URL` = leave blank |
29 | | -- **Settings** tab — enable **Public Networking**, target port `3000`; set |
30 | | - **Healthcheck Path** to `/api/db/health`. |
31 | | -- **Volume** — select the service, open its **Volumes** section, and add a volume with mount path `/app/data`. |
32 | | - |
33 | | -## 4. Create the template |
| 19 | +## 3. Variables |
| 20 | + |
| 21 | +Fastest path: **Variables → Raw Editor → ENV**, paste the values below, **Update |
| 22 | +Variables**, then add a **description** to each (the publish form asks for one). |
| 23 | +The `${{ secret(...) }}` values are auto-generated per deploy. |
| 24 | + |
| 25 | +### Pre-configured variables (defaults — entered for the deployer) |
| 26 | + |
| 27 | +| Variable | Value | Description | |
| 28 | +|----------|-------|-------------| |
| 29 | +| `JWT_SECRET` | `${{ secret(48) }}` | Secret key used to sign login session tokens. Auto-generated — keep it. | |
| 30 | +| `ADMIN_EMAIL` | `admin@libredb.org` | Login email for the ADMIN account (full access incl. maintenance tools). | |
| 31 | +| `ADMIN_PASSWORD` | `${{ secret(16) }}` | Password for the admin account. Auto-generated; find it in Variables after deploy. | |
| 32 | +| `USER_EMAIL` | `user@libredb.org` | Login email for the standard, query-only account. | |
| 33 | +| `USER_PASSWORD` | `${{ secret(16) }}` | Password for the standard user. Auto-generated; find it in Variables after deploy. | |
| 34 | +| `NEXT_PUBLIC_AUTH_PROVIDER` | `local` | Auth mode: 'local' (email/password). Set 'oidc' for SSO (needs the OIDC_* optional vars). | |
| 35 | +| `STORAGE_PROVIDER` | `sqlite` | Server-side storage for saved connections & settings: 'local' (browser only, no server persistence) \| 'sqlite' (file on the volume) \| 'postgres' (multi-node). Keep 'sqlite'. | |
| 36 | +| `STORAGE_SQLITE_PATH` | `/app/data/libredb-storage.db` | SQLite file path on the mounted volume (/app/data). Keep the default. | |
| 37 | +| `PORT` | `3000` | Port the app listens on. Must match the HTTP Proxy Port. Leave as 3000. | |
| 38 | + |
| 39 | +### Optional variables (add via "+ New Variable" and mark **Optional**) |
| 40 | + |
| 41 | +> ⚠️ Mark each of these **Optional** in the editor. A non-optional variable left |
| 42 | +> empty becomes a **required** field the deployer must fill, which breaks the |
| 43 | +> one-click flow. Optional vars let people enable AI / SSO / Postgres only if they want. |
| 44 | +
|
| 45 | +| Variable | Example | Description | |
| 46 | +|----------|---------|-------------| |
| 47 | +| `LLM_PROVIDER` | `gemini` | Optional AI query assistance: gemini \| openai \| ollama \| custom. Omit to keep AI off. | |
| 48 | +| `LLM_API_KEY` | `AIza… / sk-…` | API key for the chosen AI provider (Gemini/OpenAI). Not needed for a local Ollama. | |
| 49 | +| `LLM_MODEL` | `gemini-2.5-flash` | AI model name; provider default used if empty (e.g. gpt-4o-mini, llama3.1). | |
| 50 | +| `LLM_API_URL` | `http://host:11434/v1` | Base URL for ollama/custom AI providers only. Not needed for gemini/openai. | |
| 51 | +| `OIDC_ISSUER` | `https://tenant.auth0.com` | OIDC issuer URL for SSO. Required when NEXT_PUBLIC_AUTH_PROVIDER=oidc. | |
| 52 | +| `OIDC_CLIENT_ID` | | OIDC application client ID (SSO). | |
| 53 | +| `OIDC_CLIENT_SECRET` | | OIDC application client secret (SSO). | |
| 54 | +| `OIDC_SCOPE` | `openid profile email` | OIDC scopes. Defaults to 'openid profile email' if empty. | |
| 55 | +| `OIDC_ROLE_CLAIM` | `realm_access.roles` | Claim path holding user roles, used for admin mapping. | |
| 56 | +| `OIDC_ADMIN_ROLES` | `admin` | Comma-separated role values mapped to admin. Defaults to 'admin'. | |
| 57 | +| `STORAGE_POSTGRES_URL` | `postgresql://user:pass@host:5432/db` | PostgreSQL URL for multi-node storage. Also set STORAGE_PROVIDER=postgres. | |
| 58 | + |
| 59 | +## 4. Settings (service) |
| 60 | + |
| 61 | +- **Networking** — set **HTTP Proxy Port** to `3000` (enables public HTTP access). |
| 62 | +- **Deploy** — set **Healthcheck Path** to `/api/db/health` (Restart Policy |
| 63 | + `On Failure` is a sensible default). |
| 64 | +- **Volume** — NOT in the Settings panel. Close the settings modal, then on the |
| 65 | + editor **canvas right-click the `libredb-studio` service → Attach Volume**, and |
| 66 | + set the mount path to `/app/data`. |
| 67 | + |
| 68 | +## 5. Create the template |
34 | 69 |
|
35 | 70 | - Click **Create Template**. Railway gives it an unlisted URL and a unique code |
36 | 71 | (e.g. `ZweBXA`). |
37 | 72 |
|
38 | | -## 5. Smoke-test before publishing |
| 73 | +## 6. Smoke-test before publishing |
39 | 74 |
|
40 | 75 | - Deploy the unlisted template into a throwaway project. |
41 | 76 | - Open the public domain; confirm `/api/db/health` is green and the login page loads. |
42 | 77 | - Log in as `admin@libredb.org` with the generated `ADMIN_PASSWORD` (Variables tab). |
43 | 78 | - Add a saved connection, then **Redeploy** the service and confirm the |
44 | 79 | connection is still there (SQLite volume persistence). |
45 | 80 |
|
46 | | -## 6. Publish |
| 81 | +## 7. Publish |
47 | 82 |
|
48 | 83 | - Click **Publish** (or Workspace → Templates → **Publish** next to it). |
49 | | -- Fill the form: display name **LibreDB Studio**, the description and tags from |
50 | | - `template.json`, the logo (`libredb-studio.png`), category Database/Developer Tools. |
| 84 | +- Fill the form: display name **LibreDB Studio**, a short description (≤75 chars, |
| 85 | + e.g. `Open-source web SQL IDE with AI — PostgreSQL, MySQL, Mongo, Redis & more`), |
| 86 | + tags from `template.json`, the logo (`libredb-studio.png`), category |
| 87 | + Database/Developer Tools. |
| 88 | +- **Template Overview** (the long marketplace README field): paste the contents |
| 89 | + of [`TEMPLATE_OVERVIEW.md`](./TEMPLATE_OVERVIEW.md). |
51 | 90 | - Submit. The template is now in the marketplace and eligible for Railway's template kickback (revenue-share) program. |
52 | 91 |
|
53 | | -## 7. Wire up the Deploy button |
| 92 | +## 8. Wire up the Deploy button |
54 | 93 |
|
55 | | -- Copy the template code from the published URL |
56 | | - (`https://railway.com/new/template/<CODE>`). |
57 | | -- Replace `CODE` in: |
| 94 | +- After publishing, the marketplace URL has the form |
| 95 | + `https://railway.com/deploy/<template-name>?referralCode=<code>` (the |
| 96 | + `referralCode` is how Railway attributes deploys/kickbacks to you). |
| 97 | +- Put the **Deploy on Railway** button (image `https://railway.com/button.svg`) |
| 98 | + with that URL in: |
58 | 99 | - root `README.md` (the `## ⚡ One-Click Deploy` section) |
59 | 100 | - `deploy/railway/README.md` |
60 | | -- Commit the change. |
| 101 | +- Current published link: |
| 102 | + `https://railway.com/deploy/libredb-studio?referralCode=bGijnc&utm_medium=integration&utm_source=template&utm_campaign=generic` |
61 | 103 |
|
62 | 104 | ## Maintaining the template |
63 | 105 |
|
64 | 106 | On a new Studio release: |
65 | 107 |
|
66 | 108 | 1. Bump the image tag in `deploy/railway/template.json` and |
67 | 109 | `deploy/railway/README.md`. |
68 | | -2. In the composer / published template, update the image tag and re-publish |
69 | | - (Docker-image templates are **not** auto-updated by Railway). |
| 110 | +2. In the template editor / published template, update the image tag and |
| 111 | + re-publish (Docker-image templates are **not** auto-updated by Railway). |
0 commit comments