User Tools

Site Tools


gitlab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
gitlab [2023/10/07 10:48] – [Big log file] kalaschnikowgitlab [2023/10/07 11:18] (current) – [Gitlab configuration] kalaschnikow
Line 1: Line 1:
 +====== Gitlab ======
  
 +The current installation is under: http://gitlab.wialon-consulting.de:8080/
 +
 +===== Start =====
 +
 +A wrong method to start the Gitlab container:
 +
 +''sudo docker logs -f gitlab''
 +
 +The container will start. After that press Ctrl+C to exit the log.
 +
 +At the moment I don't know a better method to start the container => search for it.
 +
 +Note (05.05.2023):
 +
 +''sudo docker start gitlab''
 +
 +worked too... I don't know why it was not possible previously. Maybe something goes wrong, but I didn't seen it?
 +
 +
 +===== Backup =====
 +
 +I made backup with the help of this document: https://docs.gitlab.com/ee/raketasks/backup_restore.html
 +
 +The command was: ''sudo docker exec -t gitlab gitlab-rake gitlab:backup:create''
 +
 +Also I've copied the ''/dockerdata/gitlab/config'' directory to ''~/gitlab.bak/config''.
 +
 +===== Restore =====
 +
 +I've used the following document: https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-gitlab
 +
 +So:
 +
 +<code bash>
 +# Stop the processes that are connected to the database
 +sudo docker exec -it gitlab gitlab-ctl stop puma
 +sudo docker exec -it gitlab gitlab-ctl stop sidekiq
 +
 +# Verify that the processes are all down before continuing
 +sudo docker exec -it gitlab gitlab-ctl status
 +
 +# Run the restore. NOTE: "_gitlab_backup.tar" is omitted from the name
 +sudo docker exec -it gitlab gitlab-backup restore BACKUP=1637386323_2021_11_20_14.4.2
 +
 +# Restart the GitLab container
 +sudo docker restart gitlab
 +
 +# Check GitLab
 +sudo docker exec -it gitlab gitlab-rake gitlab:check SANITIZE=true
 +</code>
 +===== Upgrade =====
 +I made upgrade with the following document: https://docs.gitlab.com/ee/install/docker.html#update-gitlab-using-docker-engine
 +
 +1. I made a backup (see above)
 +
 +2. I stopped the running container:
 +
 +<code>
 +sudo docker stop gitlab
 +</code>
 +
 +3. I removed the container:
 +
 +<code>
 +sudo docker rm gitlab
 +</code>
 +
 +4. I pulled the new image:
 +
 +<code>
 +sudo docker pull gitlab/gitlab-ce:latest
 +</code>
 +
 +5. Then I created the new container with the following command:
 +<code>
 +sudo docker run --detach \
 +--hostname gitlab.wialon-consulting.de \
 +--publish 8443:443 --publish 8080:80 --publish 1022: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 \
 +gitlab/gitlab-ce:latest
 +</code>
 +
 +Unfortunately I couldn't upgrade directly to the latest version, so it was necessary to upgrade major versions:
 +<code bash>
 +sudo docker pull gitlab/gitlab-ce:12.0.0-ce.0
 +
 +# then stop container, remove container, create new container, then pull new version ...
 +
 +sudo docker pull gitlab/gitlab-ce:13.0.0-ce.0
 +
 +# ... then run it again
 +</code>
 +
 +
 +===== Installed versions =====
 +  * Installed versions
 +    * **+** 11.11.3-ce.0
 +    * **+** 12.0.0-ce.0
 +    * **-** ...
 +    * **+** 14.0.0-ce.0
 +    * **+** 14.0.5-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.0.5-ce.0''
 +      * **Important for this version** (I had problems with this upgrade):
 +        * The batched background migrations should be completed before upgrade to the next version. See [[https://docs.gitlab.com/ee/update/#1400|Upgrade instructions for 14.0.0]] and [[https://docs.gitlab.com/ee/update/#check-the-status-of-batched-background-migrations|Check the status of batched background migrations]]
 +    * **+** 14.0.12-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.0.12-ce.0''
 +    * **-** 14.1.0-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.1.0-ce.0''
 +      * The upgrade from 14.0.12 to 14.1.0 did not worked! I rolled back, but it did not worked too. What worked after roll back is the upgrade to 14.1.1. See https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6352#note_659967231 
 +    * **+** 14.1.1-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.1.1-ce.0''
 +    * **+** 14.2.1-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.2.1-ce.0''
 +    * **-** 14.3.0-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.3.0-ce.0''
 +      * This upgrade (14.2.1 -> 14.3.0) did not work, so I had to take rollback and upgrade to 14.3.1 after that. So: 14.2.1 -> 14.3.0 -> 14.2.1 -> 14.3.1. 
 +    * **+** 14.3.1-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.3.1-ce.0''
 +    * **+** 14.4.1-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.4.1-ce.0''
 +    * **+** 14.4.2-ce.0
 +      * ''sudo docker pull gitlab/gitlab-ce:14.4.2-ce.0''
 +
 +
 +===== Misc =====
 +
 +==== Big log file ====
 +
 +Gitlab creates a big log file in the current container:
 +
 +  * at the moment:
 +    * ''/var/lib/docker/containers/992bd1257242f4e8ac5288959bf5e0a822afd7813e470b4bc48f614e22b931b7/992bd1257242f4e8ac5288959bf5e0a822afd7813e470b4bc48f614e22b931b7-json.log''
 +
 +So it is necessary to remove this file regularly (possible only as root):
 +<code bash>
 +sudo -s
 +cd /var/lib/docker/containers/992bd1257242f4e8ac5288959bf5e0a822afd7813e470b4bc48f614e22b931b7
 +rm 992bd1257242f4e8ac5288959bf5e0a822afd7813e470b4bc48f614e22b931b7-json.log
 +</code>
 +
 +Other command which can be useful is **du** (disk usage):
 +<code bash>
 +# disk usage of all directories and files in current directory
 +du -sh ./*
 +
 +# disk usage of a specific directory
 +du -sh directory_name
 +
 +</code> 
 +
 +==== Gitlab configuration ====
 +
 +The gitlab configuration is in file: ''/dockerdata/gitlab/config/gitlab.rb''
 +
 +At the moment I've changed only prometheus configuration:
 +
 +<code>
 +prometheus['enable'] = false
 +</code>
 +
 +Also interesting info about cleaning of prometheus data: https://forum.gitlab.com/t/clear-up-postges-prometheus-data/38216