capistrano-db-tasks
capistrano-db-tasks copied to clipboard
Doesn't work on winows 10 sub-systems (/usr/bin/env: ‘ruby.exe’: No such file or directory)
I'm using I'm using windows sub-system (bash - ubuntu 16.04 while i develop on windows 10 pc. I don't use windows ruby version. Instead everything is ran "inside" bash.. That includes ruby (with rvm), MySql, Redis).
Note that i replaced sensitive info bellow with <something>
.
So, when i ran cap production app:local:sync
, i expect it to use rvm and ruby in it, not ruby.exe, wich error makes me think happens (maybe i'm missing something):
>> cap production app:local:sync --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:hook (first_time)
** Invoke passenger:rvm:hook (first_time)
** Invoke passenger:test_which_passenger (first_time)
** Execute passenger:test_which_passenger
** Execute passenger:rvm:hook
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
ruby-2.3.1
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
** Invoke bundler:map_bins (first_time)
** Invoke passenger:bundler:hook (first_time)
** Execute passenger:bundler:hook
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke app:local:sync (first_time)
** Execute app:local:sync
Loading local database config
/usr/bin/env: ‘ruby.exe’: No such file or directory
cap aborted!
Error running command (status=pid 1950 exit 127): /mnt/c/Users/PragmaticEd/workspace/<name>/bin/rails runner "puts '__CAPISTRANODB_CONFIG_BEGIN_FLAG__' + ActiveRecord::Base.connection.instance_variable_get(:@config).to_yaml + '__CAPISTRANODB_CONFIG_END_FLAG__'"
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-db-tasks-0.6/lib/capistrano-db-tasks/database.rb:161:in `initialize'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-db-tasks-0.6/lib/capistrano-db-tasks/dbtasks.rb:105:in `new'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-db-tasks-0.6/lib/capistrano-db-tasks/dbtasks.rb:105:in `block (3 levels) in <top (required)>'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/airbrussh-1.3.0/lib/airbrussh/rake/context.rb:62:in `execute'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/home/pragmaticed/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-3.11.0/lib/capistrano/application.rb:14:in `run'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-3.11.0/bin/cap:3:in `<top (required)>'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/bin/cap:23:in `load'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/bin/cap:23:in `<main>'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
/home/pragmaticed/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => app:local:sync
BASH: <name> (develop) >>
Linux sub-system version:
>> cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Password for development
and production
are in database.yml
capistrano:
# config/deploy.rb
require 'capistrano-db-tasks'
# Locks
# ---------------------------------------------------------------------------------------
# Capfilelock '3.10.1' # config valid only for current version of Capistrano
set :rvm_ruby, '2.5.1p57'
# ---------------------------------------------------------------------------------------
#
# App & Repo
# ---------------------------------------------------------------------------------------
set :application, '<name>'
set :repo_url, 'git@<repo>.git'
set :keep_releases, 3
# ---------------------------------------------------------------------------------------
# capistrano-db-tasks
# ---------------------------------------------------------------------------------------
set :db_local_clean, true # if you want to remove the local dump file after loading
set :db_remote_clean, true # if you want to remove the dump file from the server after downloading
set :db_dump_dir, './db' # configure location where the dump file should be created
set :db_ignore_tables, [] # if you want to exclude table from dump
set :db_ignore_data_tables, [] # if you want to exclude table data (but not table schema) from dump
# If you want to import assets, you can change default asset dir (default = system)
# This directory must be in your shared directory on the server
set :assets_dir, %w(public/)
set :local_assets_dir, %w(public/)
# if you want to work on a specific local environment (default = ENV['RAILS_ENV'] || 'development')
# set :locals_rails_env, 'production'
# if you are highly paranoid and want to prevent any push operation to the server
set :disallow_pushing, true
# set :compressor, :bzip2 # if you prefer bzip2/unbzip2 instead of gzip
# ---------------------------------------------------------------------------------------
# Server symlinks
# ---------------------------------------------------------------------------------------
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system', 'public/uploads', 'vendor/bundle'
# append :linked_files, "config/database.yml", "config/secrets.yml"
# ---------------------------------------------------------------------------------------
namespace :deploy do
after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end
# config/deploy/production.rb
server '<ip>', user: 'deploy', roles: %w{app web db}
set :rails_env, :production
set :branch, ENV['BRANCH'] || :develop
set :deploy_to, '/var/www/<folder>'
RVM version
>> rvm -v
rvm 1.29.4 (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Ruby version:
>> ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Rails version
>> rails -v
Rails 5.1.6
capistrano-db-tasks version:
>> bundle show capistrano-db-tasks
/home/pragmaticed/.rvm/gems/ruby-2.5.1/gems/capistrano-db-tasks-0.6
Windows version:
Windows 10 (1809) (build 17763.194)