Hi, On Sun, 08 May 2016 12:50:41 +0200 Johannes Schauer <[email protected]> wrote: > please consider the attached patch to update README.Debian with more detailed > explanations of how to upgrade gitlab from non-Debian installations.
I updated the patch to use runuser instead of su. Please find it attached. Thanks! cheers, josch
From ff6ce75c34e62e7be22fd6bf514107adbd4f5634 Mon Sep 17 00:00:00 2001 From: Johannes Schauer <[email protected]> Date: Thu, 8 Dec 2016 11:44:43 +0100 Subject: [PATCH] instructions of how to upgrade from non-Debian installations --- debian/README.Debian | 58 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index 8ac6063..bbfa3fa 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -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' -- 2.9.3
signature.asc
Description: signature
_______________________________________________ Pkg-ruby-extras-maintainers mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ruby-extras-maintainers
