Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upgrading source installation of gitlab in one script
#!/bin/bash
set -e
version="v8.15.1"
systemctl stop gitlab
cd /home/git/gitlab
echo Stash
sudo -u git -H git stash
echo Fetch
sudo -u git -H git fetch
echo Checkout ${version}
sudo -u git -H git checkout ${version}
echo Update gitlab-shell
(
cd /home/git/gitlab-shell
sudo -u git -H git fetch
sudo -u git -H git checkout v$(cat /home/git/gitlab/GITLAB_SHELL_VERSION)
)
echo Update gitlab-workhorse
(
cd /home/git/gitlab-workhorse
sudo -u git -H git fetch
sudo -u git -H git checkout v$(cat /home/git/gitlab/GITLAB_WORKHORSE_VERSION)
)
echo "Build deps (bundle)"
gem install bundler
sudo -u git -H bundle
echo DB Migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
echo Clean assets
sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
echo Build assets
sudo -u git -H bundle exec rake assets:clean assets:precompile RAILS_ENV=production
echo Clean cache
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
echo Install new init
cd /home/git/gitlab
cp lib/support/init.d/gitlab /etc/init.d/gitlab
systemctl daemon-reload
echo Restart gitlab
systemctl start gitlab
echo Checking installation
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.