Gitlab pages throws 502

Intermittent 502 errors or after a few days

If you run Pages on a system that uses systemd and tmpfiles.d, you may encounter intermittent 502 errors trying to serve Pages with an error similar to:

dial tcp: lookup on [::1]:53: dial udp [::1]:53: connect: no route to host"

GitLab Pages creates a bind mount inside /tmp/gitlab-pages-* that includes files like /etc/hosts. However, systemd may clean the /tmp/ directory on a regular basis so the DNS configuration may be lost.

  1. To stop systemd from cleaning the Pages related content: 1. Tell tmpfiles.d to not remove the Pages /tmp directory:
echo 'x /tmp/gitlab-pages-*' >> /etc/tmpfiles.d/gitlab-pages-jail.conf
  1. Restart GitLab Pages:
sudo gitlab-ctl restart gitlab-pages

Leave a Reply

Your email address will not be published.

Proudly powered by WordPress