instructions of how to upgrade from non-Debian installations

This commit is contained in:
Johannes Schauer 2016-12-08 11:44:43 +01:00 committed by Praveen Arimbrathodiyil
parent 418b1b81b1
commit edec704950

58
debian/README.Debian vendored
View file

@ -64,10 +64,7 @@ In Debian, the rake command has to be called by the gitlab user from app home
directory /usr/share/gitlab and with the environment variables from
/etc/gitlab/gitlab-debian.conf set. So above command could be run like:
# su gitlab
$ cd /usr/share/gitlab
$ export $(cat /etc/gitlab/gitlab-debian.conf)
$ rake XXX RAILS_ENV=production
$ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && export $(cat /etc/gitlab/gitlab-debian.conf) && rake XXX RAILS_ENV=production'
One useful command to run in this environment is:
@ -96,29 +93,46 @@ Migrating from non-Debian gitlab
- the repositories/ directory
- the public/uploads/ directory
- your .ssh/authorized_keys
1. Rename your old database to gitlab_production and set the user gitlab as
1. Remove the init script for your old gitlab installation, like:
$ rm /etc/init.d/gitlab
2. Install Debian gitlab:
$ apt-get install gitlab
3. Stop gitlab services:
$ systemctl stop gitlab.target
4. Rename your old database to gitlab_production and set the user gitlab as
its owner and the owner of all its tables, sequences and views
2. Copy your old repository directory to /var/lib/gitlab/repositories/
3. Copy your old public/uploads/ directory to /var/lib/gitlab/public/uploads/
4. Copy your old .ssh/authorized_keys to /var/lib/gitlab/.ssh/authorized_keys
5. Start gitlab using `systemctl start gitlab.target`
6. Check the status of your installation using gitlab:check (see section
above). The output of that command will tell you the necessary remaining
fixes. You might be told to run:
$ sudo chmod -R ug+rwX,o-rwx /var/lib/gitlab/repositories/
$ sudo -u gitlab -H /usr/share/gitlab-shell/bin/create-hooks
$ sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
See the last section of how to execute the db:migrate command.
$ su - postgres
$ psql
# drop database gitlab_production;
# alter database gitlabhq_production rename to gitlab_production;
# alter database gitlab_production owner to gitlab;
# \q
$ for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" gitlab_production` ; do psql -c "alter table \"$tbl\" owner to gitlab" gitlab_production ; done
$ for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" gitlab_production` ; do psql -c "alter table \"$tbl\" owner to gitlab" gitlab_production ; done
5. Copy your old repository directory to /var/lib/gitlab/repositories/
6. Copy your old public/uploads/ directory to /var/lib/gitlab/public/uploads/
7. Copy your old .ssh/authorized_keys to /var/lib/gitlab/.ssh/authorized_keys
8. Fix your /var/lib/gitlab/.ssh/authorized_keys to contain the right path to gitlab-shell like:
$ sed -i 's/^command="[^ ]\+gitlab-shell /command="\/usr\/share\/gitlab-shell\/bin\/gitlab-shell /' /usr/share/gitlab/.ssh/authorized_keys
9. Fix permission:
$ chown -R gitlab:gitlab /var/lib/gitlab/repositories/ /var/lib/gitlab/public/uploads/ /var/lib/gitlab/.ssh/authorized_keys
$ chmod -R ug+rwX,o-rwx /var/lib/gitlab/repositories/
$ find /var/lib/gitlab/public/uploads -type f -exec chmod 0644 {} \;
$ find /var/lib/gitlab/public/uploads -type d -not -path /var/lib/gitlab/public/uploads -exec chmod 0700 {} \;
10. Migrate the database:
$ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && export $(cat /etc/gitlab/gitlab-debian.conf) && rake db:migrate RAILS_ENV=production'
11. Fix hooks:
# su gitlab
$ /usr/share/gitlab-shell/bin/create-hooks
12. Start gitlab:
$ systemctl start gitlab.target
13. Check the installation:
$ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && export $(cat /etc/gitlab/gitlab-debian.conf) && rake gitlab:check RAILS_ENV=production'
Resetting admin password without web interface
==============================================
# su gitlab
$ cd /usr/share/gitlab
$ export $(cat /etc/gitlab/gitlab-debian.conf)
$ rails console production
$ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && export $(cat /etc/gitlab/gitlab-debian.conf) && rails console production'
irb(main):001:0> user = User.where(admin: true).first
irb(main):002:0> user.password = 'secret_pass'
irb(main):003:0> user.password_confirmation = 'secret_pass'