Source: gitlab
Severity: wishlist
Tags: patch

Hi,

please consider the attached patch to update README.Debian with more
detailed explanations of how to upgrade gitlab from non-Debian
installations.

Thanks!

cheers, josch
>From 330e5189568d7e32798cac9746c19793e3164853 Mon Sep 17 00:00:00 2001
From: Johannes Schauer <jo...@debian.org>
Date: Wed, 6 Apr 2016 13:43:12 +0200
Subject: [PATCH] debian/README.Debian: explain migration to Debian gitlab in
 more detail

---
 debian/README.Debian | 54 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 40 insertions(+), 14 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 8f2adae..7ea30bf 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -95,21 +95,47 @@ 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:
+      # su gitlab
+      $ 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:
+      # su gitlab
+      $ cd /usr/share/gitlab
+      $ export $(cat /etc/gitlab/gitlab-debian.conf)
+      $ rake gitlab:check RAILS_ENV=production
 
 Resetting admin password without web interface
 ==============================================
-- 
2.5.1

Reply via email to