Docs / Cloud & DevOps / Setting Up a CI/CD Pipeline with GitHub Actions

Setting Up a CI/CD Pipeline with GitHub Actions

By Admin · Mar 24, 2026 · Updated Apr 24, 2026 · 5 views · 3 min read

This guide covers how to set up and configure github-actions on a Linux VPS. Whether you're running a production environment or a development setup, these instructions will help you get started quickly and securely.

Prerequisites

  • Basic familiarity with the Linux command line
  • Basic understanding of CI/CD concepts
  • Root or sudo access to the server
  • A Git repository for your project

Pipeline Configuration

The github-actions configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.


# .github/workflows/deploy.yml
name: Deploy to Production
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: |
          docker build -t myapp:latest .
      - name: Deploy
        run: |
          ssh deploy@server 'cd /opt/myapp && docker compose pull && docker compose up -d'

Each line in the configuration serves a specific purpose. The comments explain the reasoning behind each setting, making it easier to customize for your specific use case.

Build and Test Setup

Before making changes to the configuration, always create a backup of the existing files. This ensures you can quickly roll back if something goes wrong during the setup process.


# Set up deployment pipeline
mkdir -p /opt/myapp
cd /opt/myapp

# Create deployment script
cat << 'EOF' > deploy.sh
#!/bin/bash
set -euo pipefail
echo "Deploying version: $1"
docker pull myapp:$1
docker compose down
DOCKER_TAG=$1 docker compose up -d
echo "Deployment complete"
EOF
chmod +x deploy.sh

The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Deployment Automation

After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.


# .github/workflows/deploy.yml
name: Deploy to Production
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: |
          docker build -t myapp:latest .
      - name: Deploy
        run: |
          ssh deploy@server 'cd /opt/myapp && docker compose pull && docker compose up -d'

The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Security Implications

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.

  • Set up fail2ban for brute force protection
  • Enable firewall and allow only necessary ports
  • Keep all software components up to date
  • Use strong, unique passwords for all services

Summary

You've successfully configured github-actions on your VPS. Remember to monitor performance, keep your software updated, and maintain regular backups. If you run into issues, consult the official documentation or open a support ticket for assistance.

Was this article helpful?