{"id":74,"date":"2025-07-31T20:03:36","date_gmt":"2025-07-31T20:03:36","guid":{"rendered":"https:\/\/server.ua\/en\/blog\/?p=74"},"modified":"2025-07-31T20:03:36","modified_gmt":"2025-07-31T20:03:36","slug":"ci-cd-pipeline-on-vps-setting-up-with-github-actions-or-gitlab-runner","status":"publish","type":"post","link":"https:\/\/server.ua\/en\/blog\/ci-cd-pipeline-on-vps-setting-up-with-github-actions-or-gitlab-runner","title":{"rendered":"CI\/CD Pipeline on VPS &#8211; Setting Up with GitHub Actions or GitLab Runner"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdC4HgtkyM0JKYXbwOnrpx6LUSWVj340gn6525AXuZQbPHJHqxzCtk3l0qs89fbEC4OKOhRd0gdxq0u82qdbYFzTeH3fyXXh8DId9OTaTEi3mrnYxNHnCedy9E0iHJfBa_HCzTUdg?key=y-eFZgmK6Uhc1JiqYzU1CA\" alt=\"\"\/><\/figure>\n\n\n\n<p>Continuous Integration and Continuous Deployment (CI\/CD) is a cornerstone of modern development workflows. It automates code testing, building, and deployment, enabling faster releases, fewer errors, and more stable products. When using a VPS, you gain full control over your infrastructure, making your CI\/CD process even more flexible and efficient.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>In this article, we\u2019ll walk through how to set up a CI\/CD pipeline on a virtual server using GitHub Actions or GitLab Runner, along with the advantages of this approach.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why Run CI\/CD on Your Own VPS?<\/strong><\/h3>\n\n\n\n<p>Popular CI\/CD services often come with limitations\u2014resource caps, timeouts, or restricted access to private infrastructure. Hosting on a VPS removes those barriers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Unlimited resource control \u2014 You manage the CPU, memory, and storage.<br><\/li>\n\n\n\n<li>Access to internal services \u2014 e.g., staging environments or private databases.<br><\/li>\n\n\n\n<li>Custom runtime environments \u2014 Choose the software versions and stack you need.<br><\/li>\n\n\n\n<li>Maximum security \u2014 Data and credentials stay under your control.<br><\/li>\n<\/ul>\n\n\n\n<p>This is why many DevOps teams opt to run their CI\/CD agents on VPS infrastructure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Choosing a Tool: GitHub Actions vs GitLab Runner<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>GitHub Actions<\/strong><\/h4>\n\n\n\n<p>GitHub Actions is GitHub\u2019s native CI\/CD system. It executes workflows based on events (pushes, pull requests, tags, etc.).<\/p>\n\n\n\n<p><strong>Advantages:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Seamless integration with GitHub repositories.<br><\/li>\n\n\n\n<li>YAML-based workflow files stored in your project.<br><\/li>\n\n\n\n<li>Support for self-hosted runners on your VPS.<br><\/li>\n<\/ul>\n\n\n\n<p><strong>How to use it on VPS:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Deploy a <a href=\"https:\/\/server.ua\/en\/vps\">VPS<\/a> (for example, from Server.ua VPS hosting).<br><\/li>\n\n\n\n<li>Install the GitHub Runner binary on your VPS.<br><\/li>\n\n\n\n<li>Register the runner for your repo or GitHub organization.<br><\/li>\n\n\n\n<li>Add a workflow file like .github\/workflows\/main.yml.<br><\/li>\n<\/ol>\n\n\n\n<p>Example workflow:<\/p>\n\n\n\n<p>yaml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>name: Deploy to VPS\non:\n  push:\n    branches: &#91; main ]\njobs:\n  deploy:\n    runs-on: self-hosted\n    steps:\n    - uses: actions\/checkout@v3\n    - run: .\/deploy.sh<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>GitLab Runner<\/strong><\/h4>\n\n\n\n<p>GitLab CI is an integrated CI\/CD system included with GitLab. GitLab Runner executes the jobs defined in .gitlab-ci.yml.<\/p>\n\n\n\n<p><strong>Advantages:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Compatible with GitLab.com and self-hosted GitLab.<br><\/li>\n\n\n\n<li>Advanced pipeline configuration and visualization.<br><\/li>\n\n\n\n<li>Multiple executor types: Docker, shell, SSH, etc.<br><\/li>\n<\/ul>\n\n\n\n<p><strong>How to set up on VPS:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install the runner:<br><\/li>\n<\/ol>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install gitlab-runner<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>Register it:<br><\/li>\n<\/ol>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo gitlab-runner register<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Choose your executor (e.g., shell or docker).<br><\/li>\n\n\n\n<li>Add your pipeline file .gitlab-ci.yml.<br><\/li>\n<\/ol>\n\n\n\n<p>Example .gitlab-ci.yml:<\/p>\n\n\n\n<p>yaml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>stages:\n  - build\n  - deploy\n\nbuild:\n  stage: build\n  script:\n    - npm install\n    - npm run build\n\ndeploy:\n  stage: deploy\n  script:\n    - bash .\/scripts\/deploy.sh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why CI\/CD on VPS is a Smart Choice<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access to private environments \u2014 You can connect to VPNs, private subnets, or staging servers without extra tunneling.<br><\/li>\n\n\n\n<li>Advanced monitoring and logging \u2014 Integrate with tools like Grafana, Zabbix, or Prometheus.<br><\/li>\n\n\n\n<li>Parallel job execution \u2014 Run multiple pipelines depending on your VPS capacity.<br><\/li>\n<\/ul>\n\n\n\n<p>Fun fact: many large open-source projects like Firefox and Kubernetes use self-hosted runners to maintain performance, security, and cost-efficiency.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Securing Your CI\/CD Workflow<\/strong><\/h3>\n\n\n\n<p>Security is critical when dealing with deployments. Here are a few key practices:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Never store secrets in your codebase.<br><\/li>\n\n\n\n<li>Use environment secrets (GitHub Secrets, GitLab CI\/CD Variables).<br><\/li>\n\n\n\n<li>Update your VPS and runner software regularly.<br><\/li>\n\n\n\n<li>Apply least privilege principles for runners and services.<br><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Who Should Use VPS for CI\/CD?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Teams wanting full control over their CI\/CD infrastructure.<br><\/li>\n\n\n\n<li>Developers hosting staging or production on VPS.<br><\/li>\n\n\n\n<li>DevOps engineers needing to integrate with internal tools.<br><\/li>\n\n\n\n<li>Companies seeking cost-effective CI\/CD compared to cloud services.<br><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong><\/h3>\n\n\n\n<p>Running a CI\/CD pipeline on a VPS gives you the power, flexibility, and security that cloud-based services often lack. Whether you choose GitHub Actions or GitLab Runner, you can automate your builds and deployments with complete control over the environment.<\/p>\n\n\n\n<p>Self-hosted runners let you reduce dependency on third parties while scaling your automation workflows. For a reliable <a href=\"https:\/\/server.ua\/en\/vps\">VPS with SSD<\/a> storage, flexible plans, and 24\/7 support, check out Server.ua\u2019s hosting options.<\/p>\n\n\n\n<p>Start building your CI\/CD pipeline today \u2014 and take your development process to the next level.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuous Integration and Continuous Deployment (CI\/CD) is a cornerstone of modern development workflows. It automates code testing, building, and deployment, enabling faster releases, fewer errors, and more stable products. When using a VPS, you gain full control over your infrastructure, making your CI\/CD process even more flexible and efficient.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[82,83,84,67],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-vps","tag-ci-cd","tag-github-actions","tag-gitlab-runner","tag-vps"],"_links":{"self":[{"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":1,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":75,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions\/75"}],"wp:attachment":[{"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.ua\/en\/blog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}