虽然mina setup
正在运作......
$ mina setup
-----> Setting up /home/jmuheim/base
total 24
drwxr-xr-x 6 jmuheim jmuheim 4096 Mar 26 10:34 .
drwx------ 13 jmuheim jmuheim 4096 Mar 25 17:38 ..
drwxr-xr-x 2 jmuheim jmuheim 4096 Mar 25 11:48 releases
drwxr-xr-x 7 jmuheim jmuheim 4096 Mar 25 11:50 scm
drwxr-xr-x 5 jmuheim jmuheim 4096 Mar 25 11:48 shared
drwxr-xr-x 2 jmuheim jmuheim 4096 Mar 26 10:34 tmp
-----> Done.
-----> Be sure to edit 'shared/config/database.yml'.
Elapsed time: 0.00 seconds
... mina deploy
会导致错误,我不知道问题是什么:
$ mina deploy
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
Initialized empty Git repository in /home/jmuheim/base/tmp/build-13958266858113/.git/
-----> Using this git commit
Joshua Muheim (0bc8043):
> Update outdated gems
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
! ERROR: Deploy failed.
-----> Cleaning up build
bash: line 79: bundle: command not found
Unlinking current
OK
! Command failed.
Failed with status 19
似乎找不到bundle
,但是当手动SSH到服务器时,我发现它肯定存在:
$ ssh jmuheim@achernar.uberspace.de
Last login: Wed Mar 26 10:39:29 2014 from 187-44.77-83.cust.bluewin.ch
[jmuheim@achernar ~]$ gem list | grep bundler
bundler (1.6.0.rc2)
--verbose
和--trace
标记不提供更多信息:
$ mina deploy --verbose --trace
** Invoke deploy (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute deploy
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "$build_path"
$ cd "$build_path"
-----> Fetching new git commits
$ (cd "/home/jmuheim/base/scm" && git fetch "https://github.com/jmuheim/base.git" "master:master" --force)
-----> Using git branch 'master'
$ git clone "/home/jmuheim/base/scm" . --recursive --branch "master"
Initialized empty Git repository in /home/jmuheim/base/tmp/build-139582683730596/.git/
-----> Using this git commit
$ git --no-pager log --format="%aN (%h):%n> %s" -n 1
Joshua Muheim (0bc8043):
> Update outdated gems
$ rm -rf .git
-----> Symlinking shared paths
$ mkdir -p "./config"
$ mkdir -p "."
$ rm -rf "./config/database.yml"
$ ln -s "/home/jmuheim/base/shar bash: line 97: bundle: command not founde
$ ln -s "/home/jmuheim/base/shared/config/database.yml" "./config/database.yml"
$ rm -rf "./log"
$ ln -s "/home/jmuheim/base/shared/log" "./log"
-----> Installing gem dependencies using Bundler
$ mkdir -p "/home/jmuheim/base/shared/bundle"
$ mkdir -p "./vendor"
$ ln -s "/home/jmuheim/base/shared/bundle" "./vendor/bundle"
$ bundle install --without development:test --path "./vendor/bundle" --binstubs bin/ --deployment
! ERROR: Deploy failed.
-----> Cleaning up build
$ rm -rf "$build_path"
Unlinking current
$ rm -f "deploy.lock"
OK
! Command failed.
Failed with status 19
这是我的deploy.rb
:
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
set :domain, 'achernar.uberspace.de'
set :user, 'jmuheim'
set :deploy_to, '/home/jmuheim/base'
set :repository, 'https://github.com/jmuheim/base.git'
set :branch, 'master'
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'log']
# Optional settings:
# set :user, 'foobar' # Username in the server to SSH to.
# set :port, '30000' # SSH port number.
# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .rbenv-version to your repository.
# invoke :'rbenv:load'
# For those using RVM, use this to load an RVM version@gemset.
# invoke :'rvm:use[ruby-1.9.3-p125@default]'
end
# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task setup: :environment do
queue! %[mkdir -p "#{deploy_to}/shared/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
queue! %[mkdir -p "#{deploy_to}/shared/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
queue! %[touch "#{deploy_to}/shared/config/database.yml"]
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end
desc "Deploys the current version to the server."
task deploy: :environment do
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
to :launch do
queue "touch #{deploy_to}/tmp/restart.txt"
end
end
end
# For help in making your deploy script, see the Mina documentation:
#
# - http://nadarei.co/mina
# - http://nadarei.co/mina/tasks
# - http://nadarei.co/mina/settings
# - http://nadarei.co/mina/helpers
非常感谢任何帮助。
答案 0 :(得分:4)
task :environment do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .rbenv-version to your repository.
# invoke :'rbenv:load'
# For those using RVM, use this to load an RVM version@gemset.
# invoke :'rvm:use[ruby-2.0.0-p481@default]'
end
如果您使用rvm/rbenv
,请注意此处的代码
答案 1 :(得分:0)
首先,根据你使用的内容取消注释mina / rbenv或mina / rvm,然后再转到你的环境文件(在Ubuntu它的/ etc / environment中)并添加: 导出RACK_ENV ='环境,例如生产' export RAILS_ENV ='与上面相同'
然后将ruby环境文件夹添加到同一文件中的路径,对于rbenv情况我将这些添加到路径
/ usr / lcoal / rbenv / shims和/ usr / local / rbenv / bin
最终获取文件
(也不要忘记在部署之前安装js运行时,例如sudo apt-get install nodejs)