A railway service is a deployment target for your application. There are two types of services:
- Persistent database services
- Ephemeral deployment services
Deployment services can be connected to a GitHub repo and automatically deployed on each commit. A template is a pre-configured group of services. A template can be used to start a project or to expand an existing project.
Each service keeps a log of deployment attempts, variables, and metrics. Source references, such as a GitHub repository URI, and relevant start commands are also saved. Clicking a service from the project canvas reveals the service view.
Create a service by clicking the
New button or opening the command palette and typing
New Service. Pick a service to deploy. You can deploy a GitHub repo, provision a database, deploy a template, or create an empty service.
Anytime within a project, a new service can be created with the command palette.
Service names have a max length of 32 characters.
Services on Railway can be deployed from a GitHub repository, a local directory, or a Docker image.
Services can be linked to a GitHub repository and branch. When a new commit is pushed to the linked branch, Railway will automatically build and deploy the new code.
You can deploy to a service with the
railway up command
CLI command. This command will push your code to Railway which will then be
built and deployed.
To deploy a monorepo on Railway, just create an empty service for each service or app in the monorepo, set the appropriate root directory for each service, and then connect your repository to all the created services.
By default Railway will scale your service up to the the specified vCPU and Memory limits of your plan. You can scale horizontally by manually increasing the number of replicas for a service.
To change the number of replicas per deploy within your service, go to the service settings view and look for the "Replicas" field in the "Deploy" section. This will create multiple instances of your service and distribute traffic between them.
At the moment, Railway will round-robin requests to the replicas of your service. We plan to add more advanced load balancing strategies in the future. If you need more advanced load balancing, you can use an external load balancer such as Cloudflare to distribute traffic between your services.
Note: For now Railway does not support sticky sessions nor report the usage of the replicas within the metrics view.
You might need to configure the Railway app on your connected GitHub account. Please make sure that you have the requisite permissions for Railway's GitHub app. You can configure the app by clicking this link.
Railway projects allow you to provision additional infrastructure on top of your existing services in the form of database services.
Railway currently offers the following database services:
You can add a database service via the Command + K menu or by clicking the New Service button on the Project Canvas.
Connecting to Your Database
Railway provides connection strings and project variables that let your application connect to the database service.
You can access your database connection strings under the Connect tab in the service view.
If you run
railway run locally, Railway will use your database variables to facilitate local development.
Managing Database Data
Railway has a user interface for managing your database service's data. You can introspect the tables and the data of your chosen database service.
Railway offers 200+ community-maintained templates. A template with a Github repo will clone the repo to your account, and deploy the service(s) to a project. A template with Docker images will deploy the images directly. You can deploy a template from the Project Canvas unless there are variables to configure. To configure environment variables, you'll need to use the New Project button. Templates are useful for deploying common pieces of infrastructure — like a DataDog Agent.
Empty application services don't reference a repo. They are useful for CLI deploys, running ad-hoc processes, or storing environment variables for local development. Use the service's settings page to connect a repo at any time.
You can see services metrics under the Metrics tab when the service view is made visible.
From within the project canvas, click the
+ New button located at the top right of the project canvas. You may need to close any services or plugins open in the canvas to see the button.
Delete a service by opening the project's settings and navigating to the danger page.
Within the Command Palette, you can change the default service icon to something else. The list of available icons is pulled from our devicons service.
Edit this file on GitHub