GitLab is a web-based DevOps lifecycle tool that provides a Git–repository manager providing source repository, issue-tracking and continuous integration and deployment pipeline features, using an open-source license, developed by GitLab Inc.
GitLab has 2 version:
1. GitLab CE (Community Edition)
2. GitLab EE(Enterprise Edition)
GitLab Community Edition is an open source edition distributed under MIT License.
GitLab Enterprise Edition is built on top of Community Edition is a proprietary license with additional features.
We grow with the FOSS product. We use GitLab Community Edition. Reference: https://about.gitlab.com/solutions/open-source/
GitLab is a git repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that enables teams to perform all the tasks in a project—from project planning and source code management to monitoring and security. It allows teams to collaborate and build better software. GitLab gives you complete control over your repositories and allows you to use private repository for free.
We use GitLab Community Edition and below are the steps to help install and migrate in Ubuntu.
Install GitLab CE in Ubuntu 16.04/18.04 version
- Install all the dependencies
sudo apt-get install -y curl openssh-server ca-certificates
- Add package repositories
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
- Install GitLab CE
sudo apt-get install gitlab-ce
- Once installed, preview GitLab config file “/etc/gitlab/gitlab.rb” and update external configuration file, ssl certificate details
sudo nano /etc/gitlab/gitlab.rb
- To enable HTTPS for the domain, update the below line of code to https for example:
external_url "https://gitlab.example.com"
- Create the
/etc/gitlab/ssl
directory and copy your key and certificate here. - NOTE: Make sure you use the full certificate chain in order to prevent SSL errors when clients connect. The full certificate chain order should consist of the server certificate first, followed by all intermediate certificates, with the root CA last.
sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl
sudo cp gitlab.example.com.key gitlab.example.com.crt /etc/gitlab/ssl/
- If the
certificate.key
file is password protected, NGINX will not ask for the password when you reconfigure GitLab. To remove the password from the key, run:
openssl rsa -in certificate_before.key -out certificate_after.key
- Now, Reconfigure GitLab
sudo gitlab-ctl reconfigure
When the reconfigure finishes, your GitLab instance should be reachable at
https://gitlab.example.com
Migrate to Azure from old server in Linux
- Update old server to the latest GitLab version, to make sure that both servers have the same version/edition
sudo apt-get update
sudo apt-get install gitlab-ce
sudo gitlab-ctl reconfigure
- Create a backup using,
gitlab-rake gitlab:backup:create
- Using SCP command transfer back file to Cloud server
scp /var/opt/gitlab/backups/<*gitlab_backup>.tar <cloud user>@<cloud server ip>:/home/<cloud user>
- In Cloud server(ex: Azure server), install the latest version of GitLab as per the above instructions in “Install GitLab CE in Ubuntu 16.04/18.04 version“.
- Check the Gitlab status,
gitlab-ctl status
gitlab-ctl --version
- Post successful install, Stop the below process
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
- Restore backup file
mv /home/<user>/<gitlab_backup>.tar /var/opt/gitlab/backups/
gitlab-rake gitlab:backup:restore BACKUP=<BACKUP NAME>
- Restart GitLab and verify if all data is restored,
sudo gitlab-ctl start
ACCESS GitLab using URL:
https://gitlab.example.com