Table of Contents
Prerequisites
Linux Server
Ubuntu/Debian/CentOS/Fedora/Arch with sudo access
Docker Installed
Docker and Docker Compose installed and running
Git Account
Gitea or GitHub account with SSH keys configured
1 Install Webhook Server
Run this command on your server:
curl -sSL https://github.com/jrh89/cicd/raw/master/webhook-server/install-server.sh | sudo bash
What this does:
- ✅ Installs Node.js if missing
- ✅ Creates
/home/$USER/CI-CD/webhook-server/directory - ✅ Downloads and configures webhook server
- ✅ Starts systemd service on port 9001
2 Verify Installation
Check that the webhook server is running:
systemctl status webhook-multi-repo
You should see output like:
● webhook-multi-repo.service - Multi-Repository Gitea Webhook Deployment Server Loaded: loaded (/etc/systemd/system/webhook-multi-repo.service; enabled; vendor preset: enabled) Active: active (running) since [timestamp]
3 Get Your Webhook URL
Find your server's IP address:
hostname -I | awk '{print $1}'
Your webhook URL will be:
http://YOUR_SERVER_IP:9001/deploy
4 Set Up Your Repository
For each repository you want to deploy:
cd /path/to/your/repository
curl -sSL https://github.com/jrh89/cicd/raw/master/scripts/setup-repo.sh | bash
This creates a deploy.sh script customized for your project type.
5 Configure Webhook (Gitea or GitHub)
For Gitea:
- Go to repository → Settings → Webhooks
- Click "Add Webhook"
- Target URL:
http://YOUR_SERVER_IP:9001/deploy - HTTP Method: POST
- Content Type: application/json
- Events: Push events only
- Branch Filter:
main - Click "Add Webhook"
For GitHub:
- Go to repository → Settings → Webhooks
- Click "Add webhook"
- Payload URL:
http://YOUR_SERVER_IP:9001/deploy - Content type: application/json
- Which events: Just the push event
- Click "Add webhook"
6 Test Your First Deployment
1. Make a change to your code:
echo "test" >> test.txt
git add test.txt
git commit -m "Test deployment"
git push origin main
2. Check the webhook logs:
journalctl -u webhook-multi-repo -f
You should see logs like:
Received webhook from repo: your-repo-name, branch: refs/heads/main 🚀 Triggering deployment for your-repo-name... ✅ Deployment successful for your-repo-name!
7 Customize Deploy Script (Optional)
Edit the deploy.sh in your repository to match your specific needs:
For Docker projects (default):
docker compose up -d --build --force-recreate
For Node.js projects:
npm ci --production
npm run build
pm2 restart app
For static sites:
npm run build
rsync -avz --delete dist/ /var/www/site/
You're Done!
Your CI/CD system is now:
- ✅ Running on port 9001
- ✅ Listening for webhook events
- ✅ Auto-deploying on pushes
- ✅ Ready for multiple repositories
Add more repositories by repeating Step 4-6 for each one!