---
title: "Deploy Mage AI | (Just Updated) Data Pipeline Tool, Generated Owner Login, Postgres Backed"
description: "Mage AI data pipeline tool with Postgres metadata, generated owner login"
category: "Other"
url: https://railway.com/deploy/mage-ai-or-just-updated-data-pipeline-to
---

# Deploy Mage AI | (Just Updated) Data Pipeline Tool, Generated Owner Login, Postgres Backed

Mage AI data pipeline tool with Postgres metadata, generated owner login

**[Deploy Mage AI | (Just Updated) Data Pipeline Tool, Generated Owner Login, Postgres Backed on Railway](https://railway.com/template/mage-ai-or-just-updated-data-pipeline-to)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/mage-ai-or-just-updated-data-pipeline-to/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Other

## Template content

### postgres

- **Image:** postgres:17.10-trixie

### mage

- **Image:** mageai/mageai:0.9.80@sha256:73c8e808070ef55ffe263544809197820f38ca621349b5a8ed7d6366cb861cc8
- **Start command:** `/bin/sh -c 'S=/usr/local/lib/python3.10/site-packages; rm -rf $S/numpy/_core $S/numpy-2.2.6.dist-info; export ENV=production USER_CODE_PATH=/home/src/default_repo DEFAULT_OWNER_USERNAME=admin OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 MKL_NUM_THREADS=4; exec /app/run_app.sh mage start default_repo --port "$PORT"'`
- **Health check:** /api/status
- **Public domain:** Yes

## Documentation

# Deploy and Host Mage AI on Railway

**Built for an LLM agent to deploy and use.** There is no manual deploy step and nothing to fill in: the owner password and the database password are generated at deploy time, the owner account is created from variables at first boot, the contract below lists every URL and variable name, and one working script logs in over the API and lists pipelines. No `admin@admin.com` / `admin` login exists on this deploy.

Mage AI is an open-source data pipeline tool: build, schedule and monitor ETL, streaming and dbt pipelines from a notebook-style editor in Python, SQL and R. This template runs the official `mageai/mageai` image pinned by digest, with Postgres holding Mage's metadata so schedules and run history survive redeploys.

## About Hosting Mage AI

This template runs two services: the official **mageai/mageai** image (pinned by digest, project in `/home/src/default_repo`, volume at `/home/src`, binds Railway's `$PORT`) and **Postgres** (private, password protected, volume at `/var/lib/postgresql`) as the metadata database. Authentication is on: the first owner is created from `DEFAULT_OWNER_EMAIL` and `DEFAULT_OWNER_PASSWORD`, and every API call without a valid token is refused. The start command also removes stale numpy 2.x files that the upstream image ships next to numpy 1.26 (they break `import scipy.special` on Railway hosts, so the stock image crash-loops there).

### Agent contract

- Public URL: `https://`, on the `mage` service (set `MAGE_URL` to it)
- Private URL: `http://mage.railway.internal:8080`
- Credentials: `DEFAULT_OWNER_EMAIL` and `DEFAULT_OWNER_PASSWORD` on the `mage` service. The metadata database password is `POSTGRES_PASSWORD` on the `postgres` service.
- Auth: `POST /api/sessions` with header `X-API-KEY` (Mage's built-in API key, in the script) and the owner email and password returns a JWT. The JWT payload carries the real token in its `token` field; send that as `Authorization: Bearer ` with the same `X-API-KEY` on every call.
- Health: `GET /api/status` returns 200 with no credentials

```bash
# run with MAGE_URL, DEFAULT_OWNER_EMAIL and DEFAULT_OWNER_PASSWORD (mage service); needs curl and jq
API_KEY=zkWlN0PkIKSN0C11CfUHUj84OT5XOJ6tDZ6bDRO2
curl -s -o /dev/null -w 'health %{http_code}\n' "$MAGE_URL/api/status"
JWT=$(curl -fsS -X POST "$MAGE_URL/api/sessions" -H "X-API-KEY: $API_KEY" -H 'Content-Type: application/json' \
  -d "{\"session\":{\"email\":\"$DEFAULT_OWNER_EMAIL\",\"password\":\"$DEFAULT_OWNER_PASSWORD\"}}" | jq -r .session.token)
TOKEN=$(echo "$JWT" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2&gt;/dev/null | jq -r .token)
curl -fsS "$MAGE_URL/api/pipelines" -H "X-API-KEY: $API_KEY" -H "Authorization: Bearer $TOKEN" | jq -c '.pipelines[].uuid'
```

A fresh deploy prints `health 200` and `"example_pipeline"`. Mage answers HTTP 200 even for errors, so judge a call by its JSON body. Pipelines, blocks and triggers are managed through the same API (`/api/pipelines`, `/api/pipeline_schedules`) or the web editor at the public URL.

## Why Deploy Mage AI on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Mage AI on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

- **Agent-ready** - generated owner login, a contract block and one working script; no browser step.
- **No default login** - the owner account is built from generated variables, not `admin@admin.com`.
- **Runs on Railway hosts** - the numpy leftovers in the upstream image are removed at boot, so the app starts instead of crash-looping.
- **State survives redeploys** - Postgres holds metadata, and volumes hold the project code and the database.

## Common Use Cases

- **ETL and ELT pipelines** - load data from APIs and databases into a warehouse on a schedule.
- **Agent-run data jobs** - let an AI agent create, trigger and monitor pipelines through the API.
- **dbt and streaming** - orchestrate dbt models and Kafka-style streaming ingestion next to your app.

## Dependencies for Mage AI Hosting

- Postgres with a volume at `/var/lib/postgresql` (included in this template).

### Deployment Dependencies

- [mage-ai/mage-ai](https://github.com/mage-ai/mage-ai) - upstream project
- [mageai/mageai on Docker Hub](https://hub.docker.com/r/mageai/mageai) - the image this template deploys, tag 0.9.80


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/mage-ai-or-just-updated-data-pipeline-to
