mina console
์ค๋ฅ ๋ฐ์ bash: bundle: command not found
์์ค ์ฝ๋๋ฅผ ๊ฒํ ํ๋ฉด์ ๋ฏธ๋ ์ฝ์์ด ํ๋ ์ผ์
rails c
์คํ๊ทธ๋ฌ๋ rvm ๋๋ rben์ ์ฌ์ฉํ ๋ ๋จผ์ gemset์ด ์๋ ๋ฃจ๋น ๋ฒ์ ์ ๋ก๋ํด์ผ ํฉ๋๋ค.
๋๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ ์ผ๋ค https://github.com/mina-deploy/mina/issues/476
๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ด๊ฒ์ rbenv์์ ์ ์๊ฒ ํจ๊ณผ์ ์ ๋๋ค.
```
์์
: ํ๊ฒฝ ์ํ
# rbenv๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ด๋ฅผ ์ฌ์ฉํ์ฌ rbenv ํ๊ฒฝ์ ๋ก๋ํฉ๋๋ค.
# .ruby-version ๋๋ .rbenv-version์ ์ ์ฅ์์ ์ปค๋ฐํด์ผ ํฉ๋๋ค.
ํธ์ถ:' rbenv:load '
# RVM์ ์ฌ์ฉํ๋ ๋ถ๋ค์ RVM version@gemset์ ๋ก๋ํ ๋ ์ฌ์ฉํ์ธ์.
# invoke :' rvm:use [ruby-1.9. 3-p125@default ]'
๋
desc "๋ํํ ๋ ์ผ ์ฝ์์ ์์ํฉ๋๋ค."
์์
:c => :ํ๊ฒฝ ์ํ
ํธ์ถ: '์ฝ์'
๋
```
@hovancik ๊ฐ์ฌํฉ๋๋ค. ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค.
๊ทธ๋ฌ๋ ์ด๋ป๊ฒ ๊ณ ์น ์ ์์ต๋๊น? ํดํน ์์ด ๋ฐ๋ก ์ฌ์ฉํ๋ ค๋ฉด
https://github.com/mina-deploy/mina/blob/master/docs/faq.md# --command-not-found-bundle์ ์ดํด๋ณด์ญ์์ค.
์ด๊ฒ์ ๋ํด ๋๋ ์ฌ์ ํ์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ ๊ฒฝ์ฐ์๋ bundle
๋ฅผ ์คํํ๊ธฐ ์ํด ๋จผ์ rbenv๋ฅผ ๋ก๋ํด์ผ ํ๊ธฐ ๋๋ฌธ์
๋๋ค.
$ mina console -s --trace
** Invoke console (first_time)
** Execute console
** Invoke debug_configuration_variables (first_time)
** Execute debug_configuration_variables
** Invoke run_commands (first_time)
** Execute run_commands
** Invoke environment (first_time)
** Execute environment
** Invoke rbenv:load (first_time)
** Execute rbenv:load
** Invoke nvm:load (first_time)
** Execute nvm:load
#!/usr/bin/env bash
# Executing the following via 'ssh [email protected] -i config/deployment_key -p 22 -tt':
#
echo "-----> Loading rbenv"
export RBENV_ROOT="$HOME/.rbenv"
export PATH="$HOME/.rbenv/bin:$PATH"
if ! which rbenv >/dev/null; then
echo "! rbenv not found"
echo "! If rbenv is installed, check your :rbenv_path setting."
exit 1
fi
eval "$(rbenv init -)"
echo "-----> Loading nvm"
[ -s "/home/deployer/.nvm/nvm.sh" ] && . "/home/deployer/.nvm/nvm.sh"
(cd /home/deployer/app/current && RAILS_ENV="production" bundle exec rails console && cd -)
echo "-----> Loading rbenv"
export RBENV_ROOT="$HOME/.rbenv"
export PATH="$HOME/.rbenv/bin:$PATH"
if ! which rbenv >/dev/null; then
echo "! rbenv not found"
echo "! If rbenv is installed, check your :rbenv_path setting."
exit 1
fi
eval "$(rbenv init -)"
echo "-----> Loading nvm"
[ -s "/home/deployer/.nvm/nvm.sh" ] && . "/home/deployer/.nvm/nvm.sh"
Elapsed time: 0.00 seconds
environment
์์ ์ถ๋ ฅ์์ โโ๋ณผ ์ ์๋ฏ์ด ์์
์ console
๋ค์์ ํธ์ถ๋ฉ๋๋ค. ๋ํ rbenv:load
์์
์ด ๋ ๋ฒ ํธ์ถ๋ฉ๋๋ค.
ํ์ฌ ๋๋ ์ด๋ ๊ฒ ํ๊ณ ์๋ค:
# This task is the environment that is loaded for all remote run commands, such as
# `mina deploy` or `mina rake`.
task :load_env do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .ruby-version or .rbenv-version to your repository.
invoke :'rbenv:load'
invoke :'nvm:load'
end
task environment: :load_env
task console: :load_env
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ ๋ ์ค์ฉ์ ์ธ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
๋ฏธ๋ 1.1.0 ๋์
local_environment
๋ฐ remote_environment
https://github.com/mina-deploy/mina/commit/972a26ce354e8031a0656c16783c02390c821e33
๋น์ ์ ๊ทธ๊ฒ์ ์ฌ์ฉํ ์ ์์ต๋๋ค
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๊ฒ์ rbenv์์ ์ ์๊ฒ ํจ๊ณผ์ ์ ๋๋ค.
```
์์ : ํ๊ฒฝ ์ํ
# rbenv๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ด๋ฅผ ์ฌ์ฉํ์ฌ rbenv ํ๊ฒฝ์ ๋ก๋ํฉ๋๋ค.
# .ruby-version ๋๋ .rbenv-version์ ์ ์ฅ์์ ์ปค๋ฐํด์ผ ํฉ๋๋ค.
ํธ์ถ:' rbenv:load '
# RVM์ ์ฌ์ฉํ๋ ๋ถ๋ค์ RVM version@gemset์ ๋ก๋ํ ๋ ์ฌ์ฉํ์ธ์.
# invoke :' rvm:use [ruby-1.9. 3-p125@default ]'
๋
desc "๋ํํ ๋ ์ผ ์ฝ์์ ์์ํฉ๋๋ค."
์์ :c => :ํ๊ฒฝ ์ํ
ํธ์ถ: '์ฝ์'
๋
```