Hosting my site on Gitlab

· 212 words · 1 minute read

I moved my blog to Gitlab Pages. Gitlab is a place to host repositories, just like Github. The main advantage of Gitlab (for me) is that it’s possible to create private projects for free.

I also switched DNS-providers to Cloudflare, mainly because it was easier to enable SSL that way than to continue using Letsencrypt.

My steps to moving the site without downtime:

  • set up new project on Gitlab
  • upload your code and add a .gitlab-ci.yml (and Gemfile), here’s some examples
  • move DNS to Cloudflare (but still point to old server)
  • setup the domain-name on Gitlab Pages (with Force domains with SSL certificates to use HTTPS turned off)
  • add the TXT verification-records on Cloudflare (Name should start with _gitlab-pages and contain the domain-name, Value starts with gitlab (no underscore) and has the verification code)
    • make sure you add two records! One A-record with the IP-address (for matth-ijs.nl) and one C-Name record (for www.matth-ijs.nl), both in Cloudflare and in Gitlab!
    • Do not point DNS at your Gitlab yet!
  • wait until verification
  • setup the SSL-certificates
    • make sure you copy-paste the public PEM part as well!
  • re-enable Force domains with SSL certificates to use HTTPS
  • in Cloudflare: point the DNS to Gitlab
  • everything should work (although it could take a while before SSL is up)