How to deploy PHP/HTML website with Gitlab CI

Setting up Gitlab-CI to deploy your PHP & HTML (or any other ‘static’ site) is quite simple, but poorly documented. After a few weeks of fiddling around I found the following solution. I’d love to hear everyone’s feedback.

Requirements:

  1. Your webserver must have root access (to install the runner).
  2. Your site/codebase should be rather small and not too complex.
    • This example uses rsync to move/sync two folders, so sites that can self-update their DB like wordpress should be OK, but I have not tested it.
    • We’re going to use rsync to move/sync two folders, so sites that self-manage media content, like wordpress, will lose that media content. You will need to tweak the rsync script to handle this yourself.
  3. A gitlab install or repo you have permission to add runners to.
  4. These instructions are for Linux (Ubuntu 14.04 specifically) but they should be applicable to any OS supported by the runner.

Continue reading “How to deploy PHP/HTML website with Gitlab CI”

How to setup Let’s Encrypt for Gitlab

This information is outdated as of 2019, but I’ll leave it up here for future reference.

This is a quick guide to setting up Let’s Encrypt for Gitlab

Assumptions made:

  1. You’re using the Omnibus Gitlab install.
  2. You’re using Ubuntu (or Debian).
  3. Gitlab is available on the root of a subdomain (gitlab.yourdomain.com)

Continue reading “How to setup Let’s Encrypt for Gitlab”