Ruby on rails mina部署成功,但站点没有更新?

Ruby on rails mina部署成功,但站点没有更新?,ruby-on-rails,ruby,nginx,mina,Ruby On Rails,Ruby,Nginx,Mina,我到处找了,但似乎找不到答案。我已经安装了mina,在修复了一些错误之后,我可以使用mina部署,而不会出现任何错误。但是,网站没有任何变化。该网站正在运行Ubuntu、Nginx和Unicorn require 'mina/bundler' require 'mina/rails' require 'mina/git' require 'mina/rbenv' set :rails_evn, 'production' set :domain, 'ip-address' set :deploy

我到处找了,但似乎找不到答案。我已经安装了mina,在修复了一些错误之后,我可以使用mina部署,而不会出现任何错误。但是,网站没有任何变化。该网站正在运行Ubuntu、Nginx和Unicorn

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'

set :rails_evn, 'production'
set :domain, 'ip-address'
set :deploy_to, '/home/deploy/app_name/'
set :repository, 'https://github.com/...'
set :branch, 'master'
set :user, 'deploy'
set :ssh_options, '-A'
set :forward_agent, true
set :port, '22'
set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid"
set :term_mode, nil


set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log']


task :environment do
  queue %{echo "-----> Loading environment"
#{echo_cmd %[source ~/.bashrc]}
}

  invoke :'rbenv:load'

end


task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]

  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]

  queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
  queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
  queue  %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml' and 'secrets.yml'."]

  queue %[
    repo_host=`echo $repo | sed -e 's/.*@//g' -e 's/:.*//g'` &&
    repo_port=`echo $repo | grep -o ':[0-9]*' | sed -e 's/://g'` &&
    if [ -z "${repo_port}" ]; then repo_port=22; fi &&
    ssh-keyscan -p $repo_port -H $repo_host >> ~/.ssh/known_hosts
  ]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  to :before_hook do
    # Put things to run locally before ssh
  end
  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
      invoke :'deploy:cleanup'
    end
  end
end
以下内容来自“mina部署-v”:

mina deploy -v
deploy@domain password:
-----> Loading environment
$ source ~/.bashrc
-----> Loading rbenv
$ export RBENV_ROOT="$HOME/.rbenv"
$ export PATH="$HOME/.rbenv/bin:$PATH"
$ eval "$(rbenv init -)"
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "$build_path"
$ cd "$build_path"
-----> Fetching new git commits
$ (cd "/home/deploy/app_name//scm" && git fetch "https://github.com/../.git" "master:master" --force)
Username for 'https://github.com':
Password for 'https://@github.com':
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/user/app_name
   99242a0..7169a04  master     -> master
-----> Using git branch 'master'
$ git clone "/home/deploy/app_name//scm" . --recursive --branch "master"
Cloning into '.'...
done.
-----> Using this git commit

$ git rev-parse HEAD > .mina_git_revision
$ git --no-pager log --format='%aN (%h):%n> %s' -n 1
Tabish (7169a04):
> changes to deploy.rb
$ rm -rf .git

-----> Symlinking shared paths
$ mkdir -p "./config"
$ mkdir -p "."
$ rm -rf "./config/database.yml"
$ ln -s "/home/deploy/app_name//shared/config/database.yml" "./config/database.yml"
$ rm -rf "./config/secrets.yml"
$ ln -s "/home/deploy/app_name//shared/config/secrets.yml" "./config/secrets.yml"
$ rm -rf "./log"
$ ln -s "/home/deploy/app_name//shared/log" "./log"
-----> Installing gem dependencies using Bundler
$ mkdir -p "/home/deploy/app_name//shared/bundle"
$ mkdir -p "./vendor"
$ ln -s "/home/deploy/app_name//shared/bundle" "./vendor/bundle"
$ bundle install --without development:test --path "./vendor/bundle" --deployment
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.4
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.4
Using globalid 0.3.6
Using activejob 4.2.4
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.4
Using activemodel 4.2.4
Using arel 6.0.3
Using activerecord 4.2.4
Using execjs 2.6.0
Using autoprefixer-rails 6.0.3
Using bcrypt 3.1.10
Using sass 3.4.18
Using bootstrap-sass 3.3.5.1
Using climate_control 0.0.3
Using cocaine 0.5.7
Using coffee-script-source 1.9.1.1
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.4
Using coffee-rails 4.1.0
Using orm_adapter 0.5.0
Using responders 2.1.0
Using warden 1.2.3
Using devise 3.5.1
Using font-awesome-rails 4.3.0.0
Using multi_json 1.11.2
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Using kgio 2.9.3
Using mimemagic 0.3.0
Using open4 1.3.4
Using mina 0.3.7
Using paperclip 4.3.1 from git://github.com/thoughtbot/paperclip.git (at master)
Using pg 0.18.3
Using bundler 1.10.6
Using sprockets 3.3.5
Using sprockets-rails 2.3.3
Using rails 4.2.4
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using rails_12factor 0.0.2
Using raindrops 0.14.0
Using rdoc 4.2.0
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using simple_form 3.2.0
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using unicorn 4.9.0
Bundle complete! 21 Gemfile dependencies, 69 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
-----> DB migrations unchanged; skipping DB migration
-----> Skipping asset precompilation
$ mkdir -p "/home/deploy/app_name//$build_path/public/assets"
$ cp -R "/home/deploy/app_name//current/public/assets/." "/home/deploy/app_name//$build_path/public/assets"
-----> Deploy finished
-----> Building
-----> Moving build to releases/2
$ mv "$build_path" "$release_path"
$ cd "$release_path"
-----> Build finished
-----> Launching
-----> Updating the current symlink
$ ln -nfs "$release_path" "current"
-----> Launching
$ cd "$release_path"
-----> Cleaning up old releases (keeping 5)
$ cd "/home/deploy/app_name//releases" || exit 15
$ count=`ls -1d [0-9]* | sort -rn | wc -l`
$ remove=$((count > 5 ? count - 5 : 0))
$ ls -1d [0-9]* | sort -rn | tail -n $remove | xargs rm -rf {}
-----> Done. Deployed v2
Connection to domain-name closed.
       Elapsed time: 22.24 seconds
我手动重启独角兽等,但什么也没发生。谢谢

编辑:Nginx配置:

upstream app {
        # Path to Unicorn SOCK file, as defined previously
        server unix:/home/deploy/app_name/shared/sockets/unicorn.sock fail_timeout=0;
}

server {
        listen 80;
        server_name localhost;

        root /home/deploy/app_name/public;

        try_files $uri/index.html $uri @app;

        location @app {
                proxy_pass http://app;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
        }

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

在nginx服务器块中选中此行

root home/deploy/app_name/current/public
  • (以防万一)确保在更改配置后重新启动nginx

  • 在mina日志中,您的应用程序名称后面似乎有一个额外的/。我不是Unix大师,但我知道有时候额外的/会导致问题(有时不会)。从config/deploy.rb顶部的“deploy_to”末尾删除额外的/

    设置:部署到“/home/deploy/app\u name”


  • 我刚刚检查了我的一个应用程序,它使用mina正确部署,并且没有尾随斜杠。

    我的nginx服务器块中有这一行。很抱歉,我没有根home/deploy/app\u name/current/public,但添加了“current”,它仍然不起作用。