ruby-on-rails Rails 7 Puma 6 & Mina设置:Mina无法使用新版本更新服务器

uurity8g  于 2023-04-22  发布在  Ruby
关注(0)|答案(1)|浏览(172)

设置(debian 11上的rails 7和puma 6从systemd开始-所有都是有序的)非常简单,但符号链接没有更新:
ls -la在当前目录上显示链接在第一次发布时仍然挂起:
当前-〉/home/deploy/production/app/releases/1
来自deploy.rb的摘录

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

set :forward_agent, true
set :rbenv_use_path, '/home/deploy/.rbenv/bin/rbenv'

set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/pids', 'tmp/sockets', 'public/assets')
set :shared_files, fetch(:shared_files, []).push('config/database.yml', 
                                                'config/master.key', 
                                                'config/credentials/production.key' )

task :remote_environment do
  invoke :'rbenv:load'
end

task :setup do
  
  in_path(fetch(:shared_path)) do
    command %[mkdir -p config]
    command %[touch "#{fetch(:shared_path)}/config/database.yml"]
    command %[touch "#{fetch(:shared_path)}/config/puma.rb"]
    command %[chmod -R o-rwx config]
  end

end

desc "Deploys the current version to the server."
task :deploy do
  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      in_path(fetch(:current_path)) do
        command %{mkdir -p tmp/}
        command %{touch tmp/restart.txt}
        command %{sudo service puma restart}
        command %{sudo service sidekiq restart}
      end
    end
  end
end

mina deploy verbose:

-----> Deploy finished
-----> Building
-----> Moving build to /home/deploy/production/app/releases/3
       $ mv "$build_path" "$release_path"
       $ cd "$release_path"
-----> Build finished
-----> Launching
-----> Updating the /home/deploy/production/app/current symlink
       $ ln -nfs "$release_path" "/home/deploy/production/app/current"
       $ cd "/home/deploy/production/app/current"
       $ cd /home/deploy/production/app/current
       $ mkdir -p tmp/
       $ touch tmp/restart.txt
       $ sudo service puma restart
       $ sudo service sidekiq restart
       /homedeploy/production/app/current
-----> Done. Deployed version 3

我不知道该怎么办?

ppcbkaq5

ppcbkaq51#

在安装过程中,我创建了一个“当前”文件夹,以便在使用mina部署之前进行测试。这导致了问题:“Current”在Mina中是一个符号链接。在mina安装之前它不应该存在,因为Mina需要在一个干净的目标环境中安装。
https://github.com/mina-deploy/mina/issues/79

相关问题