7 months ago
Hello Railway crew & passengers,
Are Railway customers passengers or part of the train crew? In any case... :-)
I have a project with 11 services, a database, and a few volumes. It contains a web app, some backend services, a full set of OpenTelemetry observability services, and runtime services to host and handle wasmCloud operations.
Today, it occurred to me that instead of building multi-tenancy into the app itself, what if I delegated that to Railway? Hear me out please :-).
Here's what I have in mind:
I package up my entire project as a template
Customer opens https://my-app.com
Customer sees a "Deploy on Railway" button with instructions on how to add a custom domain etc
Customer clicks "Deploy on Railway"
Customer accesses the app on their own domain
When I ship updates, I ship them to the template repository. Then, Railway notifies each customer about the update and they can preview in a PR environment and merge when satisfied, as per https://docs.railway.com/guides/deploy#updatable-templates.
For people who don't want to self-host the app, I automate the above process (I have yet to study the Railway API to see if it's possible) and create a project per customer and charge them whatever Railway charges me + a convenience fee.
A worry I have is for self-hosting customers to eject from the template and get all source code. I'd need a way to either prevent that or decide to open source my entire app.
For self-hosting customers, I would get paid through the Kickback program since they would use my template. The money I receive supports the project and ensures my happiness and continued support for the project.
This is all still fairly unbaked, but I'd love to hear how other people feel about that? Has anyone taken such an approach? Please let me know.
4 Replies
7 months ago
Hello MIke,
For your scenario #1, any services contained within the template that deploy repos or images would need to be public; otherwise, that would work perfectly.
For scenario #2, it is very much possible; a good rule of thumb is that if you can manually do it via the dashboard, you can automate it with the API. In fact, many people do this, so much so that I wrote example code to do exactly that -
https://github.com/brody192/railway_project_create
It creates a project based on a template.
For this scenario, you would not have to have any of the repos public since the templates would get deployed under your account.
But if you'd like to know how I feel about this? I personally do not see single tenant architected apps as scalable beyond a few users, even if we do make it easy to deploy, so I would urge you to build multi-tenancy in a single application.
Please let me know if you have any more questions!
Best,
Brody
Status changed to Awaiting User Response Railway • 7 months ago
7 months ago
Thanks Brody, I'll make a public wasmCloud repo and a Railway template since it's something others can benefit from. For my app specifically, I've since added multi-tenancy support. I also had a chance to check the API docs and love how comprehensive it is!
Status changed to Awaiting Railway Response Railway • 7 months ago
Status changed to Solved mikenikles • 7 months ago
7 months ago
I have a clarification question. https://docs.railway.com/guides/deploy#updatable-templates mentions the following:
If it has received an upstream update, we will create a branch on the GitHub repo that was created when deploying the template, allowing for you to test it out within a PR deploy.
However, further up on the page:
As of March 2024, the default behavior for deploying templates, is to attach to and deploy directly from the template repository. Therefore, you will not automatically get a copy of the repository on deploy.
How do updatable templates work with that new default behaviour?
Status changed to Awaiting Railway Response Railway • 7 months ago
7 months ago
A new Railway environment is created with services that deploy the latest code from the upstream repo.
Status changed to Awaiting User Response Railway • 7 months ago
Status changed to Solved mikenikles • 7 months ago
