Skip to content

Instantly share code, notes, and snippets.

@zehome
Created December 26, 2016 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zehome/8e0469b1bdbf8f9349166937c6c25bc2 to your computer and use it in GitHub Desktop.
Save zehome/8e0469b1bdbf8f9349166937c6c25bc2 to your computer and use it in GitHub Desktop.
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