sojorn/sojorn_docs/MIGRATION_STEP_BY_STEP.txt

96 lines
3.5 KiB
Plaintext

MIGRATION COMMANDS CHEAT SHEET
============================
STEP 0: EDIT LOCAL SYNC GLOBALLY
The first directive to to edit locally here, keep git updated fequently, then
grab the updates files to our VPS server and then built and restart.
------------
STEP 1: FLUTTER WEB DEPLOY (If applicable)
------------------------------------------
Ensure your flutter web build is updated and copied to /var/www/sojorn
flutter build web --release
scp -r build/web/* user@server:/var/www/sojorn/
STEP 2: NGINX CONFIGURATION
---------------------------
# 1. SSH into your VPS
ssh ...
# 2. Copy the new configs (upload them first or copy-paste)
# Assuming you uploaded sojorn_net.conf and legacy_redirect.conf to /tmp/
sudo cp /tmp/sojorn_net.conf /etc/nginx/sites-available/sojorn_net.conf
sudo cp /tmp/legacy_redirect.conf /etc/nginx/sites-available/legacy_redirect.conf
# 3. Enable new sites
sudo ln -s /etc/nginx/sites-available/sojorn_net.conf /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/legacy_redirect.conf /etc/nginx/sites-enabled/
# 4. Disable old site (to avoid conflicts with the new legacy_redirect which claims the same domains)
# Check existing enabled sites
ls -l /etc/nginx/sites-enabled/
# Remove the old link (e.g., sojorn.conf or default)
sudo rm /etc/nginx/sites-enabled/sojorn.conf
# (Don't delete the actual file in sites-available, just the symlink)
# 5. Test Configuration (This might fail on SSL paths if legacy certs are missing, but they should be there)
sudo nginx -t
# 6. Reload Nginx (Users will briefly see unencrypted or default page for new domain until Certbot runs)
sudo systemctl reload nginx
STEP 3: SSL CERTIFICATES (CERTBOT)
----------------------------------
# Generate fresh certs for the NEW domain.
# --nginx plugin will automatically edit sojorn_net.conf to add SSL lines.
sudo certbot --nginx -d sojorn.net -d www.sojorn.net -d api.sojorn.net
# Follow the prompts. When asked about redirecting HTTP to HTTPS, choose "2: Redirect".
STEP 4: BACKEND & ENV
---------------------
# Update your .env file on the server
nano /opt/sojorn/.env
# CHANGE:
# CORS_ORIGINS=https://sojorn.net,https://api.sojorn.net,https://www.sojorn.net
# R2_PUBLIC_BASE_URL=https://img.sojorn.net
# Restart the backend service
sudo systemctl restart sojorn-api
STEP 5: VERIFICATION
--------------------
1. Visit https://sojorn.net -> Should show app.
2. Visit https://sojorn.net -> Should redirect to https://sojorn.net.
3. Check API: https://api.sojorn.net/api/v1/health (or similar).
STEP 6: EXTERNAL SERVICES CHECKLIST
-----------------------------------
These items fall outside the codebase but are CRITICAL for the migration:
1. CLOUDFLARE R2 (CORS)
- Go to Cloudflare Dashboard > R2 > [Your Bucket] > Settings > CORS Policy.
- Update allowed origins to include:
[ "https://sojorn.net", "https://www.sojorn.net", "http://localhost:*" ]
- If you don't do this, web image uploads will fail.
2. FIREBASE CONSOLE (Auth & Messaging)
- Go to Firebase Console > Authentication > Settings > Authorized Domains.
- ADD: sojorn.net
- ADD: api.sojorn.net
- You can remove gosojorn.com later.
3. GOOGLE CLOUD CONSOLE (If using Google Sign-In)
- APIs & Services > Credentials > OAuth 2.0 Client IDs.
- Add "https://sojorn.net" to Authorized JavaScript origins.
- Add "https://sojorn.net/auth.html" (or callback URI) to Authorized redirect URIs.
4. APPLE DEVELOPER PORTAL (If using Sign in with Apple)
- Certificates, Identifiers & Profiles > Service IDs.
- Update the "Domains and Subdomains" list for your Service ID to include sojorn.net.