Multi-service templates

Avatar of Faraz PatankarFaraz Patankar
·

If you’ve been using Railway for a while you’d know that originally, if you had to deploy multiple services, you’d have to create multiple projects. This wasn’t a lot of fun so we set out to fix it. In doing so, we created Metro (our internal codename for a new and improved Railway) where we allow users to deploy as many services within a project as they’d like. All services and databases related to a product can now live under the same Railway project, leading to better organization and project management.

An example multi-service project

An example multi-service project

A very popular platform feature amongst users is the Railway button. It allows users to configure a template where anyone who visits that template can deploy it in one click. The button, like the legacy Railway projects, only supported deploying a single service so with Metro we also extended it to support multiple services, including monorepos.

Last week, we launched multi-service templates and listed below are all the features that came with it!

Create multi-service templates

A example multi-service template

A example multi-service template

You can create a template and add as many services as you’d like. All you need to do is give us a service name and a link to the GitHub URL where the code for the service is located. You can still configure service-level environment variables along with default values and descriptions for each variable.

Specify additional configuration

Additional service configuration

Additional service configuration

Along with the existing feature to configure environment variables for a service, you can now also specify additional configuration for every service. This includes specifying a root directory, a start command, and a healthcheck path.

Whenever another user deploys the template, these settings will be pre-configured for them. This is especially useful for monorepos as the start command and root directory do not need to be manually configured by the user using the template.

Automatic monorepo detection

Automatic monorepo detection

Automatic monorepo detection

Speaking of monorepo support, when deploying multiple services within a single monorepo, you will only have to configure them once. We will also create only one GitHub repo for you and use all the service configurations provided by the creator of the template.

Generate templates from projects

Generate template from project

Generate template from project

You can now generate templates from existing projects at the click of a button. Railway will take the services and plugins from the project along with the environment variable keys and create a template for you. You can then add default values and descriptions to your environment variables and update them as required.

Manage created templates

Template management interface

Template management interface

You can also view the list of templates you’ve created on your templates page. From here, you can view, edit, delete and share your them!

And more?

We’re sure there’s more we can do with templates and that is where you come in. Send your feature suggestions our way and we’ll try to get to them as soon as possible. The easiest way to reach us is through our Discord community!