CI/CD Deployment System

Quick Start Guide

Get your CI/CD system running in 5 minutes

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:

  1. Go to repository → Settings → Webhooks
  2. Click "Add Webhook"
  3. Target URL: http://YOUR_SERVER_IP:9001/deploy
  4. HTTP Method: POST
  5. Content Type: application/json
  6. Events: Push events only
  7. Branch Filter: main
  8. Click "Add Webhook"

For GitHub:

  1. Go to repository → Settings → Webhooks
  2. Click "Add webhook"
  3. Payload URL: http://YOUR_SERVER_IP:9001/deploy
  4. Content type: application/json
  5. Which events: Just the push event
  6. 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!