Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
00b0ad6
Initial impl
cprecioso Sep 19, 2025
717acb5
Format
cprecioso Sep 22, 2025
7a84c2a
Simpler logic
cprecioso Sep 22, 2025
f5c05cf
Correct docs
cprecioso Sep 22, 2025
45862be
Add changelog
cprecioso Sep 22, 2025
c276d57
Revert "Simpler logic"
cprecioso Sep 22, 2025
dee1cbc
Custom database logic
cprecioso Sep 22, 2025
984c58a
Fixes
cprecioso Sep 23, 2025
0d82d87
Change changelog
cprecioso Sep 26, 2025
3c76921
Merge branch 'main' into image-arg-for-deploy-railway
cprecioso Sep 26, 2025
7798922
Update web/docs/deployment/deployment-methods/wasp-deploy/railway.md
cprecioso Sep 26, 2025
8c9c0dd
Update web/docs/deployment/deployment-methods/wasp-deploy/railway.md
cprecioso Sep 26, 2025
4217d57
Update web/docs/deployment/deployment-methods/wasp-deploy/railway.md
cprecioso Sep 26, 2025
97ad6e9
Update web/docs/deployment/deployment-methods/wasp-deploy/railway.md
cprecioso Sep 26, 2025
5f66ed4
Update web/docs/deployment/deployment-methods/wasp-deploy/railway.md
cprecioso Sep 26, 2025
91b92db
Consistent description
cprecioso Sep 26, 2025
3d67589
Comment
cprecioso Sep 26, 2025
12a0177
Update waspc/packages/deploy/src/providers/railway/commands/setup/set…
cprecioso Sep 26, 2025
09b1f8e
Fix
cprecioso Sep 26, 2025
7d91499
Docs
cprecioso Sep 26, 2025
143d365
Make DB docs consistent between providers
cprecioso Sep 29, 2025
f23dfab
Consistent DB arg
cprecioso Sep 29, 2025
aeca0f1
More readable array
cprecioso Oct 8, 2025
c130a77
Use helper
cprecioso Oct 8, 2025
f38591d
Extract partial
cprecioso Oct 8, 2025
c682352
Merge branch 'main' into image-arg-for-deploy-railway
cprecioso Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 🔧 Small improvements

