Skip to content

Instantly share code, notes, and snippets.

@anon5r
Last active December 17, 2015 16:39
Show Gist options
  • Save anon5r/5640886 to your computer and use it in GitHub Desktop.
Save anon5r/5640886 to your computer and use it in GitHub Desktop.
GitLab Auto Updater
#!/bin/sh
BRANCH=master
if [ $# -ge 1 ]; then
BRANCH=$1
fi
if [ "$SUDO_USER" != "" ] && [ "$SUDO_USER" != "git" ]; then
echo 'You are not user "git".'
export HOME=/home/git
export PATH=/home/git/.rbenv/shims:/home/git/.rbenv/bin:$PATH
alias git='sudo -u git -H git'
fi
echo "Updating Gitlab-Shell..."
cd $HOME/gitlab-shell
git checkout master && \
git pull origin master \
echo "done."
echo "Updating Gitlab..."
cd $HOME/gitlab
git checkout db/schema.rb && \
git pull origin master && \
bundle install --without development test postgres && \
bundle exec rake db:migrate RAILS_ENV=production && \
git checkout db/schema.rb ; \
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