The setup (rails7 with puma 6 on debian 11 started with systemd - all in order) is pretty straightfoward but symlink is not updated :
ls -la on the current directory show the link remains hanged at the first release:
current -> /home/deploy/production/app/releases/1
extracts from 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
I do not know how to handle this ?
During the setup time, I had created a "current" folder to test prior to deploying with mina. That caused the issue: "Current" in Mina ways is a symlink. It should not exist prior to minia setup as Mina needs to setup in a clean destination environment.
https://github.com/mina-deploy/mina/issues/79