Skip to content

Instantly share code, notes, and snippets.

@nakamura-akifumi
Last active January 2, 2016 04:39
Show Gist options
  • Save nakamura-akifumi/8251591 to your computer and use it in GitHub Desktop.
Save nakamura-akifumi/8251591 to your computer and use it in GitHub Desktop.
enju trunk 開発環境構築用プロビジョニングスクリプトその2(ソースコード取得部)
RAILS_VERSION=3.2.19
ENJU_TRUNK_DIR=/home/vagrant/app/enju_trunk
USER=vagrant
echo "step6 : install rails"
gem install rails -v ${RAILS_VERSION} --no-rdoc --no-ri -f
echo "step7 : clone enju_trunk"
mkdir -p /home/vagrant/app
cd /home/vagrant/app
if [ -d $ENJU_TRUNK_DIR ]; then
echo "exist enju_trunk : skip."
else
git clone https://github.com/MiraitSystems/enju_trunk.git
fi
chown -R vagrant:vagrant /home/vagrant/src
chown -R vagrant:vagrant /home/vagrant/app
echo "step8 : generate new application"
su - $USER -c "cd /home/vagrant/app ; rails _${RAILS_VERSION}_ new enju_app --skip-bundle -m https://gist.github.com/nakamura-akifumi/08f1e35e6e8aea8c1b16.txt -d postgresql"
echo "step9 : setup enju_trunk"
ENJU_APP_DIR=/home/vagrant/app/enju_app
su - $USER -c "cd ${ENJU_APP_DIR} ; sed -i -e 's/username\: enju_app/username\: enju/g' config/database.yml"
# chown -R vagrant:vagrant /home/vagrant/app
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle config build.pg --with-pg-config=/usr/pgsql-9.3/bin/pg_config"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle install -j4 --path vendor/bundle"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle exec rake db:create"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle exec rails g enju_trunk:install -f"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle exec rake db:migrate"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle exec rake sunspot:solr:start"
su - $USER -c "cd ${ENJU_APP_DIR} ; bundle exec rake db:seed"
#ssh-keygen -t rsa -C "your_email@example.com"
#ssh-add id_rsa
#cd /home/vagrant/app/enju_trunk
#git remote set-url origin https://username@github.com/MiraitSystems/enju_trunk.git
# for app/enju_trunk/tmp
chown -R vagrant:vagrant /home/vagrant/app
echo "setup completed. ipaddress"
ifconfig eth1
echo "see => https://help.github.com/articles/generating-ssh-keys#platform-linux"
@nakamura-akifumi
Copy link
Author

bundle install 時に -j4 を指定。

@nakamura-akifumi
Copy link
Author

enju_trunkのURLを変更。

@nakamura-akifumi
Copy link
Author

config/database.ymlの接続ユーザの項目名が、usernameであるべきが、user_name になっていたのを修正。

@nakamura-akifumi
Copy link
Author

enju_trunk:install の実行で強制上書きオプション(-f)を追加した。

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