🚀 Deployment Guide¶
Complete guide to deploying Chekameh to production environments.
📋 Pre-Deployment Checklist¶
Code Quality¶
- All code tested locally
- No console errors in DevTools
- All features working as expected
- Performance optimized
- Images compressed
- CSS/JS minified (optional)
Security¶
- Dependencies updated (
npm audit fix) - No hardcoded secrets or API keys
- HTTPS enabled on domain
- Security headers configured
- Dependencies scanned for vulnerabilities
Content¶
- All poets/cities data verified
- Links are working
- Documentation updated
- Changelog created
- Version bumped in package.json
🌐 Deployment Options¶
Option 1: Netlify (Recommended)¶
Easiest option for static sites
Step 1: Prepare Repository¶
# Make sure everything is committed
git add .
git commit -m "Prepare for production deployment"
git push origin main
Step 2: Connect to Netlify¶
- Go to netlify.com
- Click "Add new site" → "Import an existing project"
- Select GitHub and choose your repository
- Configure build settings:
- Build command:
npm run build(or leave empty for static) - Publish directory:
.(root) ormd_site(for docs)
Step 3: Configure Domain¶
Step 4: Enable HTTPS¶
Step 5: Deploy¶
Option 2: Vercel¶
Alternative static hosting
Step 1: Install Vercel CLI¶
Step 2: Deploy¶
Step 3: Configure Domain¶
Option 3: GitHub Pages¶
Free hosting directly from GitHub
Step 1: Enable GitHub Pages¶
- Go to repository Settings
- Scroll to "GitHub Pages" section
- Select source:
mainbranch,/rootor/docsfolder
Step 2: Configure Domain¶
- Add custom domain in Settings
- Create CNAME file in root:
Step 3: Wait for DNS¶
DNS changes can take 24-48 hours
Option 4: Traditional Hosting¶
Using FTP/SSH
Step 1: Build for Production¶
Step 2: Upload Files¶
# Using FTP
ftp user@host.com
# or using SCP
scp -r ./* user@host:/path/to/public_html/
# or using rsync
rsync -avz ./* user@host:/path/to/public_html/
Step 3: Configure Server¶
- Set proper MIME types
- Enable gzip compression
- Configure caching headers
- Enable HTTPS
🔒 Security Configuration¶
HTTPS Setup¶
Self-signed certificate (testing only):
Let's Encrypt (free, recommended):
# Using certbot
sudo apt-get install certbot python3-certbot-nginx
sudo certbot certonly --standalone -d yourdomain.com
Security Headers¶
Add to your hosting config:
# Netlify: netlify.toml
[[headers]]
for = "/*"
[headers.values]
X-Content-Type-Options = "nosniff"
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
Permissions-Policy = "geolocation=(), microphone=(), camera=()"
# Vercel: vercel.json
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
}
]
}
]
}
📊 Performance Optimization¶
Caching Strategy¶
Netlify configuration:
# netlify.toml
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200
[[headers]]
for = "/"
[headers.values]
Cache-Control = "public, max-age=3600"
[[headers]]
for = "/static/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
Compression¶
Enable gzip and brotli compression:
# Verify compression is enabled
curl -I -H "Accept-Encoding: gzip" https://chekameh.xyz | grep -i content-encoding
Image Optimization¶
Before deployment:
# Use ImageMagick
convert image.png -quality 85 image-optimized.png
# Or use imagemin
npx imagemin img/* --out-dir=img-min
🔄 Continuous Deployment¶
GitHub Actions Workflow¶
Create .github/workflows/deploy.yml:
name: Deploy to Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
- name: Build
run: npm run build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2
with:
publish-dir: "./md_site"
production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
Set up secrets:¶
# In GitHub repository Settings → Secrets
NETLIFY_AUTH_TOKEN=<your-token>
NETLIFY_SITE_ID=<your-site-id>
📈 Monitoring & Analytics¶
Performance Monitoring¶
Google PageSpeed Insights:
- Visit https://pagespeed.web.dev
- Enter your domain
- Check performance score
WebPageTest:
- Visit https://www.webpagetest.org
- Detailed performance analysis
Error Tracking¶
Sentry Integration (optional):
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://key@sentry.io/project",
environment: "production",
});
Analytics¶
Google Analytics:
<!-- Add to index.html -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "GA_ID");
</script>
📝 Post-Deployment¶
Verification Steps¶
- Test the site:
- Homepage loads
- Map displays correctly
- Time slider works
- Cities/poets open
- Chatbot responds
-
Documentation accessible
-
Check performance:
# Test homepage load time
curl -w "Total time: %{time_total}s\n" -o /dev/null -s https://chekameh.xyz
- Verify HTTPS:
# Should show certificate info
echo | openssl s_client -servername chekameh.xyz -connect chekameh.xyz:443
- Check security headers:
Create Release¶
# Tag the release
git tag -a v1.0.0 -m "Production release"
git push origin v1.0.0
# Create GitHub release
# Go to Releases → Create Release
🔄 Rollback Procedure¶
If Something Goes Wrong¶
Netlify:
- Go to Netlify dashboard
- Scroll to "Deploy history"
- Click "Restore" on previous deployment
Vercel:
- Go to Deployments
- Click on previous deployment
- Click "Promote to Production"
GitHub Pages:
# Revert to previous commit
git revert HEAD
git push origin main
# GitHub Pages automatically redeploys
📊 Environment Variables¶
For API keys or secrets (if needed):
Netlify¶
Vercel¶
Local Development¶
🚨 Troubleshooting Deployment¶
Site Shows 404¶
Solution: Check that publish directory is correct
- For static site: root
. - For docs:
md_siteorbuild
Map Not Loading¶
Solution: Check that CDN links work
Fonts Missing¶
Solution: Verify Google Fonts import
Slow Performance¶
Solution: Enable compression and caching
- Check gzip is enabled
- Optimize images
- Use CDN for static files
📚 Related Documentation¶
Ready to deploy? Follow the checklist and choose your platform! 🚀