Skip to content

Instantly share code, notes, and snippets.

@elferink
Forked from k-motoyan/barkeep_install.sh
Last active December 19, 2015 13:58
Show Gist options
  • Save elferink/5965418 to your computer and use it in GitHub Desktop.
Save elferink/5965418 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# works on centOS 6.3 x86_64
#
# yum update repo
yum -y update
# install needed modules (from normal repo)
yum -y install gcc-c++ kernel-devel libxslt-devel python-devel git wget make
# install latest Nginx
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum -y install nginx
# add remi repo
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
cd /usr/local/src
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh remi-release-6.rpm epel-release-6-8.noarch.rpm
# install needed modules from remi's repo
yum --enablerepo=remi -y install mysql-devel mysql-server redis
# install ruby 1.9.3-p194
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source ~/.profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
gem install bundler
rbenv rehash
# install Barkeep from github
git clone git://github.com/ooyala/barkeep.git ~/barkeep
cd ~/barkeep && bundle install && rbenv rehash
# configure Nginx for Barkeep
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.backup
cp ~/barkeep/config/system_setup_files/nginx_site.prod.conf /etc/nginx/conf.d
mv /usr/share/nginx /var/lib/nginx
mkdir /var/lib/nginx/cache
/etc/init.d/nginx restart
# create mysql database and add Barkeep data
/etc/init.d/mysqld start
mysqladmin -u root --password='' create barkeep
cd ~/barkeep && ./script/run_migrations.rb
# create upstart script
foreman export upstart upstart_scripts -a barkeep -l /var/log/barkeep -u $USER -f Procfile
mv upstart_scripts/* /etc/init
# config barkeep
cp environment.prod.rb environment.rb
cp environment.prod.sh environment.sh
echo ""
echo ""
echo ""
echo "******************************"
echo "Installation is over"
echo "You need to edit the following settings in order to use the Barkeep."
echo ""
echo "You can set the Gmail account by editing the ~/barkeep/environment.rb"
echo "GMAIL_ADDRESS = \"gmail address\""
echo "GMAIL_PASSWORD = \"gmail password\""
echo ""
echo "Edit ~/barkeep/bin/run_app.bash"
echo "bundle exec unicorn -c config/unicorn.barkeep.conf 2> >(grep --line-buffered -v \"cache_bust=\")"
echo "Change to ↓"
echo "/root/.rbenv/shims/bundle exec unicorn -c config/unicorn.barkeep.conf 2> >(grep --line-buffered -v \"cache_bust=\")"
echo ""
echo "Start by running:"
echo " start barkeep"
echo "******************************"
@santoshkt
Copy link

mysql and foreman installation could be part of this install script, if they don't exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment