Skip to content

Commit 6ca218f

Browse files
committed
replace rvm in monit #10
1 parent 19a5974 commit 6ca218f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

monit/sidekiq/bin.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ SIDEKIQ_CONFIG_FILE={{SIDEKIQ_CONFIG_FILE}}
2828
# sidekiq log file path
2929
SIDEKIQ_LOG_FILE={{SIDEKIQ_LOG_FILE}}
3030

31+
USER_HOME="/home/${DEPLOY_USER}"
32+
RUBY_VERSION=`cat ${APP_ROOT}/.ruby-version`
33+
BUNDLE_PREFIX="RBENV_ROOT=$USER_HOME/.rbenv RBENV_VERSION=$RUBY_VERSION $USER_HOME/.rbenv/bin/rbenv exec"
3134

3235
# full command
33-
CMD="cd ${APP_ROOT} && /usr/local/rvm/bin/rvm default do bundle exec sidekiq --index 0 --pidfile ${SIDEKIQ_PID} --environment ${RAILS_ENV} --logfile ${SIDEKIQ_LOG_FILE} --config ${SIDEKIQ_CONFIG_FILE} --daemon"
36+
CMD="cd ${APP_ROOT} && ${BUNDLE_PREFIX} bundle exec sidekiq --index 0 --pidfile ${SIDEKIQ_PID} --environment ${RAILS_ENV} --logfile ${SIDEKIQ_LOG_FILE} --config ${SIDEKIQ_CONFIG_FILE} --daemon"
3437
# echo "DEBUG:"
3538
# echo $CMD
3639

monit/unicorn/bin.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ UNICORN_PID={{UNICORN_PID}}
3232
# unicorn config, 不同環境用不同檔名
3333
UNICORN_CONFIG_FILE={{UNICORN_CONFIG_FILE}}
3434

35+
USER_HOME="/home/${DEPLOY_USER}"
36+
RUBY_VERSION=`cat ${APP_ROOT}/.ruby-version`
37+
BUNDLE_PREFIX="RBENV_ROOT=$USER_HOME/.rbenv RBENV_VERSION=$RUBY_VERSION $USER_HOME/.rbenv/bin/rbenv exec"
38+
3539
# full command
36-
CMD="cd ${APP_ROOT} && ( export RAILS_ENV=\"${RAILS_ENV}\" ; /usr/local/rvm/bin/rvm default do bundle exec unicorn -c ${UNICORN_CONFIG_FILE} -E deployment -D )"
40+
CMD="cd ${APP_ROOT} && ( export RAILS_ENV=\"${RAILS_ENV}\" ; ${BUNDLE_PREFIX} bundle exec unicorn -c ${UNICORN_CONFIG_FILE} -E deployment -D )"
3741
# echo "DEBUG:"
3842
# echo $CMD
3943

0 commit comments

Comments
 (0)