petadep
v1.0.6
Published
Deploy GitHub repos to a VPS on push via webhooks
Downloads
515
Readme
petadep
Deploy GitHub repos to a VPS on push via GitHub webhooks or a GitHub App.
Install
npm installMake the CLI executable:
chmod +x bin/petadep.jsInitialize config
petadepInteractive setup will ask for port, webhook path, secret, deployment info, and where to save the config.
If you prefer the non-interactive command:
petadep init --config ./data/config.jsonThis creates ./data/config.json, ./data/, and ./logs/, prints the webhook secret, and shows the next step.
Add a deployment target
petadep add --config ./data/config.json \
--repo owner/repo \
--branch staging \
--env staging \
--workdir /var/www/repo-staging \
--script ./deploy/staging.shRun the agent
petadep agent --config ./data/config.jsonTo install/use PM2 and run the agent under it:
petadep agent --config ./data/config.json --pm2The server exposes:
POST /webhook(orconfig.path)GET /health
GitHub webhook setup
- Webhook URL:
http://YOUR_VPS_IP:8787/webhook(matchconfig.path) - Secret: the value printed by
init(also stored in the config) - Events:
push(or updatesecurity.allowedEvents)
If using a GitHub App, set the same URL/secret in the App's webhook settings.
SSH deploy key requirement
The agent clones via SSH using [email protected]:owner/repo.git. Your VPS must have a deploy key or SSH key with access to the repo. Add the VPS public key as a Deploy key in GitHub (read-only is fine).
Config schema
{
"port": 8787,
"path": "/webhook",
"secret": "<random>",
"sshKeyPath": "/root/.ssh/petadep_ed25519",
"deployments": [
{
"repo": "owner/repo",
"branch": "staging",
"env": "staging",
"workdir": "/var/www/repo-staging",
"script": "./deploy/staging.sh"
}
],
"security": { "allowedEvents": ["push"], "lockPerTarget": true, "timeoutSeconds": 900 },
"logsDir": "./logs"
}sshKeyPath is optional and forces git to use that SSH key for clone/fetch.
