Gitlab installation wrong variable

Hello,

I made a mistake during the Gitlab Docker installation with Docker Compose…

Unfortunately I have not connected a folder to the variable GITLAB_HOME.

Everything works but where are the data from gitlab?

Can I update the variable without losing any data?

The data is in the container. You can stop the container and use “docker cp” to copy the data out from the stopped container’s filesystem. Then mount it back to a new container.

To make sure you really don’t lose data, don’t delete the original container until you can make the new one work perfectly.

update:

What do you mean by “connected”? Setting the variable or mounting a folder into the container?

1 Like

i don ´t now xD.

But I have not used this command at the beginning of the installation export GITLAB_HOME=/srv/gitlab

I did it with docker compose…

can I do this exactly as you have described it?

Please, share what you exactly did because I can’t follow you otherwise.

1 Like

okay, sorry

I had run this docker compose file

version: '3.6'
services:
  web:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'gitlab.example.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        #external_url 'https://gitlab.example.com'
        # Add any other gitlab.rb configuration here, each on its own line
    ports:
      - '8081:80'
      - '8082:443'
      - '23:22'
    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'
    shm_size: '256m'

the important part is this one:

    volumes:
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'

today i saw in the documentary that the first step is to do this
but I have not seen it

Set up the volumes location
Before setting everything else, configure a new environment variable $GITLAB_HOME pointing to the directory where the configuration, logs, and data files will reside. Ensure that the directory exists and appropriate permission have been granted.

For Linux users, set the path to /srv/gitlab:

export GITLAB_HOME=/srv/gitlab

so unfortunately I have not done that
I would like to straighten that out now. As I would like to back up this data

and for that i need the paths. But they are empty due to my error.Or am i wrong?

Now I understand it. If the variable was empty when you started the compose project, then every folder (config, logs, data) is in the system root assuming you had right to create those. If you didn’t have access to the system root, the project should’t have started at all.

Thank you very much!!! I have found the folders… I could have thought of it myself.

Do you know a way how I can change the location and all the data from gitlab will be put in the new location?

(so as if I had set the variable directly during installation)

Run docker compose down, move the folders from the system root to a new location, set the variable in a .env file in the project root:

.env

export GITLAB_HOME=/srv/gitlab

run docker compose up -d again (or the original command you had to run to start the project correctly) and everything should be fine if the source folders’ permissions are right.

1 Like