- You can now specify which PostgreSQL image to use in `wasp deploy railway` with the `--db-image` argument. ([#3184](https://github.com/wasp-lang/wasp/pull/3184))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'd list this as a feature :)

Btw, please bump the version in waspc.cabal to 0.18.1.
I haven't yet delieverd the post mortem and made my case for this, so just trust me bro :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait until we decided on the postmortem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we decided we want to bump right away, does this make this comment actionable now?

Copy link
Member Author

@cprecioso cprecioso Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it on here since I don't want to mix concerns in the same PR, we can merge that one first
#3236


### 📖 Documentation

- Added note for SMTP ports being blocked by some hosting providers (by @Vickram-T-G). ([#3109](https://github.com/wasp-lang/wasp/pull/3109))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import {
export interface SetupCmdOptions extends CommonCmdOptions, SecretsOptions {
existingProjectId: RailwayProjectId | null;
workspace: string | null;
dbImage?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,42 @@ async function setupRailwayProjectForDirectory({

async function setupDb({
cmdOptions: options,
dbServiceName,
}: DeploymentInstructions<SetupCmdOptions>): Promise<void> {
waspSays("Setting up database");

const railwayCli = createCommandWithCwd(
options.railwayExe,
options.waspProjectDir,
);
await railwayCli(["add", "-d", "postgres"]);

if (options.dbImage) {
waspSays(`Using custom database image: ${options.dbImage}`);
// When using a custom database image, the automatic variables that Railway sets up for the
// default Postgres template are not available.
await railwayCli([
"add",
"--service",
dbServiceName,
"--image",
options.dbImage,
"--variables",
"POSTGRES_DB=railway",
"--variables",
"POSTGRES_USER=postgres",
"--variables",
"POSTGRES_PASSWORD=${{secret()}}",
"--variables",
"PORT=5432",
"--variables",
"PGDATA=/var/lib/postgresql/data/pgdata",
"--variables",
"DATABASE_URL=postgresql://${{POSTGRES_USER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:${{PORT}}/${{POSTGRES_DB}}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reuse the getRailwayEnvVarValueReference helper for these Railway env var references 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I did it, but tbh I don't think we're winning much by using it, on the contrary making it more difficult to read the variable. Check it out and tell me what you think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it's more readable now because it's quite explicit about what's going on. Either way, I'd keep it consistent now with the other place where we use env var references - at least when we decide to refactor it, there won't be two different ways of doing things.

]);
} else {
// Use the default Railway Postgres template
await railwayCli(["add", "-d", "postgres"]);
}
}

async function setupServer({
Expand Down
8 changes: 8 additions & 0 deletions waspc/packages/deploy/src/providers/railway/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function makeRailwaySetupCommand(): Command {
"--workspace [workspace]",
"the Railway workspace to use if a new project needs to be created (if not provided, will ask interactively)",
)
.option(
"--db-image [dbImage]",
"custom Docker image for the Postgres database (e.g., postgis/postgis for PostGIS extensions)",
)
.action(setupFn);
}

Expand Down Expand Up @@ -140,5 +144,9 @@ function makeRailwayLaunchCommand(): Command {
"--workspace [workspace]",
"the Railway workspace to use if a new project needs to be created (if not provided, will ask interactively)",
)
.option(
"--db-image [dbImage]",
"custom Docker image for the Postgres database (e.g., postgis/postgis for PostGIS extensions)",
)
.action(launchFn);
}
32 changes: 30 additions & 2 deletions web/docs/deployment/deployment-methods/wasp-deploy/railway.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The project name is used as a base for your server and client service names on R
- `my-wasp-app-client`
- `my-wasp-app-server`

Railway doesn't allow setting the database service name using the Railway CLI. It will always be named `Postgres`.
Railway doesn't allow setting the database service name using the Railway CLI. It will always be named `Postgres`. This also applies when using `--db-image`.

<LaunchCommandEnvVars />

Expand Down Expand Up @@ -96,6 +96,20 @@ wasp deploy railway setup <project-name>
wasp deploy railway deploy <project-name>
```

#### Using a custom database image

Use `--db-image <docker-image>` to provision the database with a specific Postgres image (for example, to enable extensions):

```shell
# PostGIS
wasp deploy railway launch my-wasp-app --db-image postgis/postgis

# pgvector
wasp deploy railway launch my-wasp-app --db-image pgvector/pgvector:pg16
```

When provided, Wasp configures the DB service on Railway using the given image and required Postgres environment variables. If omitted, Railway’s default Postgres is used. The service name remains `Postgres`.

#### Explicitly providing the Railway project ID

By default, Wasp CLI tries to create a new Railway project named `<project-name>`. If you want to use an existing Railway project, pass its ID with `--existing-project-id` option:
Expand Down Expand Up @@ -192,7 +206,21 @@ The project name is used as a base for your server and client service names on R
- `<project-name>-client`
- `<project-name>-server`

Railway also creates a PostgreSQL database service named `Postgres`.
Railway also creates a PostgreSQL database service named `Postgres` (the name remains the same even when using `--db-image`).

#### Using a custom database image

To create the database using a specific Postgres image, pass `--db-image <docker-image>`:

```shell
# PostGIS
wasp deploy railway setup my-wasp-app --db-image postgis/postgis

# pgvector
wasp deploy railway setup my-wasp-app --db-image pgvector/pgvector:pg16
```

When provided, Wasp sets up the DB service with the specified image and configures necessary Postgres variables. If not provided, Railway’s default Postgres template is used.

#### Explicitly providing the Railway project ID

Expand Down
Loading