Budi
Explore posts from serversHow to sync state of production database to PR or staging environment?
I locally develop using a Postgres instance run via Docker.
My production environment in Railway has a Postgres service.
For each PR Railway creates a staging environment, with a Postgres db service.
Is there any way to get the state of database in the PR environment (or maybe a dedicated staging environment) to be the same as the production environment? It'd be great to be able to test my database migrations in a staging or PR environment where my db state is identical to production, to avoid making mistakes.
Thanks as always!
37 replies
Possible to get Railway variables in Github Action?
I have postgres next to my app service in Railway. Automated Github environments are enabled in Railway.
I wanted to run Drizzle's database management tool, Drizzle Studio on each Railway deploy. To do that, I wanted to use a Github Action, so that when I push to my branch it'll run the studio.
However I run into the problem that I don't know how to dynamically insert the
DATABASE_URL
service variable that Railway generates. I could hardcode it for my main
or staging
environments, but was wondering if there's a way to dynamically insert these?
If not, any suggestions on how I could run a database admin tool that allows me to edit the postgres db spun up for each new Railway environment?
Thx21 replies
Add caching to Node Dockerfile
I want to ask for feedback on my Dockerfile. This is the first time I've set up caching.
This Dockerfile works. My first deploy of this file was 143 secs, the second 124 secs. But that's still really slow IMO for that second try. Have I set this up properly for Node and PNPM as package manager?
Is there anything else I can do to speed these builds up?
I also noticed it's required to hardcode your
session-id
. I've now bound this to the service-id
of my main
production environment in Railway. What are the implication of this when a different environment is created in Railway for your project, for example when you create a new PR on Github?
Thanks!
59 replies
Help with Github automatic deployments
I've configured Github Automatic deployments per the docs. My production service is linked to my
/main
branch in the repo. I further have PR environments enabled and give them the env vars of main
.
1. New Railway environments are created successfully whenever we create a new PR, however they don't appear to close after we merge and close the PRs.
2. Also, the environments don't start with any services and therefore don't automatically deploy anything. The only workaround I've found is to manually enter the PR env in the Railway GUI and to sync the services with the ones running in the production environment.
3. The Railway bot comments on our PRs but always says the environment's deleted. See screenshot.
How can I fix these issues? Thanks.10 replies
Private networking in SvelteKit app
I've deployed a SvelteKit application on Railway using a Dockerfile. Within that project I have a separate service for cron jobs, also deployed with a Dockerfile.
The cron service calls endpoints on my SvelteKit application. This works fine using the public domain of the app service using HTTPS, but when attempting to use private networking it doesn't work.
In my app service, I've configured the server to listen on
0.0.0.0
with Railway's injected port. This builds well and logs Listening on 0.0.0.0:8080
, so I know it's working.
37 replies