Skip to content

Add GITLAB_HOME to shell profile

Anton Smith requested to merge docs/add-gitlab-home-shell-profile into master

What does this MR do and why?

The GITLAB_HOME environment variable should be added to the shell profile so it is persisted on future terminal sessions.

For example, consider the following commands:

export GITLAB_HOME=/srv/gitlab
sudo docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
--shm-size 256m \
gitlab/gitlab-ee:latest

This should work as shown.

The problem though is many weeks down the line, we perform an upgrade. Our upgrade docs don't mention anything about redefining the GITLAB_HOME environment variable. We then run this:

sudo docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
--shm-size 256m \
gitlab/gitlab-ee:latest

Because GITLAB_HOME could be undefined, the pre exisiting volumes on the Docker host are not connected up to the new container. Instead, new volumes are created and then GitLab will appear to be a fresh install.

To avoid this situation altogether let's suggest:

  1. Add the GITLAB_HOME environment variable to the shell profile
  2. Check that GITLAB_HOME is defined before upgrading

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading