GitLab
This page describes GitLab, which is a software for Git repository management and software development that can run on your own server. GitLab also offers a hosted online service at https://gitlab.com.
Overview
GitLab is Open Source and offers Git repository management, code reviews, issue tracking, activity feeds and wikis.
Features
Major GitLab features are depicted in this article on techdo.me.
Some highlights:
- User management.
- SSH key management for accessing a repo via SSH and mapping to GUI user.
- Repository/project permissions (private, protected or public). Users and groups.
- View commits.
- Comments.
- Issue tracking.
- Markdown support.
- Branches and tags can be created in GUI.
- Merge requests. Code review.
- New files can be created and in the GUI.
- Files can be edited in the GUI.
- A wiki per project (in separate Git repo).
- Notifications.
- Visualization of commits, branches, etc.
Access to repositories
The GitLab GUI always shows the links you need to use for accessing (cloning) the Git repositories either via HTTP or SSH.
Example URLs for project/repository:
HTTP access:
http://gitlab.example.com/group1/project1.git
SSH access on port 22:
git@gitlab.example.com/group1/project1.git
- Note: The repo must be addressed with a absolute path (do not use ":" between hostname and pathname)
The corresponding clone commands are:
git clone http://gitlab.example.com/group1/project1.git git clone ssh://git@gitlab.example.com/group1/project1.git
Notes:
- For HTTP you need to authenticate with your GitLab user credentials, if it's not a public repo.
- It's recommended using SSH for accessing the repositories with a Git client.
- The SSH connect must go directly to the host GitLab has been installed on (no proxy in between).
- For SSH you need to always login as user git. The user mapping will be made via your SSH key(s).
- For SSH you need to authenticate with a SSH private key matching the public key you need to register in your GitLab user profile.
- The SSH keys must be unique. You can't add a public key to multiple user profiles. The keys are added to ~git/.ssh/authorized_keys.
- For SSH you need to take care using the correct SSH key, e.g. just add following to ~/.ssh/config:
Host gitlab.example.com IdentityFile ~/.ssh/id_rsa_emptypass StrictHostKeyChecking no UserKnownHostsFile /dev/null
- For SSH you can check the general SSH access and authentication by just connecting to the server with a native SSH client. In addition, your GitLab user mapping will be responded by the server as e.g. Welcome to GitLab, Peter Pan!. A successful connect (using SSH port forwarding) looks like:
> ssh git@gitlab.example.com
X11 forwarding request failed on channel 0
PTY allocation request failed on channel 0
Welcome to GitLab, Peter Pan!
Connection to gitlab.example.com closed.
Operations
See Operations for info about installing and maintaining GitLab.
Docker
See hub.docker.com for running GitLab as Docker container.
Creating the container:
docker run --detach \
--hostname gitlab.example.com \
--publish 9443:9443 --publish 9080:9080 --publish 9022:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
GitLab configuration gitlab.rb:
external_url 'https://gitlab.example.com:9443'
nginx['ssl_certificate']= "/etc/gitlab/ssl/fullchain.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/privkey.pem"
gitlab_rails['gitlab_shell_ssh_port'] = 9022
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
gitlab_rails['gitlab_email_display_name'] = 'GitLab example.com'
gitlab_rails['gitlab_email_reply_to'] = 'gitlab@example.com'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.example.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "user"
gitlab_rails['smtp_password'] = "pass"
gitlab_rails['smtp_domain'] = "mail.example.com"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
Notes about running GitLab on a Docker host with Port 80, 443 and 22 already occupied:
- GitLab must be configured to set the external ports like 9443 and/or 9080. Once you set "external_url 'https://gitlab.example.com:9443'", nginx will listen on port 9443.
- Setting the SSH port
gitlab_rails['gitlab_shell_ssh_port'] = 9022
- does only work when the port forwarding from Docker is e.g. 9022->22. 9022->9022 did not work for me.
- All these HTTP/HTTPS and SSH configured are used as ports in the GitLab user interface, e.g. in the clone URL.
- You can/should create virtual webservers on the Docker host serving port 443 and 80 and redirecting both the the external GitLab URL.
- For TLS with Let's Encrypt see TLS.
Update:
docker stop gitlab docker rm gitlab docker pull gitlab/gitlab-ce:latest docker run ...
Troubleshooting:
docker logs gitlab docker exec -it gitlab bash
Ports:
Weblinks:
TLS
- https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/
- https://webnugget.de/setting-up-gitlab-with-free-ssl-certs-from-lets-encrypt-on-ubuntu-14-04/
- https://gitlab.com/gitlab-com/blog-posts/issues/24
Help
The GitLab GUI has an excellent online help available at
http://gitlab.example.com/help
Agile Project/Product Management
Issue Boards
A feature board respective product backlog with a workflow for requirement engineering could look like:
- backlog
- new requirement
- business analysis
- technical analysis
- ready for development
- in progress
- in qa
- ready for production
- on production
- closed
This feature boards looks like following:
See also
- https://docs.gitlab.com/ee/user/project/issue_board.html
- 4 ways to use GitLab Issue Boards
- Seamless top-down and bottoms-up planning with epics and roadmap
Docker Registry
- Aufräumen:
gitlab-ctl registry-garbage-collect
Literature and Tutorials
- GitLab Cookbook
- c't 13/16 S.134
- Video Tutorial: Idea to Production on Google Container Engine (GKE)
- Continuous Integration (CI) mit Docker und GitLab: siehe LM 01/18 S.58
- GitLab CI/CD: siehe c't 25/17 S.88
- GitLab 11.0: Auto-DevOps-Feature für alle Nutzer
- GitLab automatisiert die Integration von Kubernetes
- Continuous Integration: GitLab-CI-Setup: siehe iX 08/18 S.102
- GitLab CI und CD installieren und konfigurieren: siehe iX 04/19 S.118
Tools
- RequestBin
- Testen von HTTP Requests, z.B. für den Empfang von Webhooks bei Git/GitLab.
- Siehe "GitLab Cookbook" S.113 - Using webhooks.
- RequestBin gives you a URL that will collect requests made to it and let you inspect them in a human-friendly way. Use RequestBin to see what your HTTP client is sending or to inspect and debug webhook requests.
- Postman
- REST Client, Testen von APIs
- Chrome Browser Extension
- Sendet HTTP Request zu einem Server, auch mit Parameter/Value Variablen von simulierten Formularen
- Siehe "GitLab Cookbook" S.121 - Managing your projects via the API.
Weblinks
GitLab official sites:
- GitLab Homepage
- GitLab Community Forum, see also this blog post.
- Chatroom on Gitter
- GitLab Community Edition
- GitLab Community Edition Documentation
- Installation
- GitLab Community Edition Update
- GitLab Architecture Overview
- GitLab repository on GitLab
- GitLab repository on GitHub
- GitLab Flow
Additional components:
Webcasts:
Other resources:
- Installing GitLab in your local network or your own PC and setting it up to work perfectly, with a guide to change SMTP settings
- Archlinux Wiki
- https://blog.netways.de/2012/06/29/web-oberflache-fur-git-gefallig/
- https://github.com/gitlabhq/gitlab-public-wiki/wiki/Comparison-to-other-Git-web-interfaces
- GitLab as an Alternative Development Platform for Github.com (LinuxCon Europe 2014)
Using under openSUSE:
- https://gist.github.com/rriemann/5163741
- https://gist.github.com/jniltinho/5565606
- https://github.com/n3rdbeere/Installation-guide-for-GitLab6-on-SLES11/blob/master/README.md
- http://www.badzilla.co.uk/openSUSE-12-3-Installation-of-GitLab-Nginx-Apache-and-Drupal-PHP
Continuous Integration (CI/CD):
- GitLab Continuous Integration & Deployment
- GitLab CI Quick Start
- Jenkins Integration
- JIRA Integration
- Continuous Integration of GitLab-Hosted Docker Projects with Quay.io (gitlab.com)
- GitLab Continuous Integration (pro-linux.de)
- Getting started with GitLab CI/CD and Google Cloud Platform (GitLab)
- Continuous Integration für PHP Anwendungen mit GitLab, Video
- Using GitLab CI/CD for smart home configuration management
- Demo: GitLab + Jira + Jenkins
- How to use GitLab and Ansible to create infrastructure as code
- A quick guide to GitLab CI/CD pipelines
Serverless / FaaS:
- https://about.gitlab.com/2018/12/11/introducing-gitlab-serverless/
- https://entwickler.de/online/agile/gitlab-serverless-angekuendigt-natives-faas-fuer-gitlab-579871325.html
Release Strategy:
Agile Software Development:
- How to use GitLab for Agile software development (i.e. Issue Board = Product Backlog, Milestone = Sprint, etc.)
Markdown: