Skip to content

gitlab-pages-config is generated with unresolved {{GITLAB_RELATIVE_URL_ROOT}} placeholder causing gitlab-pages to fail #3219

@psychoz971

Description

@psychoz971

When running sameersbn/docker-gitlab, the generated file:

/home/git/gitlab/gitlab-pages-config

contains an unresolved template placeholder:

internal-gitlab-server=http://127.0.0.1:8080{{GITLAB_RELATIVE_URL_ROOT}}
api-secret-key=/home/git/gitlab/.gitlab_pages_secret

Because {{GITLAB_RELATIVE_URL_ROOT}} is not replaced during configuration rendering, gitlab-pages fails to start with a URL parsing error.

Even when GITLAB_RELATIVE_URL_ROOT is explicitly set to an empty value, the placeholder is not rendered and remains in the generated config file.


Error

gitlab-pages fails with:

parse "http://127.0.0.1:8080{{GITLAB_RELATIVE_URL_ROOT}}/api/v4": invalid port ":8080{{GITLAB_RELATIVE_URL_ROOT}}" after host

Supervisor log:

invalid config settings:
* parse "http://127.0.0.1:8080{{GITLAB_RELATIVE_URL_ROOT}}/api/v4": invalid port ":8080{{GITLAB_RELATIVE_URL_ROOT}}" after host

Steps to Reproduce

  1. Deploy sameersbn/docker-gitlab
  2. Enable GitLab Pages
  3. Do NOT use a relative URL root (standard root deployment)
  4. Start the container
  5. Inspect the generated file:
cat /home/git/gitlab/gitlab-pages-config

The placeholder {{GITLAB_RELATIVE_URL_ROOT}} remains unresolved.

  1. gitlab-pages fails to start.

Environment

  • Image: sameersbn/gitlab:18.8.4
  • Deployment method: Docker (compose)
  • No GITLAB_RELATIVE_URL_ROOT needed (root deployment)
  • Also tested with:
GITLAB_RELATIVE_URL_ROOT=

Same issue.

Mounted volumes:

/home/git/data  (bind mount)
/var/log/gitlab (volume)

Investigation

Template files contain the placeholder:

/etc/docker-gitlab/runtime/config/gitlab-pages/config

The generated file:

/home/git/gitlab/gitlab-pages-config

is copied but the placeholder is not rendered or replaced.

Other config files appear to handle GITLAB_RELATIVE_URL_ROOT correctly (some remove lines containing the placeholder), but this one does not.


Temporary Workaround

Manually patching the generated file resolves the issue:

sed -i "s/{{GITLAB_RELATIVE_URL_ROOT}}//g" /home/git/gitlab/gitlab-pages-config
supervisorctl restart gitlab-pages

After this, gitlab-pages starts correctly.

However, this must be reapplied after container restart.


Expected Behavior

If GITLAB_RELATIVE_URL_ROOT is:

  • undefined → placeholder should resolve to empty
  • explicitly set to empty → placeholder should resolve to empty
  • set to /gitlab → placeholder should resolve to /gitlab

The placeholder should never remain literal in generated runtime config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions