diff --git a/README.md b/README.md index ce52b32..a6ab751 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,36 @@ poetry run black . # fix formatting GitHub Actions runs tests and Black checks on push/PRs. Coverage is optionally uploaded to Codecov. +## Deployment + +The React frontend is hosted on Vercel and the FastAPI backend on Fly.io. + +### Frontend (Vercel) + +Vercel deploys automatically on push to `main` via GitHub integration. + +1. Install the Vercel CLI: `npm install -g vercel` +2. Link the project: `cd frontend && vercel link` +3. Set the Mapbox token as an environment variable in the Vercel dashboard: + - Key: `VITE_MAPBOX_TOKEN` + - Value: your Mapbox token + - Environment: Production (and Preview if desired) +4. Deploy manually if needed: `vercel --prod` + +### Backend (Fly.io) + +1. Install the Fly CLI: `brew install flyctl` +2. Authenticate: `flyctl auth login` +3. Create the app (first time only): `cd backend && flyctl launch --no-deploy` +4. Set secrets: + ```sh + flyctl secrets set GOOGLE_MAPS_API_KEY=your_key_here + ``` +5. Deploy: `flyctl deploy` +6. Check health: `curl https://indy-explorer-backend.fly.dev/health` + +Subsequent deploys run automatically on push to `main` via the CI/CD pipeline (to be configured in a later issue). + ## Contributing 1. Fork the repository. diff --git a/backend/.env.example b/backend/.env.example new file mode 100644 index 0000000..8f2aa24 --- /dev/null +++ b/backend/.env.example @@ -0,0 +1,5 @@ +# Backend environment variables +# Copy to .env and fill in values (never commit .env) + +# Required for geocoding (only needed when regenerating data/resort_locations.csv) +GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here diff --git a/backend/fly.toml b/backend/fly.toml new file mode 100644 index 0000000..59ac31e --- /dev/null +++ b/backend/fly.toml @@ -0,0 +1,23 @@ +app = "indy-explorer-backend" +primary_region = "iad" + +[build] + +[http_service] + internal_port = 8000 + force_https = true + auto_stop_machines = "stop" + auto_start_machines = true + min_machines_running = 0 + +[[http_service.checks]] + grace_period = "10s" + interval = "30s" + method = "GET" + path = "/health" + timeout = "5s" + +[[vm]] + memory = "256mb" + cpu_kind = "shared" + cpus = 1 diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..bc6b91e --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,6 @@ +# Frontend environment variables +# Copy to .env.local and fill in values (never commit .env.local) +# In Vercel, set these in the dashboard under Project Settings > Environment Variables + +# Required for map rendering +VITE_MAPBOX_TOKEN=your_mapbox_token_here diff --git a/frontend/vercel.json b/frontend/vercel.json new file mode 100644 index 0000000..ed4d6a6 --- /dev/null +++ b/frontend/vercel.json @@ -0,0 +1,7 @@ +{ + "buildCommand": "npm run build", + "outputDirectory": "dist", + "rewrites": [ + { "source": "/(.*)", "destination": "/index.html" } + ] +}