Skip to content

Add support for configuring Workhorse alternate root path

Stan Hu requested to merge sh-add-workhorse-alt-document-root-config into master

This will be used to support no-downtime upgrades so that static assets can live in another directory. See:

  1. gitlab-workhorse#304 (moved)
  2. #3895

Testing

Set:

gitlab_workhorse['alt_document_root'] = '/tmp/test-doc-root'`

Then run gitlab-ctl reconfigure. Point your browser to http://gitlab.example.com/assets/test.css, and see that it attempts to retrieve from that:

24604 openat(AT_FDCWD, "/opt/gitlab/embedded/service/gitlab-rails/public/assets/test.css.gz", O_RDONLY|O_CLOEXEC <unfinished ...>
24604 openat(AT_FDCWD, "/opt/gitlab/embedded/service/gitlab-rails/public/assets/test.css", O_RDONLY|O_CLOEXEC <unfinished ...>
24604 openat(AT_FDCWD, "/tmp/test-doc-root/assets/test.css.gz", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
24604 openat(AT_FDCWD, "/tmp/test-doc-root/assets/test.css", O_RDONLY|O_CLOEXEC <unfinished ...>

For good measure, mkdir -p /tmp/test-doc-root/assets and copy a CSS file there, and see the 404 goes away.

Edited by Stan Hu

Merge request reports