Skip to content

Latest commit

 

History

History
143 lines (99 loc) · 3.74 KB

File metadata and controls

143 lines (99 loc) · 3.74 KB

Deploying VoiceNotes to Railway

Follow these steps once — after that your app runs 24/7 at a public URL with zero local setup needed.


What you need


Step 1 — Organise your project folder

Your folder must look exactly like this before you start:

voicenotes/
├── app.py
├── requirements.txt
├── Dockerfile
├── railway.toml
├── .gitignore
└── templates/
    ├── index.html
    ├── reader.html
    └── editor.html

Copy the four new files (Dockerfile, railway.toml, requirements.txt, .gitignore) into your voicenotes/ folder alongside app.py.


Step 2 — Push to GitHub

Open a terminal in your voicenotes/ folder and run:

git init
git add .
git commit -m "initial commit"

Then go to https://github.com/new and create a new repository called voicenotes. Leave it empty (no README). Copy the commands GitHub shows you under "push an existing repository" — they look like:

git remote add origin https://github.com/YOUR_USERNAME/voicenotes.git
git branch -M main
git push -u origin main

Step 3 — Create a Railway project

  1. Go to https://railway.app and log in
  2. Click "New Project"
  3. Choose "Deploy from GitHub repo"
  4. Authorise Railway to access your GitHub if asked
  5. Select your voicenotes repository
  6. Railway detects the Dockerfile automatically — click "Deploy"

That's it. Railway builds the Docker image (takes 3–5 minutes the first time because it installs LibreOffice).


Step 4 — Get your public URL

  1. Once the build is green, click on your service in Railway
  2. Go to Settings → Networking → Generate Domain
  3. Railway gives you a URL like voicenotes-production.up.railway.app

Open it in any browser — your app is live.


Step 5 — Keep it always on (optional)

Railway's free tier gives you 500 hours/month — enough for ~16h/day. If you want it always on:

  • Go to your project → Settings → Sleeping
  • Set "Never sleep" (uses ~720h/month — requires a $5 credit top-up, but Railway often gives free credits on signup)

Alternatively just leave it on the default — it stays up as long as you use it and sleeps when idle. Wake time is under 10 seconds.


Updating your app later

Whenever you change any file locally:

git add .
git commit -m "describe what you changed"
git push

Railway automatically detects the push and redeploys. Zero downtime.


Important notes

Storage: Railway's free tier has no persistent disk. This means:

  • Audio files you generate (TTS) are stored in memory for the session only
  • If the app restarts, the Library tab will be empty
  • Downloaded files are saved to your computer permanently

To get persistent storage (keep the Library across restarts):

  • Go to Railway → your project → "Add Plugin" → "Volume"
  • Mount it at /app/output — costs ~$0.25/GB/month

LibreOffice cold start: The first docx/pdf conversion after a fresh deploy takes ~5 seconds while LibreOffice initialises. Subsequent ones are fast.


Troubleshooting

Build fails with "no space left" → LibreOffice is large (~500MB). Railway free tier has 1GB build cache. Go to Settings → clear build cache → redeploy.

App crashes on start → Click "View Logs" in Railway. The most common cause is a missing environment variable or a Python import error.

Docx renders as text instead of images → LibreOffice is still initialising. Wait 10 seconds and try again.

"Application failed to respond" → The app is waking from sleep. Refresh after 10–15 seconds.