Error ""The directory 'X' does not exist on the server", run 'mina setup' first!
jmuheim opened this issue · comments
I need to deploy a new version of a Rails app.
I did not succeed yet, because of this:
Gem::InstallError: mobility requires Ruby version >= 2.3.7.
Using css_parser 1.7.0
An error occurred while installing sassc (2.0.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.0.1'` succeeds before bundling.
! ERROR: Deploy failed.
I looked at RVM on the server:
$ rvm list
rvm rubies
ruby-2.2.5 [ x86_64 ]
ruby-2.3.1 [ x86_64 ]
=* ruby-2.4.1 [ x86_64 ]
Looks all good to me, so I wanted to check the mina log, where I see a lot of "The directory '/home/www-data/XXX/rails/shared/vendor/YYY' does not exist on the server"
errors:
$ mina deploy --verbose
-----> Ensuring everyting is pushed to git
$ if [ $(git log origin/master..master | wc -l) -ne 0 ]; then
echo "! Your branch master needs to be pushed to origin before deploying"
exit 1
fi
Elapsed time: 0.02 seconds
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "$build_path"
$ cd "$build_path"
-----> Fetching new git commits...
-----> Symlinking shared paths
$ if [ ! -d "/home/www-data/XXX/rails/shared/vendor/bundle" ]; then
echo "! ERROR: not set up."
echo "The directory '/home/www-data/XXX/rails/shared/vendor/bundle' does not exist on the server"
echo "You may need to run 'mina setup' first"
exit 18
fi
$ mkdir -p ./vendor
$ rm -rf "./vendor/bundle"
$ ln -s "/home/www-data/XXX/rails/shared/vendor/bundle" "./vendor/bundle"
$ if [ ! -d "/home/www-data/XXX/rails/shared/log" ]; then
echo "! ERROR: not set up."
echo "The directory '/home/www-data/XXX/rails/shared/log' does not exist on the server"
echo "You may need to run 'mina setup' first"
exit 18
fi
$ mkdir -p .
$ rm -rf "./log"
$ ln -s "/home/www-data/XXX/rails/shared/log" "./log"
$ if [ ! -d "/home/www-data/XXX/rails/shared/tmp/cache" ]; then
echo "! ERROR: not set up."
echo "The directory '/home/www-data/XXX/rails/shared/tmp/cache' does not exist on the server"
echo "You may need to run 'mina setup' first"
exit 18
fi
I have no idea why these errors are displayed, because the respective folders actually do exist on the server:
$ /home/www-data/XXX/rails/shared/log
-bash: /home/www-data/XXX/rails/shared/log: Is a directory
Also running $ mina setup
again doesn't solve this.
I also have no idea why Mina is not taking the default Ruby (2.4.1) when installing gems?
Can anyone please give some support here? Thank you.
in deploy.rb
task :remote_environment do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .ruby-version or .rbenv-version to your repository.
# invoke :'rbenv:load'
# For those using RVM, use this to load an RVM version@gemset.
# invoke :'rvm:use', 'ruby-1.9.3-p125@default'
invoke :'rvm:use', 'ruby-2.4.1@default'
end
I debugged a lot of stuff, and it seems to me that there's a problem somewhere deeper.
I tried with both rbenv and RVM, and it didn't work. Both of them produce this error:
Installing mobility 0.8.7
Gem::InstallError: mobility requires Ruby version >= 2.3.7.
Using css_parser 1.7.0
An error occurred while installing sassc (2.0.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.0.1'` succeeds before bundling.
! ERROR: Deploy failed.
What makes me really suspicious is that RVM seems to be loaded correctly with Ruby 2.4.1:
-----> Using RVM environment "ruby-2.4.1@staging-audit"
ruby-2.4.1 - #gemset created /home/www-data/.rvm/gems/ruby-2.4.1@staging-audit
ruby-2.4.1 - #generating staging-audit wrappers..........
Using /home/www-data/.rvm/gems/ruby-2.4.1 with gemset staging-audit
So why is bundler complaining about mobility requires Ruby version >= 2.3.7
?
Here's the current version of my script:
require 'mina/rails'
require 'mina/git'
require 'mina/puma'
require 'mina/rvm' # for rvm support. (https://rvm.io)
set :application_name, 'A4AA 2.0'
set :domain, 'zugangfueralle01.nine.ch'
set :deploy_to, '/home/www-data/staging-audit.access4all.ch/rails'
set :repository, 'git@github.com:Access4all/a4aa2.git'
set :branch, 'master-nine'
set :user, 'www-data' # Username in the server to SSH to.
set :forward_agent, true # SSH forward_agent.
set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp', 'public/uploads', 'shared/tmp/sockets', 'shared/tmp/pids')
set :shared_files, fetch(:shared_files, []).push('config/secrets.yml')
task :remote_environment do
invoke :'rvm:use', 'ruby-2.4.1@staging-audit'
end
task :setup do
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
invoke :'puma:phased_restart'
end
end
end
I have both .ruby-version
and .ruby-gemset
pushed to the repo. When I tried setting a non-sense value like asdf
to .ruby-version
, neither rbenv nor RVM complained. As far as I understand, at least rbenv should take its version information from these files...?
Thanks for any help.
task :setup do
command %{rvm install ruby-2.4.1}
command %{gem install bundler}
end
try update your :setup and run mina setup
Hey guys
Thanks for helping me. I successfully deployed up to the step where Mina would start Puma server. I'm using https://github.com/untitledkingdom/mina-puma for this, I will ask for help there.
All the best.