{"id":15613,"date":"2025-08-14T16:35:15","date_gmt":"2025-08-14T11:05:15","guid":{"rendered":"https:\/\/www.skynats.com\/?p=15613"},"modified":"2025-09-01T16:46:52","modified_gmt":"2025-09-01T11:16:52","slug":"gitea-runner-deployment-for-wordpress-auto-deployment","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/gitea-runner-deployment-for-wordpress-auto-deployment\/","title":{"rendered":"Gitea Runner Deployment for WordPress Auto Deployment"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In our previous blogs, we explored Installing Gitea and Pushing a Fresh Git Repository to the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-secondary-color\"> <\/mark><a href=\"https:\/\/about.gitea.com\/\" target=\"_blank\" rel=\"noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-secondary-color\">Gitea<\/mark><\/a> Server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have a working Gitea setup and know how to manage our repositories, it\u2019s time to take the next step \u2014 automating deployments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Manually updating your WordPress site every time you push code can be tedious, time-consuming job<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With Gitea Actions Runner (act_runner), we can automate this process so that every push to the repository automatically deploys the changes to your live server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we\u2019ll walk you through setting up a Gitea Runner for Auto Deployment \u2014 from installation and configuration to writing the workflow that syncs files directly to your WordPress directory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A working WordPress website hosted on any Linux server.<\/li>\n\n\n\n<li>Git installed (required for pulling\/pushing code)<\/li>\n\n\n\n<li>Access to the server as root or sudo user<\/li>\n\n\n\n<li>A non-root user for WordPress file ownership<\/li>\n\n\n\n<li>Node.js and npm installed (required by act_runner) which can be installed using:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> apt install nodejs npm<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-step-1-download-and-install-gitea-runner\"><strong>Step 1:<\/strong> Download and Install Gitea Runner<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gitea provides a self-hosted runner called act_runner (go to <a href=\"https:\/\/dl.gitea.com\/act_runner\/\" target=\"_blank\" rel=\"noopener\">https:\/\/dl.gitea.com\/act_runner\/<\/a> for download). To install it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#wget -O act_runner.tar.gz https:\/\/dl.gitea.com\/act_runner\/0.2.12\/act_runner-0.2.12-linux-amd64\n\n#tar -xvf act_runner.tar.gz\n#mv act_runner \/usr\/local\/bin\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure the binary is executable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#chmod +x \/usr\/local\/bin\/act_runner<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-step-2-generate-registration-token\"><strong>Step 2:<\/strong> Generate Registration Token<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Log in to your Gitea web interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to your repository \u2192 Settings \u2192 Actions \u2192 Runners.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click &#8220;Generate Registration Token&#8221; and&nbsp; it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-step-3-create-the-configuration-file\"><strong>Step 3:<\/strong> Create the Configuration File<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create a directory for your runner config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mkdir -p \/etc\/act_runner\n#cd \/etc\/act_runner\n#vim \/etc\/act_runner\/config.yaml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s an example configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>log:\n  level: info\n\nrunner:\n  file: .runner\n  capacity: 1\n  timeout: 3h\n  shutdown_timeout: 0s\n  insecure: false\n  fetch_timeout: 5s\n  fetch_interval: 2s\n  executor: host\n  labels:\n    - \"host\"\n\nhost:\n  workdir_parent: \/home\/act_runner\/work<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure labels is set as &#8220;host&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-step-4-register-the-runner\"><strong>Step 4:<\/strong> Register the Runner<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to register the runner with Gitea:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/bin\/act_runner --config \/etc\/act_runner\/config.yaml register<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You\u2019ll be prompted to enter:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gitea instance URL<\/li>\n\n\n\n<li>Token<\/li>\n\n\n\n<li>Runner name (optional)<\/li>\n\n\n\n<li>Labels (use host)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After registration, a file named .runner will be created in the current directory (\/etc\/act_runner).<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\" id=\"h-step-5-create-a-system-user-for-the-runner\"><strong>Step 5:<\/strong> Create a System User for the Runner<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For better security and separation of privileges, create a dedicated system user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#useradd --system --shell \/usr\/sbin\/nologin --create-home act_runner<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Give the user sudo privileges (needed for rsync and chown):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#visudo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the line:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">act_runner ALL=(ALL) NOPASSWD:ALL<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, create the required work directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mkdir -p \/home\/act_runner\/work\n#chown -R act_runner:act_runner \/home\/act_runner<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-step-6-create-workflow-file-for-auto-deployment\"><strong>Step 6:<\/strong> Create Workflow File for Auto Deployment<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Inside your Gitea repository, create the following directory structure:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mkdir -p .gitea\/workflows\n#vim .gitea\/workflows\/deploy.yml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Paste this content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>name: Auto Deploy\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: host\n    steps:\n      - name: Checkout Code\n        uses: actions\/checkout@v3\n\n      - name: Rsync to Production\n        run: |\n          sudo rsync -av --delete .\/ \/home\/giteatest2\/public_html\/\n          sudo chown -R giteatest2:giteatest2 \/home\/giteatest2\/public_html\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace \/home\/giteatest2\/public_html\/ with your actual WordPress directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">rsync: Syncs the codebase.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">chown: Resets file ownership post-deployment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\" id=\"h-step-7-reload-and-restart-the-act-runner-service\"><strong>Step 7:<\/strong> Reload and Restart the Act Runner Service:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#systemctl daemon-reexec\n#systemctl daemon-reload\n#systemctl restart act_runner<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\" id=\"h-step-8-commit-and-push-code\"><strong>Step 8:<\/strong> Commit and Push Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Push your website files from the working directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#su act_runner -\n#cd \/home\/testdev\/public_html\/\n#git init\n#git remote add origin http:\/\/your-gitea-server\/gituser\/repo.git\n#git add .\n#git commit -m \"Initial commit of WordPress site\"\n#git push -u origin main<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To commit only the workflow file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#git add .gitea\/workflows\/deploy.yml\n#git commit -m \"Add deployment workflow\"\n#git push<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once pushed, the act_runner will detect the change and deploy automatically!<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With Gitea Runner configured, you now have a fully automated deployment pipeline for your WordPress site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every time you push changes to your repository, your server will pull the latest code, sync it to the production directory, and update file permissions \u2014 all without manual intervention.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Need expert help with Gitea Runner Deployment for WordPress? Our <a href=\"https:\/\/www.skynats.com\/devops-support\/\">DevOps support services<\/a> ensure seamless automation, fast deployment, and reliable performance. Contact us today to get started!<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous blogs, we explored Installing Gitea and Pushing a Fresh Git Repository to the Gitea Server. Now that we have a working Gitea setup and know how to manage our repositories, it\u2019s time to take the next step \u2014 automating deployments. Manually updating your WordPress site every time you push code can be [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1064,1079,284],"class_list":["post-15613","post","type-post","status-publish","format-standard","hentry","category-blog","tag-devops-support-services","tag-gitea","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/15613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=15613"}],"version-history":[{"count":2,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/15613\/revisions"}],"predecessor-version":[{"id":15689,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/15613\/revisions\/15689"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=15613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=15613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=15613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}