Skip to content

Conversation

cprecioso
Copy link
Member

@cprecioso cprecioso commented Sep 22, 2025

Adds an optional --db-image argument to the wasp deploy railway {launch,setup} command, allowing the user to specify a custom Docker image for the database.

Their default Postgres service only allows adding extensions through the web interface, and only a few "blessed" ones (e.g. neither PostGIS or pgvector are available). If you want it any other way, you must deploy the image while setting the env variables yourself. For those, I copied Miho's already-running ask-the-documents app on Railway, and everything seems work correctly.

This is part of #3174. We're adding ask-the-documents to the repo, which needs a specific PostgreSQL extension. This way we can more easily test the app.

Note

🤖 Generated with Claude Code
and 👨🏻 reviewed and edited by a person

@cprecioso cprecioso self-assigned this Sep 22, 2025
@cprecioso cprecioso force-pushed the image-arg-for-deploy-railway branch 2 times, most recently from 97d94ee to eb43689 Compare September 22, 2025 13:18
@cprecioso cprecioso force-pushed the image-arg-for-deploy-railway branch from eb43689 to 00b0ad6 Compare September 22, 2025 13:22
@cprecioso cprecioso changed the title feat: add --image arg to wasp start db command Add --db-image to wasp deploy railway Sep 22, 2025
@cprecioso cprecioso changed the title Add --db-image to wasp deploy railway Add --db-image argument to wasp deploy railway Sep 22, 2025
Copy link

cloudflare-workers-and-pages bot commented Sep 22, 2025

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: c682352
Status: ✅  Deploy successful!
Preview URL: https://ea2f1a97.wasp-docs-on-main.pages.dev
Branch Preview URL: https://image-arg-for-deploy-railway.wasp-docs-on-main.pages.dev

View logs

@cprecioso cprecioso marked this pull request as ready for review September 23, 2025 08:13
Copy link
Contributor

@FranjoMindek FranjoMindek left a comment

Choose a reason for hiding this comment

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

Just text/docs changes.

Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

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

Reviewed but didn't search for "what is missing", just reviewed what I see!

Copy link
Contributor

@sodic sodic left a comment

Choose a reason for hiding this comment

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

There are plenty of reviewers here already so I won't take a detailed look unless you need me to.

I'll just say that this principle should also apply here (if applicable):


### 🔧 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

cprecioso and others added 8 commits September 26, 2025 15:13
Co-authored-by: Franjo Mindek <84568328+FranjoMindek@users.noreply.github.com>
Co-authored-by: Franjo Mindek <84568328+FranjoMindek@users.noreply.github.com>
Co-authored-by: Franjo Mindek <84568328+FranjoMindek@users.noreply.github.com>
Co-authored-by: Franjo Mindek <84568328+FranjoMindek@users.noreply.github.com>
Co-authored-by: Franjo Mindek <84568328+FranjoMindek@users.noreply.github.com>
cprecioso and others added 4 commits September 26, 2025 15:25
…up.ts

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
@cprecioso
Copy link
Member Author

ready @sodic @Martinsos @FranjoMindek

Copy link
Contributor

@infomiho infomiho left a comment

Choose a reason for hiding this comment

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

Left some comments

Comment on lines 217 to 233
By default, Wasp uses the standard PostgreSQL image provided by Railway when creating a new database for your app. However, if your application requires specific PostgreSQL extensions (e.g., PostGIS), you can specify a Docker image with a custom PostgreSQL installation, with the `--db-image <docker-image>` flag.

:::tip
You only need to specify the Docker image once, when first creating the app.
:::

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

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

The service name will always be `Postgres`, regardless of the image used.
Copy link
Contributor

Choose a reason for hiding this comment

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

If these texts are repeated verbatim - let's extract them into a partial and include in both places.


### 🔧 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.

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

"--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.

@cprecioso
Copy link
Member Author

@infomiho ready

@cprecioso cprecioso requested a review from infomiho October 8, 2025 09:35
@Martinsos
Copy link
Member

Unsubscribing myself and leaving it to miho

Copy link
Contributor

@infomiho infomiho left a comment

Choose a reason for hiding this comment

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

LGTM

@cprecioso cprecioso merged commit 5bc99cc into main Oct 10, 2025
23 checks passed
@cprecioso cprecioso deleted the image-arg-for-deploy-railway branch October 10, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants