Independent Staging/Production Deploys
Problem
Previously both staging (/opt/ricoya) and production (/opt/ricoya-live) were deployed simultaneously via two rsync commands. No way to test on staging before pushing to production.
Solution
Two shell scripts in the SeawichesApp root:
deploy-staging.sh
- Rsyncs to
/opt/ricoyaonly - Runs
npm install --legacy-peer-deps && npm run build && pm2 restart ricoya - Accessible via
staging.ricoya.net
deploy-prod.sh
- Rsyncs to
/opt/ricoya-liveonly - Runs
npm install --legacy-peer-deps && npm run build && pm2 restart ricoya-live - Accessible via
ricoya.net
Both scripts exclude node_modules, .next, .git, .env.local.
Workflow
- Make changes locally
- Run
./deploy-staging.sh→ test onstaging.ricoya.net - When satisfied, run
./deploy-prod.sh→ goes live onricoya.net
Important Notes
.env.localis never synced — each server copy has its own environment config- The
APNS_KEY_P8in.env.localmust not be edited withsed— multi-line P8 content gets corrupted. Useecho >>append instead. - Cloudflare proxy must stay ON — SSL uses Origin cert which only works behind the Cloudflare proxy