Rock-Spotter

πŸš€ Deployment Files Overview

This directory contains all the configuration files needed to deploy Rock Spotter to various platforms.

πŸ“ File Structure

Rock-Spotter/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ Dockerfile                   # Docker image configuration
β”‚   β”œβ”€β”€ .dockerignore               # Files to exclude from Docker build
β”‚   β”œβ”€β”€ .env.example                # Development environment template
β”‚   └── .env.production.example     # Production environment template
β”œβ”€β”€ docker-compose.yml              # Full stack Docker setup (API + MongoDB)
β”œβ”€β”€ render.yaml                     # Render platform configuration
β”œβ”€β”€ railway.json                    # Railway platform configuration
β”œβ”€β”€ Procfile                        # Heroku/similar platforms configuration
β”œβ”€β”€ deploy-setup.sh                 # Interactive deployment setup script
β”œβ”€β”€ verify-deployment.sh            # Deployment verification script
β”œβ”€β”€ DEPLOYMENT.md                   # Complete deployment guide
└── .github/
    └── workflows/
        └── ci.yml                  # GitHub Actions CI/CD pipeline

πŸ“„ File Descriptions

Docker Files

backend/Dockerfile

When to use:

backend/.dockerignore

Why it’s important: Keeps Docker images small and fast to build

docker-compose.yml

When to use:

Quick start:

docker-compose up -d

Platform Configuration Files

render.yaml

Deployment:

  1. Push code to GitHub
  2. Connect repository to Render
  3. Render auto-detects render.yaml
  4. Add MongoDB connection string
  5. Deploy!

railway.json

Deployment:

railway login
railway init
railway up

Procfile

Platforms that use Procfile:

Deployment (Heroku):

heroku create rock-spotter-api
git push heroku main

Environment Configuration

backend/.env.example

Usage:

cd backend
cp .env.example .env
# Edit .env with your settings

backend/.env.production.example

Usage: Reference this when setting environment variables in your deployment platform

Helper Scripts

deploy-setup.sh

Usage:

chmod +x deploy-setup.sh
./deploy-setup.sh

Options:

  1. Local Development (local MongoDB)
  2. Local Development (Docker)
  3. Deploy to Render
  4. Deploy to Railway
  5. Deploy to Heroku

verify-deployment.sh

Usage:

chmod +x verify-deployment.sh
./verify-deployment.sh https://your-api-url.com

Example:

./verify-deployment.sh https://rock-spotter-api.onrender.com

CI/CD

.github/workflows/ci.yml

What it does:

🎯 Quick Start Guides

Deploy with Docker (Easiest)

# Clone repository
git clone https://github.com/jmenichole/Rock-Spotter.git
cd Rock-Spotter

# Start with Docker Compose
docker-compose up -d

# Verify
curl http://localhost:3000/api/health

Deploy to Render (Free)

  1. Create MongoDB Atlas database (free tier)
  2. Fork repository to your GitHub
  3. Go to Render Dashboard
  4. New β†’ Blueprint
  5. Connect repository (auto-detects render.yaml)
  6. Add environment variables:
    • MONGODB_URI: Your MongoDB Atlas URI
    • JWT_SECRET: Auto-generated or set manually
  7. Deploy!

Deploy to Railway (Fast)

# Install CLI
npm install -g railway

# Login and init
railway login
railway init

# Add MongoDB
railway add

# Set secret
railway variables set JWT_SECRET=$(openssl rand -hex 32)

# Deploy
railway up

Deploy to Heroku (Classic)

# Install CLI
npm install -g heroku

# Login and create app
heroku login
heroku create rock-spotter-api

# Add MongoDB
heroku addons:create mongolab:sandbox

# Set environment
heroku config:set JWT_SECRET=$(openssl rand -hex 32)

# Deploy
git push heroku main

πŸ” Security Checklist

Before deploying to production:

πŸ“Š Platform Comparison

Platform Free Tier Setup Time Auto-Deploy MongoDB Best For
Render 750 hrs/mo 5 min βœ… Need Atlas Beginners
Railway $5 credit 2 min βœ… βœ… Included Speed
Heroku 1000 hrs/mo 5 min βœ… Add-on Classic
Docker N/A 1 min ❌ βœ… Included Full control
DigitalOcean $200/60d 10 min βœ… Separate Production

πŸ†˜ Troubleshooting

β€œCannot connect to MongoDB”

Solution:

β€œPort already in use”

Solution:

β€œBuild failed”

Solution:

β€œAPI returns 502/503”

Solution:

πŸ“š Additional Resources

🀝 Contributing

Found an issue with deployment? Please:

  1. Check existing issues
  2. Create a new issue with:
    • Platform name
    • Error messages
    • Steps to reproduce
    • Your environment details

πŸ“ž Support

Need help deploying?


Happy Deploying! πŸš€πŸͺ¨

Choose your platform, follow the guide, and get your Rock Spotter API live in minutes!