11
votes

I'm researching the process of migrating GitLab from an old server to a new server. One of the first things I need to do is determine which installation GitLab is in (Omnibus vs. source), and I'm unable to tell.

This post (omnibus or source - can't decide which one to use for gitllab backup/restore) mentions looking for a .git file in the GitLab root folder (/home/git/gitlab) - I don't see a .git file there. So, by that comment the installation was Omnibus.

However, looking at this post (Checking of GitLab version), I'm unable to run:

sudo gitlab-rake gitlab:env:info (shown for Omnibus installation)

But I can run:

bundle exec rake gitlab:env:info RAILS_ENV=production (shown for source installation)

I'm seeing conflicting answers. How can I tell which installation GitLab is in?

In any case, when I run the last command, I get the following results (if it helps):

System information System: Debian 7.10 Current User: git Using RVM: no Ruby Version: 2.0.0p247 Gem Version: 2.0.3 Bundler Version:1.7.2 Rake Version: 10.1.0

GitLab information Version: 6.0.2 Revision: 10b0b8f Directory: /home/git/gitlab DB Adapter: mysql2 URL: http://107.178.218.39 HTTP Clone URL: http://107.178.218.39/some-project.git SSH Clone URL: [email protected]:some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 1.7.0 Repositories: /home/git/repositories/ Hooks: /home/git/gitlab-shell/hooks/ Git: /usr/bin/git

1
My guess is that if the person didn't clone the git repo to download the source, but instead downloaded a zip file, there won't be a .git file even though it wasn't the OmniBus installation...Just a thought of why the .git strategy might not be reliable.Dogs
Hmmm I'm not sure. Unfortunately the person who set everything up isn't around anymore, so it makes things a bit challenging on that front.Dexter J.

1 Answers

13
votes

You should Check this file is available:

/etc/gitlab/gitlab.rb

If not then it installed from source. My advice is to change your install to a omnibus install, it makes it much easier to upgrade.

Read this for more info about upgrading to omnibus installation: https://docs.gitlab.com/omnibus/update/README.html#upgrading-from-a-non-omnibus-installation-to-an-omnibus-installation

Update 1

Note if MySQL is used as a database you have to do a conversion see the documentation https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/mysql_to_postgresql.md

To upgrade a installation from source, you have 2 options:

Make sure you have an omnibus-gitlab package matching your current GitLab version. (If possible I would upgrade for the last time from source)

1. Install gitlab with omnibus on the same server.

Before you begin, make a snapshot from the server to be sure you can always return to a working point. Also make sure the shutdown gitlab.

You should install gitlab by using the omnibus option:

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

The omnibus en the source install can be installed at the same time on the server. You can always change back yo the source install if something goes wrong.

Then following the instruction in the documentation: https://docs.gitlab.com/omnibus/update/README.html#upgrading-from-non-omnibus-postgresql-to-an-omnibus-installation-in-place

2. Install gitlab by backup.

When you use a backup you can even transfer you gitlab installation to a new server. I used this way, and it was very easy.

Before you make your backup, shutdown gitlab so you can be sure there is nothing changed between your backup and restore process

To start, make a backup:

sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

See also the documenation this coverage to much info to put here.

After that you can move you backup to the new gitlab server or use it later to import it.

To import it in the omnibus install (in short, but read the documentation):

sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status

sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186

sudo gitlab-ctl start
sudo gitlab-rake gitlab:check SANITIZE=true

Since you say it is about a live environment. You can do the following, setup a tiny server/ or on you local machine to do upgrade the process so you feel comfortable with it. After that you can do the same on the live env.