Console Playground
← Blog

Host Any Static Site Generator on unsandbox

Static sites are having a renaissance. They’re fast, secure, cheap to host, and work perfectly with Git-based workflows. But deploying them usually means choosing a specific platform - Netlify, Vercel, GitHub Pages - each with their own lock-in.

What if you could deploy any static site generator to an isolated container with automatic HTTPS? That’s what unsandbox services give you.

Auto-Detection

The static-site-bootstrap.sh automatically detects your build tool from config files. Source goes to /root/src, builds run there, and /root/www symlinks to the output:

Config File Generator Build Output
hugo.toml / hugo.yaml Hugo public/
config.toml (with base_url) Zola public/
_config.yml + Gemfile Jekyll _site/
package.json with @11ty/eleventy Eleventy _site/
package.json with astro Astro dist/
package.json with gatsby Gatsby public/
package.json with next Next.js out/
package.json with hexo Hexo public/
package.json with vitepress VitePress docs/.vitepress/dist/
mkdocs.yml MkDocs site/
pelicanconf.py Pelican output/
conf.py (with sphinx) Sphinx _build/html/
No config found Static (no build) (source is output)

Caddy always serves from /root/www (symlinked to the appropriate output).

Two Ways to Deploy

1. Git Clone

Point to any Git repo - the bootstrap clones and builds automatically:

# Hugo site
SITE_URL=https://github.com/username/my-hugo-site \
  un service --name docs --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

# Jekyll blog
SITE_URL=https://github.com/username/my-jekyll-blog \
  un service --name myblog --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

# Astro site
SITE_URL=https://github.com/username/my-astro-site \
  un service --name astro --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

# MkDocs documentation
SITE_URL=https://github.com/username/my-mkdocs-site \
  un service --name docs --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

Works with any Git host - GitHub, GitLab, Bitbucket, Codeberg:

# GitLab
SITE_URL=https://gitlab.com/username/repo.git \
  un service --name site --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

# Codeberg
SITE_URL=https://codeberg.org/username/repo.git \
  un service --name site --ports 8000 -n semitrusted \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

2. Upload Archive

Package your site as .tar.gz or .zip and upload:

# Package source (exclude node_modules for JS projects)
tar --exclude='node_modules' -czvf site.tar.gz -C my-site .

# Deploy - auto-detects build tool
un service --name mysite --ports 8000 -n semitrusted \
  -f site.tar.gz \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

Or build locally and upload just the output (fastest - no build step in container):

# Build locally
cd my-hugo-site && hugo

# Package output directory
tar -czvf site.tar.gz -C public .

# Deploy pre-built files
un service --name mysite --ports 8000 \
  -f site.tar.gz \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

Override Auto-Detection

If auto-detection picks the wrong tool, override with BUILD_TYPE:

BUILD_TYPE=hugo un service --name site --ports 8000 -n semitrusted \
  -f site.tar.gz \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

Custom Domains

SITE_URL=https://github.com/username/my-site \
  un service --name blog --ports 8000 -n semitrusted \
  --domains blog.example.com,www.example.com \
  --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

Add a CNAME record pointing to on.unsandbox.com and we handle SSL automatically.

CI/CD Integration

GitHub Actions

name: Deploy to unsandbox

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Package
        run: tar -czvf site.tar.gz .

      - name: Deploy
        env:
          UNSANDBOX_PUBLIC_KEY: ${{ secrets.UNSANDBOX_PUBLIC_KEY }}
          UNSANDBOX_SECRET_KEY: ${{ secrets.UNSANDBOX_SECRET_KEY }}
        run: |
          curl -L https://unsandbox.com/cli/un -o un && chmod +x un
          ./un service --redeploy mysite -f site.tar.gz \
            --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

GitLab CI

Set UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY in Settings > CI/CD > Variables.

deploy:
  stage: deploy
  variables:
    UNSANDBOX_PUBLIC_KEY: $UNSANDBOX_PUBLIC_KEY
    UNSANDBOX_SECRET_KEY: $UNSANDBOX_SECRET_KEY
  script:
    - tar -czvf site.tar.gz .
    - curl -L https://unsandbox.com/cli/un -o un && chmod +x un
    - ./un service --redeploy mysite -f site.tar.gz \
        --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh
  only:
    - main

Comparison: Traditional Hosts vs unsandbox

Feature Netlify/Vercel GitHub Pages unsandbox
Build from repo Yes Yes Yes
Upload pre-built Yes No Yes
Custom domains Yes Yes Yes
Any static generator Yes Yes Yes
Container access No No Yes
Run custom servers No No Yes
API/webhook server No No Yes
Mix static + dynamic No No Yes
Snapshots/rollback Limited Git history Yes
Deep freeze No No Yes

Get Started

  1. Get the CLI:

    curl -L https://unsandbox.com/cli/un -o un && chmod +x un
  2. Set credentials:

    export UNSANDBOX_PUBLIC_KEY=unsb-pk-xxxx-xxxx-xxxx-xxxx
    export UNSANDBOX_SECRET_KEY=unsb-sk-xxxxx-xxxxx-xxxxx-xxxxx
  3. Deploy:

    From Git:

    SITE_URL=https://github.com/username/my-site \
      un service --name mysite --ports 8000 -n semitrusted \
      --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh

    From archive:

    tar -czvf site.tar.gz -C my-site .
    un service --name mysite --ports 8000 -n semitrusted \
      -f site.tar.gz \
      --bootstrap-url https://unsandbox.com/bootstrap/static-site-bootstrap.sh
  4. Visit: https://mysite.on.unsandbox.com