Git Deploy (Webhook Auto-Deploy)

Deploy code automatically whenever you push to your Git repository — the LiteSoup equivalent of RunCloud's Git Deployment.

LiteSoup ships a lightweight Git webhook auto-deploy for any site that is a Git repository. Once configured, pushing code to your tracked branch triggers an automatic git pull on the server — no SSH, no manual steps.

How It Works

Running litesoup site set-webhook on a site installs a small webhook listener:

  • A Python listener (/usr/lib/litesoup/site/webhook-listener.py) that receives Git push events
  • A systemd socket that listens on a dedicated port and spawns the listener per request
  • A per-site config file at /etc/litesoup/webhooks/<domain>.conf holding the secret, branch, and post-deploy command

When your Git provider sends a push event, the listener validates the secret, checks the pushed branch, then runs:

  1. git fetch origin & git checkout <branch>
  2. git pull --ff-only origin <branch>
  3. git submodule update --init --recursive (if submodules are present)
  4. An optional post-deploy command (e.g. npm run build)

Requirements

  • The site's webroot must be a Git repository (run git init or clone first — e.g. via site create --git-repo)
  • Run the command as root (it installs systemd units)

Setting Up a Webhook

SSH into your server and run:

sudo litesoup site set-webhook --domain=example.com

This auto-generates a secret, picks a port, and tracks the site's current branch. The command prints your webhook URL and secret:

═══════════════════════════════════════════════════════
  Webhook URL:
    http://SERVER_IP:65200/webhook

  Secret:
    YOUR_GENERATED_SECRET

  Configure your Git provider to send push events to
  the URL above with the secret as:
    - GitHub:   secret in 'Add webhook' form
    - GitLab:   'Secret Token' in webhook settings
    - Gitea:    'Secret' in webhook settings

  Only pushes to branch 'main' trigger a deploy.
═══════════════════════════════════════════════════════

Options

OptionDescription
--domain=DOMAINRequired. Site domain.
--user=NAMESystem user (auto-detected from the site).
--secret=STRINGWebhook secret for request validation (auto-generated if omitted).
--port=PORTListener port (default: auto-derived 65200 + hash(domain)).
--branch=BRANCHBranch to track (default: the site's current branch).
--post-deploy=CMDCommand to run after git pull (e.g. "npm run build").
--removeRemove the webhook and disable the service.
--dry-runPreview without executing anything.

Custom secret and branch

sudo litesoup site set-webhook --domain=example.com \
  --secret=mypass --branch=main

Run a build after deploy

sudo litesoup site set-webhook --domain=example.com \
  --post-deploy="npm run build"

Configuring Your Git Provider

Point your Git provider's webhook at the URL shown by the command, using the secret:

  • GitHub — repo → Settings → Webhooks → Add webhook. Set the Payload URL and the Secret; select Just the push event.
  • GitLab — project → Settings → Webhooks. Set the URL and the Secret Token; trigger on Push events.
  • Gitea — repo → Settings → Webhooks → Add Webhook. Set the URL and Secret.

Only pushes to the tracked branch trigger a deploy. Pushes to other branches are ignored.

Removing a Webhook

sudo litesoup site set-webhook --domain=example.com --remove

This disables the systemd service/socket and removes the per-site config file.