GymApp Railway Deploy
Prepare this repository for Railway, validate the app entrypoints and environment configuration, and debug deployment failures with project-specific assumptions.
Prefer repo changes and verification over generic advice. Use the files already present in this project as the source of truth.
Quick Start
- Read
README.md,railway.toml,Dockerfile,Procfile,requirements.txt,.env.example,app/main.py, andapp/workers/celery_app.py. - Confirm the web service boots the FastAPI app from
app.main:appand listens on Railway'sPORT. - Confirm the health endpoint is
GET /health, not just/. - Check whether migrations, Redis, and Celery require separate Railway services or startup commands.
- After edits, run lightweight verification commands and summarize any remaining Railway-side steps for the user.
Deployment Audit
App Entrypoint
- Confirm
app/main.pyexposesapp = FastAPI(...). - Prefer
railway.tomlas the primary Railway config when it exists. - Ensure the startup command binds to
0.0.0.0and Railway's port, for example:
sh -c "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000}"
- Treat
Procfileas fallback metadata, not the main source of truth, whenrailway.tomlis present.
Runtime Dependencies
- Check
requirements.txtfor the actual runtime stack used by GymApp: FastAPI, Uvicorn, SQLAlchemy, Alembic, Redis, Celery, Pydantic v2, and PostgreSQL driver support. - If a failure points to missing build tooling or native packages, prefer the smallest fix that matches the existing Docker image strategy.
- Do not add dependencies speculatively. Tie each change to an observed import or runtime requirement.
Environment Variables
- Verify the app can resolve database configuration from Railway-provided values or a direct
DATABASE_URL. - Confirm
SECRET_KEYis required for JWT signing and document it if missing from setup instructions. - Confirm Redis and Celery settings map cleanly to
REDIS_URLor the project's equivalent broker variables. - Keep
.env.examplealigned with any newly required settings.
Celery and Background Work
- Check
app/workers/celery_app.pybefore changing worker commands. - If the user asks for full Railway deployment guidance, separate the web service from background workers when Celery is enabled.
- Recommend a dedicated worker service command only when the repository actually uses Celery tasks at runtime.
Verification
Prefer fast, local verification before declaring Railway-ready:
python -m compileall app migrations
docker compose up --build
curl http://localhost:8000/health
If Docker is unavailable or too heavy for the task, use the lightest meaningful check instead and say what was not verified.
Debugging Railway Failures
Build Failures
- Check for missing dependencies, invalid package pins, or Dockerfile copy/install order issues.
- Check whether the image installs from the correct
requirements.txtat the repo root.
Startup Failures
- Check the module path in the start command.
- Check whether the process binds to
PORT. - Check whether migrations run before the app starts and whether that ordering is intentional.
Runtime Failures
- Check missing environment variables first.
- Check database connectivity and URL parsing next.
- Check Redis or Celery broker configuration when worker startup or background jobs fail.
Output
When using this skill:
- Make the smallest repo changes needed to unblock Railway deployment.
- Name the exact files changed and the verification performed.
- Separate confirmed fixes from inferred Railway UI steps.
- If Railway access is unavailable, prepare the repo fully and then list the remaining manual steps clearly.