safetyMaster / RAILWAY_CLI_DEPLOY.md
mrvero's picture
Upload folder using huggingface_hub
0469d65 verified

A newer version of the Gradio SDK is available: 5.44.0

Upgrade

πŸš€ Deploy SafetyMaster Pro via Railway CLI

Quick Terminal Deployment (2 Minutes)

Step 1: Install Railway CLI

# macOS (using Homebrew)
brew install railway

# Or using npm (cross-platform)
npm install -g @railway/cli

# Or using curl (Linux/macOS)
curl -fsSL https://railway.app/install.sh | sh

Step 2: Login to Railway

railway login

This opens your browser to authenticate with GitHub.

Step 3: Deploy Your App

# Navigate to your project directory
cd /Users/whitmanwendelken/Reza/safetyMaster

# Initialize Railway project
railway init

# Deploy immediately
railway up

That's it! πŸŽ‰ Your app will be live in ~2 minutes.

πŸ“‹ Complete Terminal Workflow

Initial Setup

# 1. Install Railway CLI
brew install railway

# 2. Login
railway login

# 3. Navigate to project
cd /Users/whitmanwendelken/Reza/safetyMaster

# 4. Initialize Railway project
railway init
# Choose: "Empty Project" β†’ Enter project name: "safetymaster-pro"

# 5. Deploy
railway up

Environment Variables (Optional)

# Set production environment variables
railway variables set FLASK_ENV=production
railway variables set SECRET_KEY=your-super-secret-key-here

# View all variables
railway variables

Useful Commands

# Check deployment status
railway status

# View logs
railway logs

# Open app in browser
railway open

# Get app URL
railway domain

# Redeploy after changes
git add .
git commit -m "Update app"
railway up

# Connect to database (if needed later)
railway add postgresql

πŸ”§ Advanced CLI Features

Custom Domain

# Add custom domain
railway domain add yourdomain.com

# List domains
railway domain list

Environment Management

# Create staging environment
railway environment create staging

# Switch environments
railway environment use staging
railway environment use production

# Deploy to specific environment
railway up --environment production

Database Integration

# Add PostgreSQL database
railway add postgresql

# Add Redis cache
railway add redis

# View database connection info
railway variables

πŸ“Š Monitoring & Management

Real-time Logs

# Follow logs in real-time
railway logs --follow

# Filter logs by service
railway logs --service web

# View last 100 lines
railway logs --tail 100

Project Management

# List all projects
railway list

# Switch projects
railway use project-name

# Delete project (careful!)
railway delete

πŸš€ One-Command Deploy Script

Create a deployment script for easy updates:

# Create deploy.sh
cat > deploy.sh << 'EOF'
#!/bin/bash
echo "πŸš€ Deploying SafetyMaster Pro to Railway..."

# Commit changes
git add .
git commit -m "Deploy: $(date)"

# Deploy to Railway
railway up

# Open app
echo "βœ… Deployment complete!"
railway open
EOF

# Make executable
chmod +x deploy.sh

# Use it
./deploy.sh

🎯 Expected Output

When you run railway up, you'll see:

πŸš€ Building...
πŸ“¦ Packaging...
πŸ”„ Deploying...
βœ… Deployment successful!

🌐 Your app is live at: https://safetymaster-pro-production.railway.app

πŸ” Troubleshooting

CLI Installation Issues

# Check if Railway CLI is installed
railway --version

# Update CLI
brew upgrade railway  # macOS
npm update -g @railway/cli  # npm

Authentication Issues

# Re-login if needed
railway logout
railway login

Deployment Issues

# Check project status
railway status

# View detailed logs
railway logs --follow

# Restart deployment
railway up --force

πŸ’‘ Pro Tips

  1. Use railway logs --follow during deployment to see real-time progress
  2. Set up environment variables before first deployment
  3. Use railway open to quickly access your deployed app
  4. Create aliases for common commands:
    alias rdeploy="railway up"
    alias rlogs="railway logs --follow"
    alias ropen="railway open"
    

πŸŽ‰ Ready to Deploy?

Run these commands now:

# Install CLI
brew install railway

# Login
railway login

# Deploy
cd /Users/whitmanwendelken/Reza/safetyMaster
railway init
railway up

Your SafetyMaster Pro will be live in 2 minutes! πŸ›‘οΈβœ¨