我想在我的本地机器上部署应用程序.例如我的Rails APP在:
/ home / thesis / dev / myapp,但是我想要部署:安装到/ home / thesis / deploy /.我尝试过,但是capistrano尝试连接到本地主机,但根本不需要.我该如何解决?
/ home / thesis / dev / myapp,但是我想要部署:安装到/ home / thesis / deploy /.我尝试过,但是capistrano尝试连接到本地主机,但根本不需要.我该如何解决?
这里是我的deploy.rb
role :app,"localhost" role :web,"localhost" role :db,"localhost",:primary => true set(:deploy_to) { "/home/thesis/dev/myapp" } set :bundle_without,[:development,:test] set :use_sudo,false set :repository,"." set :scm,:none set :deploy_via,:copy set :copy_dir,"/home/thesis/deploy/tmp" set :copy_remote_dir,"/home/thesis/deploy/tmp"
它与:
connection Failed for: localhost (Errno::ECONNREFUSED: Connection refused - connect(2))
解决方法
localhost问题是因为您正在角色定义中进行设置.由于您在本地执行所有操作,并且由于Capistrano需要一个角色,您可以设置以下内容:
role :app,""
我也认为你正在设置copy_dir和copy_remote_dir值.我建议删除这些,并让Capistrano使用它的默认值.
这是一个完整的配置,应该适合你:
role :app,"" set :use_sudo,false set :application,'thesis' # you'll need to specify an app name set :repository,:none set :deploy_to,"/home/thesis/deploy/" # the destination dir set :deploy_via,:copy # override deploy:restart since this isn't a Rails app namespace :deploy do task :restart do # no-op end end