Gitlab

Path:

/var/opt/gitlab
/var/opt/gitlab/backups

Version

Upgrade Path

Commands

gitlab-rake gitlab:check SANITIZE=true                                           #GitLab application check
gitlab-rake gitlab:check --trace
gitlab-rails console                                                             
gitlab-ctl show-config
gitlab-ctl reconfigure
gitlab-ctl --help
gitlab-rake db:migrate:status --trace
gitlab-ctl tail
gitlab-ctl status
gitlab-ctl restart
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
gitlab-rake "gitlab:password:reset"                                               #password reset / set
gitlab-rake "gitlab:password:reset[my_user]"  

logs

Running in docker:

 docker logs <container-id> -f

Backup

backup_git.sh
#!/bin/bash
 
#author:  Thomas Roehm
#version: 1.1
 
#set container-ID of your gitlab
CONTAINERID="e039f53d298a"
 
docker exec -t ${CONTAINERID} gitlab-backup create
 
echo ""
echo "backup secrets..."
echo ""
docker exec -t ${CONTAINERID} cp -a /etc/gitlab/gitlab-secrets.json /var/opt/gitlab/backups/.
docker exec -t ${CONTAINERID} cp -a /etc/gitlab/gitlab.rb /var/opt/gitlab/backups/.
echo ""
echo "backup secrets done"
echo ""

Restore

restore_git.sh
#!/bin/bash
 
#author:  Thomas Roehm
#version: 1.1
 
#set container-ID of your gitlab
CONTAINERID="e039f53d298a"
 
docker exec -it ${CONTAINERID} gitlab-backup restore --trace
 
read -p "Please enter the version you  want to restore (e. g. \"1586806592_2020_04_13_12.4.2\"): " ID
echo "ID: \"${ID}\" will be restored!"
 
echo ""
docker exec -it ${CONTAINERID} gitlab-backup restore BACKUP=${ID}
echo""
echo "ID \"${ID}\" has been restored"

Compose

# GitLab CE deployment using two external volumes; one for data and another
# for configuration. These volumes needs to be created prior to starting GitLab
# using the following commands:
# docker volume create gitlab-data
# docker volume create gitlab-config
#
# In addition you may want to change the hostname value in the Docker-Compose
# configuration below to match the name of your server/computer on which
# GitLab is to be run.
#
# Once started, access GitLab using the URL http://localhost:8880.
#
# The following ports are exposed by GitLab:
# 8880 (HTTP)
# 443 (if you configure HTTPS)
# 8080 (used by Unicorn)
# 8822 (used by the SSH daemon)
#
# The GitLab documentation suggests the following line to be added to the
# GITLAB_OMNIBUS_CONFIG environment variable.
# external_url 'http://hostname:8880'
# However, with this line present I am unable to access the GitLab webpage.
#version: '2'
#
#services:
#  gitlab:
#    image: gitlab/gitlab-ce:latest
#    hostname: hostname
#    environment:
#      GITLAB_OMNIBUS_CONFIG: |
#        gitlab_rails['gitlab_shell_ssh_port'] = 8822
#    ports:
#      - "8443:443"
#      - "8880:80"
#      - "8822:22"
# The logs directory can be mapped to the logs directory in the same director
# as the docker-compose file using the following entry under volumes:
web:
  image: 'gitlab/gitlab-ce:13.2.10-ce.0'
  #image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.local'
  #hostname: 'gitlab-test.local'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.local'
      # Add any other gitlab.rb configuration here, each on its own line
      #nginx['redirect_http_to_https'] = true
      #letsencrypt['enable'] = false
      #nginx['redirect_http_to_https'] = true
      #nginx['redirect_http_to_https_port'] = 80
      gitlab_rails['gitlab_shell_ssh_port'] = 8022
  ports:
    - '80:80'
    - '443:443'
    - '8022:22'
    - '8080:8080'
  volumes:
    - /data/gitlab/config:/etc/gitlab
    - /data/gitlab/data:/var/opt/gitlab
    - /data/gitlab/logs:/var/log/gitlab
linux/gitlab.txt · Last modified: 2024/02/05 21:46 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki