64 stable releases

new 3.19.1 Nov 28, 2024
3.17.10 Oct 23, 2024
3.11.2 Jul 30, 2024
3.5.2 Nov 14, 2023
0.0.16 Mar 3, 2023

#20 in Configuration

Download history 260/week @ 2024-08-05 373/week @ 2024-08-12 211/week @ 2024-08-26 137/week @ 2024-09-09 237/week @ 2024-09-16 325/week @ 2024-09-23 372/week @ 2024-09-30 28/week @ 2024-10-07 7/week @ 2024-10-14 1444/week @ 2024-10-21 8/week @ 2024-10-28 124/week @ 2024-11-04 2/week @ 2024-11-11 143/week @ 2024-11-18

323 downloads per month

MIT license

215KB
5.5K SLoC

Railway CLI

Crates.io CI cargo audit

This is the command line interface for Railway. Use it to connect your code to Railway's infrastructure without needing to worry about environment variables or configuration.

View the docs

The Railway command line interface (CLI) connects your code to your Railway project from the command line.

The Railway CLI allows you to

  • Create new Railway projects from the terminal
  • Link to an existing Railway project
  • Pull down environment variables for your project locally to run
  • Create services and databases right from the comfort of your fingertips

Status

Currently pre-release. We are looking for feedback and suggestions. Please join our Discord to provide feedback.

Installation

Cargo

cargo install railwayapp --locked

Homebrew

brew install railway

NPM

npm install -g @railway/cli

Bash

# Install 
bash <(curl -fsSL cli.new)

# Uninstall
bash <(curl -fsSL cli.new) -r

Scoop

scoop install railway

Arch Linux AUR

Install using Paru

paru -S railwayapp-cli

Install using Yay

yay -S railwayapp-cli

Docker

Before using the CLI in a non-interactive environment, ensure you have created an access token (only project-tokens are supported as of now) and set it as the RAILWAY_TOKEN environment variable. CI environments are automatically detected by the presence of CI=true variable. In these environments, only build logs will be streamed, and the CLI will exit with an appropriate code indicating success or failure.

Install from the command line

docker pull ghcr.io/railwayapp/cli:latest

Use in GitHub Actions

deploy-job:
  runs-on: ubuntu-latest
  container: ghcr.io/railwayapp/cli:latest
  env:
    SVC_ID: my-service
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
  steps:
    - uses: actions/checkout@v3
    - run: railway up --service=${{ env.SVC_ID }}

Use in GitLab CICD

deploy-job:
  image: ghcr.io/railwayapp/cli:latest
  variables:
    SVC_ID: my-service
  script:
    - railway up --service=$SVC_ID

[!TIP] GitLab can access a protected (secret) variable directly, all you need to do is to add it in CI/CD settings.

From source

See CONTRIBUTING.md for information on setting up this repo locally.

Documentation

View the full documentation

Feedback

We would love to hear your feedback or suggestions. The best way to reach us is on Discord.

We also welcome pull requests into this repo. See CONTRIBUTING.md for information on setting up this repo locally.

Dependencies

~28–62MB
~1M SLoC