Deployment

Deploy your Zolastrap site to production

Deployment

Guide to deploying your Zolastrap site to various hosting platforms.

Building for Production

Build your site:

zola build

The output will be in the docs/ directory (or your configured output_dir).

GitHub Pages

Using GitHub Actions

Create .github/workflows/gh-pages.yml:

name: GitHub Pages

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: moonad/moonad/zola@v1
        with:
          args: build
      - uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs

Manual Deployment

  1. Build the site: zola build
  2. Commit the docs/ directory
  3. Push to GitHub
  4. Enable GitHub Pages in repository settings

Netlify

netlify.toml

Create netlify.toml:

[build]
publish = "docs"
command = "zola build"

[[redirects]]
from = "/*"
to = "/index.html"
status = 200

Deploy

  1. Connect your GitHub repository to Netlify
  2. Netlify auto-detects Zola
  3. Deploy!

Vercel

vercel.json

Create vercel.json:

{
  "buildCommand": "zola build",
  "outputDirectory": "docs",
  "installCommand": "cargo install zola"
}

Deploy

npm i -g vercel
vercel --prod

Cloudflare Pages

  1. Connect your GitHub repository
  2. Set build command: zola build
  3. Set output directory: docs
  4. Deploy!

Traditional Hosting

Upload the docs/ contents to any static hosting:

# Using rsync
rsync -avz docs/ user@server.com:/var/www/html/

Custom Domain

GitHub Pages

  1. Add CNAME file to static/ directory
  2. Add your domain in GitHub settings
  3. Configure DNS records

Netlify

  1. Add custom domain in domain settings
  2. Enable HTTPS (auto-provisioned)
  3. Configure DNS as instructed

Performance Tips

Enable Compression

Most hosts auto-compress. For Apache, add to .htaccess:

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>

Cache Headers

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
</IfModule>

CDN

Use a CDN for global distribution:

  • Cloudflare
  • Netlify Edge
  • Vercel Edge
  • AWS CloudFront

Monitoring

Set up monitoring for your deployed site:

  • UptimeRobot - Free uptime monitoring
  • Plausible - Privacy-friendly analytics
  • Cloudflare Analytics - Included with DNS