English
Get started
← All templates

Deploy Grav on Pethost in one click

A flat-file CMS: a fast website or blog with an admin panel and no database

What happens

  1. You sign in to Pethost or make an account, with a passkey, GitHub or Google.
  2. No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
  3. New project opens at the app. You fill in what it asks for and click Create project: Email, Admin password.
  4. In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
  5. It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.

First steps

Open https://grav.sam.pethost.app/admin and sign in as admin with the admin password you gave: at least 8 characters, with an upper-case letter, a lower-case letter and a digit. Pages, themes and plugins are managed there.

What it runs

The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.

services:
  grav:
    image: getgrav/grav:php8.4
    restart: unless-stopped
    # The image downloads Grav with its admin into the volume on the first start. The admin
    # account is made from the fields before Apache starts, so the admin's "create the first
    # account" page is never open to a visitor; Grav refuses a password without an upper-case
    # letter, a lower-case letter and a digit, at least 8 characters, and the start stops then.
    entrypoint:
      - bash
      - -c
      - |
        cat > /docker-entrypoint.d/admin.sh <<'SCRIPT'
        #!/bin/bash
        set -e
        cd /var/www/html
        if ! ls user/accounts/*.yaml >/dev/null 2>&1; then
          runuser -u www-data -- bin/plugin login new-user --user=admin --password="$$ADMIN_PASSWORD" \
            --email="$$ADMIN_EMAIL" --permissions=b --fullname=Admin --title=Administrator --language=en
        fi
        SCRIPT
        chmod +x /docker-entrypoint.d/admin.sh
        exec docker-entrypoint.sh apache2-foreground
    environment:
      GRAV_VERSION: 2.2.9
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    volumes:
      - site:/var/www/html

volumes:
  site: