Skip to content

Instantly share code, notes, and snippets.

@k-motoyan
Last active December 16, 2015 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save k-motoyan/5411739 to your computer and use it in GitHub Desktop.
Save k-motoyan/5411739 to your computer and use it in GitHub Desktop.
BarkeepのCentOS用インストールスクリプト
#!/bin/bash
#
# centOS 6.3 x86_64を対象に動作します。
#
# yumリポジトリのアップデート
yum -y update
# 通常のyumリポジトリを参照する必要モジュールのインストール
yum -y install gcc-c++ kernel-devel libxslt-devel python-devel git wget make
# Nginx最新版のインストール
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum -y install nginx
# remiリポジトリ追加
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
# remiリポジトリを参照して必要なモジュールのインストール
yum --enablerepo=remi -y install mysql-devel mysql-server redis
# 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
# githubkらBarkeepをcloneしてインストール
git clone git://github.com/ooyala/barkeep.git ~/barkeep
cd ~/barkeep && bundle install && rbenv rehash
# Nginxを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
# データベースとデータの作成
/etc/init.d/mysqld start
mysqladmin -u root --password='' create barkeep
cd ~/barkeep && ./script/run_migrations.rb
# スクリプト設定
foreman export upstart upstart_scripts -a barkeep -l /var/log/barkeep -u $USER -f Procfile
mv upstart_scripts/* /etc/init
# Barkeepの設定
cp environment.prod.rb environment.rb
cp environment.prod.sh environment.sh
echo ""
echo ""
echo ""
echo "******************************"
echo "インストールが終わりました"
echo "Barkeepを利用するためには以下の設定を行う必要があります。"
echo ""
echo "~/barkeep/environment.rbを編集してGmailアカウントを設定します"
echo "GMAIL_ADDRESS = \"gmail address\""
echo "GMAIL_PASSWORD = \"gmail password\""
echo ""
echo "~/barkeep/bin/run_app.bashを編集します"
echo "bundle exec unicorn -c config/unicorn.barkeep.conf 2> >(grep --line-buffered -v \"cache_bust=\")"
echo "↓ 以下のように編集"
echo "/root/.rbenv/shims/bundle exec unicorn -c config/unicorn.barkeep.conf 2> >(grep --line-buffered -v \"cache_bust=\")"
echo ""
echo "redis-serverを起動します"
echo ""
echo "start barkeepコマンドを実行すると起動します。"
echo "******************************"
@k-motoyan
Copy link
Author

このスクリプトはCentOS6.3 64bitで動作します。
centOS6系の64bitなら動作すると思いますが、
32bitの場合はちょっと修正を加えないとインストールに失敗します。

Barkeepはgit用のコードレビューツールです。

ホームページ:
http://getbarkeep.org/

Github:
https://github.com/ooyala/barkeep

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