Rails capistrano nginx错误与部署

时间:2016-06-08 12:46:43

标签: ruby-on-rails ruby nginx

我遇到同样的麻烦......

这是我的错误:

/home/deploy/.rvm/gems/ruby-2.3.1/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4:warning:key:在第6行重复启动并覆盖 未设置阶段,请调用诸如cap production deploy之类的内容,其中生产是您定义的阶段。

这是我使用的教程:https://gorails.com/deploy/ubuntu/14.04#ruby

这是我的capfile,

require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'

1#如果你有任何定义,从`lib / capistrano / tasks'加载自定义任务。     Dir.glob('lib / capistrano / tasks / * .cap')。每个{| r | import r}

这是我的nginx.conf:

upstream puma {
server unix:///home/deploy/ipass/shared/tmp/sockets/appname-puma.sock;
  }

server {
listen 80 default_server deferred;
1# server_name example.com;

 root /home/deploy/ipass/current/public;
 access_log /home/deploy/ipass/current/log/nginx.access.log;
 error_log /home/deploy/ipass/current/log/nginx.error.log info;

 location ^~ /assets/ {
   gzip_static on;
  expires max;
  add_header Cache-Control public;
   }

 try_files $uri/index.html $uri @puma;
location @puma {
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_redirect off;

  proxy_pass http://puma;
}

error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
 }

我不知道我必须提供更多... mb my database.yml

的database.yml

    default: &default
    adapter: mysql2
    encoding: utf8
    pool: 5
    username: root
    password: htmlkoi8r
    socket: /var/run/mysqld/mysqld.sock

  development:
    <<: *default
    database: ipass_dev
  test:
    <<: *default
    database: ipass_test


  production:
    <<: *default
    database: ipass_production

的Gemfile

source 'https://rubygems.org'


            # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
            gem 'rails', '4.2.6'

            # Servers
            gem 'puma'
            gem 'unicorn'

            # AUTH
            gem 'devise'
            gem 'cancancan', '~> 1.10'


            # Translation gems
            gem 'russian', '~> 0.6.0'

            # ORM
            gem 'mysql2', '0.4.4'
            # gem 'pg'
            gem 'seed_dump'
            # gem 'ar-octopus'
            # gem 'redis-rails'
            # gem 'redis'

            # Admin Panel
            gem 'rails_admin'
            gem 'rails_admin_flatly_theme', github: 'konjoot/rails_admin_flatly_theme'

            # Forms
            gem 'simple_form'
            #gem 'tinymce-rails'
            #gem 'tinymce-rails-langs'


            # Mail and contacts
            gem 'mail_form'

            # Other gems
            gem 'slim'  #htmlslim



            # Use SCSS for stylesheets
            gem 'sass-rails', '~> 5.0'
            # Use Uglifier as compressor for JavaScript assets
            gem 'uglifier', '>= 1.3.0'
            # Use CoffeeScript for .coffee assets and views
            gem 'coffee-rails', '~> 4.1.0'
            # See https://github.com/rails/execjs#readme for more supported runtimes
            # gem 'therubyracer', platforms: :ruby

            # Use jquery as the JavaScript library
            gem 'jquery-rails'
            # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
            gem 'jbuilder', '~> 2.0'
            # bundle exec rake doc:rails generates the API under doc/api.
            gem 'sdoc', '~> 0.4.0', group: :doc

            # Use ActiveModel has_secure_password
            # gem 'bcrypt', '~> 3.1.7'

            # Use Unicorn as the app server
            # gem 'unicorn'

            # Use Capistrano for deployment
            # gem 'capistrano-rails', group: :development

            gem 'capistrano', '~> 3.1.0'
            gem 'capistrano-bundler', '~> 1.1.2'
            gem 'capistrano-rails', '~> 1.1.1'
            gem 'capistrano-rvm', github: "capistrano/rvm"
            # Add this if you're using rbenv
            # gem 'capistrano-rbenv', github: "capistrano/rbenv"



            group :development, :test do
              # Call 'byebug' anywhere in the code to stop execution and get a debugger console
              gem 'byebug'
            end

            group :development do
              # Access an IRB console on exception pages or by using <%= console %> in views
              gem 'web-console', '~> 2.0'

              # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
              gem 'spring'
            end

1 个答案:

答案 0 :(得分:0)

我会尝试在Gemfile中删除Capistrano插件版本约束:

gem 'capistrano'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rvm'

然后运行bundle update