W
Wasp2d ago
Kynetix

railway deploy for existing app

I have an existing Opensaas app that is currently hosted on Fly.io, and I want to deploy it to my Railway account. The latest Opensaas version now includes easy Railway deployment via the CLI. What are the steps to deploy it to my Railway account?
6 Replies
MEE6
MEE62d ago
Wohooo @Kynetix, you just became a Waspeteer level 8!
kapa.ai
kapa.ai2d ago
Hi @Kynetix. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Currently, the Wasp CLI supports automated deployment to Fly.io, and Railway CLI support is listed as "coming soon" in the official documentation. The CLI-based one-line deployment for Railway is not yet available, but you can deploy your existing Opensaas (Wasp) app to Railway by following the manual deployment steps. Here’s how you can deploy your existing app to Railway manually: 1. Build Your Wasp App In your project directory, run:
wasp build
wasp build
2. Set Up Railway Project - Create a Railway account and a new project. - Provision a PostgreSQL database. - Add two empty services: one named server and one named client (manual guide). 3. Deploy the Server - Go to .wasp/build:
cd .wasp/build

cd .wasp/build

- Link to your Railway project:
railway link

railway link

- In the Railway dashboard, set environment variables for the server service: - DATABASE_URL (use the provided reference) - WASP_WEB_CLIENT_URL (client domain) - WASP_SERVER_URL (server domain) - JWT_SECRET (random 32+ character string) - Deploy:
railway up

railway up

Select server when prompted (manual server deployment). 4. Deploy the Client - Go to .wasp/build/web-app:
cd web-app

cd web-app

- Install dependencies and build the client:
npm install && REACT_APP_API_URL=<server_url> npm run build

npm install && REACT_APP_API_URL=<server_url> npm run build

- Copy the build to dist:
cp -r build dist

cp -r build dist

- Create a Dockerfile:
FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html" ]
COPY ./dist/ /srv/http/

FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html" ]
COPY ./dist/ /srv/http/

- Create a .dockerignore with:
node_modules/

node_modules/

- Set the PORT environment variable to 8043 in the Railway dashboard for the client service. - Deploy:
railway up

railway up

Select client when prompted (manual client deployment). 5. Finalize After both services are deployed, your app should be live on Railway. You can find your deployed services in the Railway dashboard (conclusion). --- Note:
The knowledge sources do not mention a fully automated CLI deployment for Railway as of now. If the latest Opensaas version or Wasp CLI has released this feature, it is not yet documented in the official docs or referenced issues. Please check the Wasp CLI deployment docs and the relevant GitHub issue for updates. If you want to automate the manual steps, you can use the provided shell script in the docs for client deployment (see deploy_client.sh). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Kynetix, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Kynetix
KynetixOP2d ago
@kapa.ai The latest Wasp CLI does support easy Railway deployment. I see an OpenSaas Railway template has been setup for that. Does that mean that it only works for apps using this template?
kapa.ai
kapa.ai2d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the available knowledge sources, the Wasp CLI’s automated Railway deployment is listed as “coming soon” and is being tracked in this PR. The documentation does mention an OpenSaaS template and describes how to use it to quickly scaffold a SaaS app with features like Auth, Stripe, and more, but it does not state that Railway deployment is limited only to apps created from this template. Instead, the manual deployment instructions are generic and apply to any Wasp app, regardless of the template used Starter Templates Manual Deployment. There is no explicit information in the knowledge sources that restricts Railway deployment to only OpenSaaS template apps. The OpenSaaS template is provided for convenience, but the deployment process (manual or automated) is intended to work for any Wasp app. If you are using the latest Wasp CLI and see Railway deployment support, it should not be limited to just the OpenSaaS template, but the documentation does not confirm this explicitly. If you encounter issues with other templates, it may be due to features or configuration differences, not a hard restriction. Summary:
The knowledge sources do not state that Railway deployment only works for apps using the OpenSaaS template. The deployment process is described for all Wasp apps, but there is no explicit confirmation about template restrictions for the new CLI feature. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Kynetix, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Filip
Filip2d ago
I see the bot will need some time to learn this Open Saas has not yet included the docs on deploying with Railway, but Wasp has: https://wasp.sh/docs/deployment/deployment-methods/wasp-deploy/railway And since Open Saas is just a Wasp app, it should be straighforward If not - I'm here to help, just reply in the thread 🙂
Kynetix
KynetixOP15h ago
Thanks @sodic I did deploy to Railway a while back, but got some errors I couldn't fix, so I switched to Fly.io. I'll try Railway again and see how it goes.

Did you find this page helpful?