【问题标题】:chef rails 4 ruby 2.1 rbenv capistrano shared bin passenger file missingChef rails 4 ruby​​ 2.1 rbenv capistrano 共享 bin 乘客文件丢失
【发布时间】:2014-06-21 03:12:44
【问题描述】:

对于使用 chef 来部署我们的应用程序,我们还比较陌生。目前,我们遇到了一个奇怪的问题,但尚未找到与我们的bin/passenger 配置文件相关的解决方案。由于某种原因,当服务器是用厨师构建的时,它不存在或厨师没有创建它。也许 capistrano 没有创造它……我们对这个有点傻眼。

正如您从所附图片中看到的,我们知道该文件不存在。我们当前的所有脚本都与其他 4 个成功运行的服务器匹配,但由于某种原因,这个新版本不会创建文件。或者 TBH,我们完全遗漏了一些步骤。为了让这一切顺利进行,已经花了一些很长的夜晚。

我们使用 chef 构建服务器,我们使用 capistrano 部署到盒子

有人有什么想法吗?需要更多信息?指针?

我们当前的config/deploy.rb 文件:

set :application, 'digest'

set :scm, :git
set :repo_url, '{omitted private repo}'
set :branch, 'experiment/cap'
set :deploy_to, '/home/apps/api'

set :deploy_via, :remote_cache
set :user, 'deploy'
set :use_sudo, false

set :rbenv_type, :system
set :rbenv_ruby, '2.1.0'
set :rbenv_path, '/opt/rbenv'

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute "mkdir -p #{release_path}/tmp ; touch #{release_path}/tmp/restart.txt"
    end
  end

  desc 'Create application symlinks'
  task :symlinks do
    on roles(:app), in: :sequence, wait: 5 do
      execute "rm #{release_path}/config/database.yml"
      execute "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
      execute "ln -s #{shared_path}/config/secrets.yml #{release_path}/config/secrets.yml"
      execute "ln -s #{shared_path}/bin/passenger #{release_path}/bin/passenger"
    end
  end

  after :finishing, 'deploy:cleanup'
  after 'deploy:updated', 'deploy:symlinks'

end

namespace :setup do
  desc 'Copy the secrets.yml and database.yml files'
  task config: [ 'config/secrets.yml', 'config/database.yml' ] do |t|
    on roles(:all) do
      execute "mkdir -p #{shared_path}/config"
      t.prerequisites.each do |file|
        upload! file, "#{shared_path}/config"
      end
    end
  end
end

在我们的config/deploy/staging.rb 文件中:

set :stage, :staging

# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary
# server in each group is considered to be the first
# unless any hosts have the primary property set.
role :app, %w{deploy@208.94.36.146}
role :web, %w{deploy@208.94.36.146}

set :rails_env, "staging"

我们的登台服务器 bin 文件夹:

您可以看到应用程序正在使用当前版本设置进入框:

我们当前在服务器上的应用程序:

我们当前的应用config目录:

【问题讨论】:

  • 我有点困惑。您是在使用 Chef 进行部署还是设置上限?
  • @coderanger 我刚刚更新以使其更加清晰。我们使用 chef 构建服务器,并使用 cap 部署到 box。

标签: ruby-on-rails ruby capistrano passenger chef-infra


【解决方案1】:

我假设乘客不在 Gemfile 中,这会导致 binstub 无法创建。是这个问题吗?

【讨论】:

    猜你喜欢
    • 2013-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    • 2017-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多