Gitlab

GitLab_logo

As software developer versioning of source code is very important. Over the last years I worked with subversion and captured a lot of positive experiences with it. Last time I read an interesting article about Git and how it changed software development over the last years and so I wanted to give it a try.

I started a research about free Git server applications and finally came to GitLab. GitLab is well supported for many platforms and is used by a huge amount of popular companies. Here is a short installation guide for Ubuntu Server 14.04 LTS:

Prerequisites and Installation:

>> apt-get install curl openssh-server ca-certificates postfix >> curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash >> apt-get install gitlab-ce >> gitlab-ctl reconfigure >> gitlab-ctl restart

If the configuration process finished you can open your GitLab web site with http://your_server_name. The login credentials are:

Username: root Password: 5iveL!fe

After the first login you have to set a new password.

If you want to change the data directory or the URL you have to edit the following file entry:

/etc/gilab/gitlab.rb ... external_url 'http://your_url:your_port' ... git_data_dir "your_new_gitlab_data_dir" ...

Then run the reconfigure command:

>> gitlab-ctl reconfigure >> gitlab-ctl restart

That’s it. Now it should work. I keep you on track with my experiences of GitLab. Hints: Setting password for new user without sending an e-mail

>> gitlab-rails console production >> user = User.where(id:2).first // or try another id number >> user.password = 'secret_pass' >> user.password_confirmation = 'secret_pass' >> user.confirmation_at = '2016-01-01 00:00:00' >> user.save! >> exit

Using SSL Here is a short summary about this site:

>> mkdir -p /etc/gitlab/ssl >> chmod 700 /etc/gitlab/ssl Create certificate in ssl directory: click here  >> gitlab-ctl reconfigure >> gitlab-ctl restart

Backup

To enable localĀ backups openĀ the /etc/gitlab/gitlab.rb file and edit the following lines:

/etc/gitlab/gitlab.rb ... gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" gitlab_rails['backup_keep_time'] = 604800 # 1 week ...

Now adept the cron job to periodically create backups:

/etc/crontab ... 0 2 * * * root sudo gitlab-rake gitlab:backup:create # every day at 2 am ...

Then restart the cron jobs:

>> /etc/init.d/cron restart

In my case I also create an external backup on my plugged in external memory device. I am using rsnapshot to handle this task.

/etc/rsnapshot.conf ... snapshot_root /mnt/memstick/backups/ ... backup /var/opt/gitlab/backups/ gitlab/ ... >> rsnapsh

After modifying you should check your configuration:

>> rsnapshot configtest

Uninstall

Remove all omnibus-gitlab data >> gitlab-ctl cleanse Remove all users >> gitlab-ctl remove-accounts Uninstall gitlab >> gitlab-ctl uninstall Remove package >> dpkg -r gitlab-ce

Problem Searching

>> gitlab-rake gitlab:check