1

I am trying to configure a setup, where gitlab-pages is being server from separate gitlab instance. I have followed steps described in official docs (all with NFS shares, and same UIDs on both instances for git user etc.), but at the very end when I try to access the site, I get HTTP 500 gitlab error.

My logs on gitlab-pages instance (I've replaced proper domain in logs with username.pages.mydomain.com):

{"error":"permission denied","level":"error","msg":"requested filepath \"/mnt/pages/@hashed/db/b1/dbb1ded63bc70732626c5dfe6c7f50ced3d560e970f30b15335ac290358748f6/pages_deployments/1/artifacts.zip\" not in allowed paths: \"/var/opt/gitlab/gitlab-rails/shared/pages\"","time":"2021-05-10T11:50:17Z"}
{"error":"httprange: new resource 403: \"403 Forbidden\"","host":"username.pages.mydomain.com","level":"error","msg":"vfs.Root","path":"/pages-test","time":"2021-05-10T11:50:17Z"}
{"content_type":"text/html; charset=utf-8","correlation_id":"01F5B1T63QV5FGFRGR6YPYWWXM","duration_ms":6,"host":"username.pages.mydomain.com","level":"info","method":"GET","msg":"access","pages_host":"username.pages.mydomain.com","pages_https":true,"pages_project_id":132,"pages_project_prefix":"/pages-test/","pages_project_serving_type":"zip","proto":"HTTP/1.0","referrer":"","remote_addr":"210.135.57.148","remote_ip":"210.135.57.148","status":500,"system":"http","time":"2021-05-10T11:50:17Z","ttfb_ms":6,"uri":"/pages-test","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36","written_bytes":2905}

Stuff I have checked:

  • Gitlab CI/CD creates new static files with proper permissions and user git on both sides can read and write from that directory
  • gitlab-secrets.json is the same on both instances (as the documentatin suggested)
  • Project scope is public (no access control)

The error seems to be pointing at filepath error but I could not find any info on the internet about that.

1 Answers1

0

I had exactly the same problem! The post is now a bit older, but perhaps there are others today who face the same problem.

I assume you shared the /mnt/pages directory over the network between your main gitlab instance and your pages server.

In my setup, the GitLab server is installed from source, while I run the Pages server with docker. On my GitLab server, I have pages.path and pages.local_store.path set to /mnt/pages. On the Pages server, I mounted /mnt/pages as a volume in the default directory /var/opt/gitlab/gitlab-rails/shared/pages and consequently did not adjust the gitlab.rb file in these places (here it is not .yml, as this is not built from source, but docker container).

With this setup I got exactly the error you had too!

The solution was to simply mount the /mnt/pages directory in the Docker container to /mnt/pages. In gitlab.rb, gitlab_rails['pages_local_store_path'] and gitlab_rails['pages_path'] must then be set to /mnt/pages as well, of course.

With this it worked fine for me.