Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 2 min read How-to mediumAdept

Cron Jobs with Django and GitHub Actions

Scheduled Django management commands can run against a Railway project by using a GitHub Actions workflow on a cron schedule. The workflow checks out the repo, installs the Railway CLI via npm, and uses `railway run --service` with a project-scoped RAILWAY_TOKEN secret to install requirements and execute `python manage.py my_command` in the service's environment. An August 2023 update notes that Railway now supports cron jobs natively, which may be the better option.

Related posts

  • Cron Jobs on Railway

    Railway mediumAdept

    Before native cron support existed, Railway cron jobs could be run as an ordinary long-lived service that schedules work with a language-level library. The example scaffolds a TypeScript package with DTS, uses node-cron to log a message every minute, points the start script at the built dist output, and deploys with `railway up` without extra configuration. An update notes that Railway now offers native Cron Jobs, which may be the better option.

  • Using Github Actions with Railway

    Railway mediumAdept

    Railway deployments can be driven from GitHub Actions instead of the built-in branch-push trigger by creating a project token, storing it as a repository secret (RAILWAY_TOKEN), and running `railway up --service=<id>` inside the official Railway CLI container. A sample workflow triggers on pushes to main, checks out the code and uploads it to Railway. The token must stay secret, but the service ID can be passed openly. The same token approach also works for tasks like running database migrations before deploy or managing pull requests.

  • Using GitLab CI/CD with Railway

    Railway mediumAdept

    Deploying to Railway from GitLab CI/CD comes down to a project token plus a small job that runs the Railway CLI. Create a project token in the Railway project settings and store it as a secret GitLab CI/CD variable (RAILWAY_TOKEN). A minimal .gitlab-ci.yml then uses the ghcr.io/railwayapp/cli image to run `railway up --service=$SVC_ID` on pushes to the default branch, while Railway's own infrastructure does the build. Teams can instead build artifacts in GitLab CI and deploy them with the CLI. The token must stay secret, but the service ID can be exposed safely.

  • Less Dashboards. More Robots. Railway, for Agents

    Railway easyNovice

    Railway is repositioning its platform around coding agents, bundling the CLI, MCP configuration and agent skills behind a single installer (`install.sh --agents -y`) so harnesses like Claude or Codex can deploy, configure and debug services without the dashboard. The CLI gains `--json` output, non-interactive flags and explicit project/service/environment scoping. A CLI-based MCP and an OAuth Remote MCP replace the deprecated NPM server, and a route-first `use-railway` skill loads only the references a task needs. Safety layers include staged changesets reviewed as diffs, MCP `destructiveHint` flags, 48-hour soft deletes and workspace guardrails such as GitHub org allowlists.

  • Working with NX, Railway and CI/CD

    Railway mediumAdept

    A GitHub Actions workflow can deploy only the NX monorepo apps affected by a push to Railway, replacing Railway's built-in GitHub trigger. The setup sets NIXPACKS_NX_APP_NAME, creates one Railway environment and project token per branch, and stores the tokens as GitHub secrets named RAILWAY_TOKEN__<project>_<environment>. On each push the workflow works out a base commit that survives force pushes, then lints and builds the affected projects. A bash script uses `nx print-affected` to find the affected apps, looks up each app's token from a dumped secrets JSON file, and runs `railway up --detach`. Dumping the secrets to a file is flagged as risky in public repos, and `--detach` keeps long container builds from using up GitHub Actions minutes.

The quest for software engineering knowledge.

Look:
Layout: