From 30f4a86af1b4b00411ec225b22c5c0b1d9caa488 Mon Sep 17 00:00:00 2001 From: pavi Date: Thu, 23 Aug 2018 13:06:12 +0000 Subject: [PATCH] Update Readme.Debian by adding bundle exec into the commands and also adding a way to grant admin access for existing user. --- debian/README.Debian | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index dff8a91240..26acf464ed 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -64,16 +64,16 @@ 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: - $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && rake XXX RAILS_ENV=production' + $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && bundle exec rake XXX RAILS_ENV=production' One useful command to run in this environment is: - $ rake gitlab:check RAILS_ENV=production + $ bundle exec rake gitlab:check RAILS_ENV=production Which will output helpful diagnostics about the state of your system including how to fix possible problems. Another one is: - $ rake gitlab:env:info RAILS_ENV=production + $ bundle exec rake gitlab:env:info RAILS_ENV=production To see service status with systemd, you can use: @@ -120,20 +120,29 @@ Migrating from non-Debian gitlab $ 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 && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && rake db:migrate RAILS_ENV=production' + $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && bundle exec rake db:migrate RAILS_ENV=production' 11. Fix hooks: # su gitlab $ /usr/share/gitlab-shell/bin/create-hooks 12. Start gitlab: $ systemctl start gitlab.service 13. Check the installation: - $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && rake gitlab:check RAILS_ENV=production' + $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && bundle exec rake gitlab:check RAILS_ENV=production' Resetting admin password without web interface ============================================== - - $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && rails console production' +The steps involve dropping into rails console as gitlab user for production environment and then resetting the admin password via the user object. + $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && bundle exec 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' irb(main):004:0> user.save! + +Granting an existing user admin access +====================================== +The steps involve dropping into rails console as gitlab user for production environment and running the commands on the user object. + $ runuser -u gitlab -- sh -c 'cd /usr/share/gitlab && . /etc/gitlab/gitlab-debian.conf && export DB RAILS_ENV && bundle exec rails console production' + irb(main):001:0> user = User.find_by(email: 'useraddress@domain') + irb(main):002:0> user.admin=true + irb(main):003:0> user.admin=true + irb(main):004:0> user.save \ No newline at end of file