简体   繁体   English

使用capistrano和扭矩盒错误502进行轨道部署

[英]rails deployment using capistrano & torquebox error 502

I'm running a rails app using JRuby 1.7.4 (1.9.3p392) with Torquebox and trying to deploy to Digital ocean VPS, when I run 'cap deploy' everything runs perfectly fine, however when i try to go to visit the site i still see "502 Bad Gateway nginx/1.1.19 我正在使用带有Torquebox的JRuby 1.7.4(1.9.3p392)运行Rails应用程序,并尝试将其部署到Digital Ocean VPS,当我运行“ cap deploy”时,一切运行良好,但是当我尝试访问该站点时我仍然看到“ 502错误的网关nginx / 1.1.19

This is my deploy.rb file 这是我的deploy.rb文件

    `require 'torquebox-capistrano-support'
     require 'bundler/capistrano'



     # SCM
     # Update this part to match your server and location of your application code.
     server       "000.000.00.000", :web, :app, :primary => true
     set :repository, 'git@github.com:jrgrammont/EmployToy.git'
     set :branch,            "master"
     set :ssh_options, { :forward_agent => true }
     set :user,              "torquebox"
     set :scm,               :git
     set :scm_verbose,       true
     set :use_sudo,          false

     set :deploy_to, '/opt/apps/employtoy.com'
     set :torquebox_home,    "/opt/torquebox/current"
     set :jboss_init_script, "/etc/init.d/jboss-as-standalone"
     set :rails_env, 'development'
     set :app_context,       "/"
     set :app_ruby_version, '1.9'
     set :application, 'employtoy.com'

     default_environment['JRUBY_OPTS'] = '--1.9'
     default_environment['PATH'] =         '/opt/torquebox/current/jboss/bin:/opt/torquebox/current/jruby/bin:/usr/lib64/qt-  3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/root/bin'

     after 'deploy:update_code', 'deploy:assets:precompile'
     after 'deploy:update', 'deploy:resymlink', 'deploy:nginx'
     before 'deploy:finalize_update', 'deploy:assets:symlink'

     default_run_options[:pty] = true  # Must be set for the password prompt from git to   work
     set :deploy_via, :remote_cache


     namespace :deploy do
       desc "relink db directory"
        #if you use sqlite
        task :resymlink, :roles => :app do
        run "mkdir -p #{shared_path}/db; rm -rf #{current_path}/db && ln -s # {shared_path}/db #{current_path}/db && chown -R torquebox:torquebox  #{current_path}/db"
        end


     # This is a weird part. I've found that asset complation with JRuby can really hog up  the memory, which can cause the application to crash
     # when doing a deploy. So, I like to compile the assets locally and SCP them to the server instead.
     # Just make sure you've commented out the load deploy/assets in your Capfile.
     namespace :assets do
     # If you want to force the compilation of assets, just set the ENV['COMPILE_ASSETS']
       task :precompile, :roles => :web do
       force_compile = ENV['COMPILE_ASSETS']
        begin # on first deploys, there is no current_revision so an error gets raised. in  this case we want to just compile assets and upload them.
       from = source.next_revision(current_revision)
       rescue
       force_compile = true
      end
        if ( force_compile) or (capture("cd #{latest_release} && #{source.local.log(from)}  vendor/assets/ lib/assets/ app/assets/ | wc -l").to_i > 0 )
       run_locally("rake assets:clean && rake assets:precompile")
       run_locally "cd public && tar -jcf assets.tar.bz2 assets"
       top.upload "public/assets.tar.bz2", "#{shared_path}", :via => :scp
       run "cd #{shared_path} && tar -jxf assets.tar.bz2 && rm assets.tar.bz2"
       run_locally "rm public/assets.tar.bz2"
       run_locally("rake assets:clean")
     else
      logger.info "Skipping asset precompilation because there were no asset changes"
      end
    end

      task :symlink, roles: :web do
      run ("rm -rf #{latest_release}/public/assets &&
           mkdir -p #{latest_release}/public &&
           mkdir -p #{shared_path}/assets &&
           ln -s #{shared_path}/assets #{latest_release}/public/assets")
      end



      end
   end

I just ran the tutorial again...not really sure, but it looks like Capistrano is not starting Torquebox. 我只是再次运行了本教程...不确定,但似乎Capistrano没有启动Torquebox。

Try ssh'ing into the box and starting it with: sudo service jboss-as-standalone start 尝试ssh'ing进入包装盒并使用以下命令启动:sudo service jboss-as-standalone start

also look at the torquebox log at /var/log/jboss-as/console.log .. is that throwing any errors? 还可以查看/var/log/jboss-as/console.log上的扭矩盒日志。是否抛出任何错误?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM