Merge branch 'master' into 'master'

Update Readme.Debian by adding bundle exec into the commands and also adding a…

See merge request ruby-team/gitlab!1
This commit is contained in:
Praveen Arimbrathodiyil 2018-08-23 13:20:24 +00:00
commit 01c3cde3f6

23
debian/README.Debian vendored
View file

@ -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 directory /usr/share/gitlab and with the environment variables from
/etc/gitlab/gitlab-debian.conf set. So above command could be run like: /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: 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 Which will output helpful diagnostics about the state of your system including
how to fix possible problems. Another one is: 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: 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 f -exec chmod 0644 {} \;
$ find /var/lib/gitlab/public/uploads -type d -not -path /var/lib/gitlab/public/uploads -exec chmod 0700 {} \; $ find /var/lib/gitlab/public/uploads -type d -not -path /var/lib/gitlab/public/uploads -exec chmod 0700 {} \;
10. Migrate the database: 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: 11. Fix hooks:
# su gitlab # su gitlab
$ /usr/share/gitlab-shell/bin/create-hooks $ /usr/share/gitlab-shell/bin/create-hooks
12. Start gitlab: 12. Start gitlab:
$ systemctl start gitlab.service $ systemctl start gitlab.service
13. Check the installation: 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 Resetting admin password without web interface
============================================== ==============================================
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 && rails console production' $ 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):001:0> user = User.where(admin: true).first
irb(main):002:0> user.password = 'secret_pass' irb(main):002:0> user.password = 'secret_pass'
irb(main):003:0> user.password_confirmation = 'secret_pass' irb(main):003:0> user.password_confirmation = 'secret_pass'
irb(main):004:0> user.save! 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