- Simplified Dockerfile to serve static files directly (no Next.js build) - Copied redesign files (index.html, style.css, main.js) to out/ - Added brand/favicon assets - Backed up previous Next.js build to out.backup.* - Container rebuilt and verified healthy on port 8080 Co-Authored-By: Paperclip <noreply@paperclip.ing>
4.4 KiB
Hatch Landing Page — Deployment Guide
Overview
The Hatch landing page (hatch.surf) is a Next.js app deployed via Docker on the production server.
Key principle: All changes MUST go through the git repository and automated deployment. Never edit files directly on the server or use /var/www.
Repository
Location: /home/nara/apps/web/
Structure:
/app/page.tsx # Main page component
/app/layout.tsx # Root layout
/app/globals.css # Global styles
/components/ # React components (Hero, Features, Why, CTA, Footer, Header)
/public/ # Static assets
Dockerfile # Docker build configuration
docker-compose.yml # Container orchestration
deploy.sh # Deployment script
Deployment Flow
Automatic (Recommended)
- Push changes to
mainbranch - Gitea webhook triggers
gitea-webhook.py - Script runs
deploy.shautomatically - Docker image rebuilds and container restarts
Manual
cd /home/nara/apps/web
./deploy.sh
What deploy.sh does:
git pull origin main— fetches latest changesdocker build -t hatch-web:latest .— rebuilds image- Stops and removes old container
docker compose up -d— starts new container- Verifies deployment with health check
Docker Setup
Container: hatch-web
Port: 8080 (mapped to host)
Internal: nginx serving static Next.js export on port 80
Network: hatch-network
Check status:
docker ps | grep hatch-web
docker logs hatch-web
Restart without rebuild:
docker compose -f /home/nara/apps/web/docker-compose.yml restart
Making Changes
1. Edit the source code
cd /home/nara/apps/web
# Edit components
vim components/Hero.tsx
vim components/Features.tsx
# etc.
# Edit styles
vim app/globals.css
2. Test locally (optional)
npm run dev
# Visit http://localhost:3000
3. Commit and push
git add .
git commit -m "Description of changes"
git push origin main
4. Deploy
Either wait for webhook or run manually:
./deploy.sh
5. Verify
curl -s http://localhost:8080 | head -20
# Or visit https://hatch.surf
Common Mistakes to Avoid
❌ DON'T: Edit files in /var/www/html/
❌ DON'T: Edit files directly inside the Docker container
❌ DON'T: Work on static HTML/CSS files in a workspace
❌ DON'T: Copy files to the server without using git
✅ DO: Edit files in /home/nara/apps/web/
✅ DO: Commit changes to git
✅ DO: Use deploy.sh for deployment
✅ DO: Work on the Next.js components (app/, components/)
Rollback
If a deployment causes issues:
cd /home/nara/apps/web
# View recent commits
git log --oneline -10
# Revert to previous version
git revert HEAD
git push origin main
# Or reset to specific commit
git reset --hard <commit-hash>
git push origin main --force
# Redeploy
./deploy.sh
Cache Headers
HTML pages: no-cache, must-revalidate — browsers always revalidate, ensuring fresh content after deploys.
Static assets (CSS/JS/images): public, immutable with 30-day expiry. Safe because Next.js uses content hashes in filenames (e.g., 2oioldxlp5hov.css), so new deployments get new URLs.
Nginx config: /etc/nginx/sites-available/hatch.surf.conf
If users report seeing old content after deployment:
- Verify the container is running:
docker ps | grep hatch-web - Check the HTML has new classes:
curl -s http://localhost:8080 | grep bg-gradient-to-r - Ask user to hard refresh: Ctrl+Shift+R (Chrome/Firefox) or Cmd+Shift+R (Mac)
- If still cached, check nginx config has
Cache-Control: no-cache, must-revalidate
Troubleshooting
Container not starting:
docker logs hatch-web
docker compose -f /home/nara/apps/web/docker-compose.yml up -d
Changes not showing:
- Verify commit pushed:
git log --oneline -1 - Check container was rebuilt:
docker images | grep hatch-web - Force rebuild:
cd /home/nara/apps/web && docker build -t hatch-web:latest . && docker compose up -d
Port conflict:
lsof -i :8080
# Kill conflicting process or change port in docker-compose.yml
Contact
- DevOps: Jing Yang (Sam Lee)
- CTO: Jordan Patel
- Repository:
/home/nara/apps/web/ - Live site: https://hatch.surf