Skip to content

Commit

Permalink
specify node and rvm versions via custom alias
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBlackLight committed Nov 13, 2023
1 parent ff8ce5f commit 0886676
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@
# Default value for :log_level is :debug
set :log_level, :info

# NVM Setup, for selecting the correct node version
# NOTE: This NVM configuration MUST be configured before the RVM setup steps because:
# This works:
# nvm exec 16 ~/.rvm-alma8/bin/rvm example_app_dev do node --version
# But this does not work:
# ~/.rvm-alma8/bin/rvm example_app_dev do nvm exec 16 node --version
set :nvm_node_version, fetch(:deploy_name) # This NVM alias must exist on the server
[:rake, :node, :npm, :yarn].each do |command_to_prefix|
SSHKit.config.command_map.prefix[command_to_prefix].push("nvm exec #{fetch(:nvm_node_version)}")
end

# RVM Setup, for selecting the correct ruby version (instead of capistrano-rvm gem)
set :rvm_ruby_version, fetch(:deploy_name) # This RVM alias must exist on the server
[:rake, :gem, :bundle, :ruby].each do |command_to_prefix|
SSHKit.config.command_map.prefix[command_to_prefix].push(
"#{fetch(:rvm_custom_path, '~/.rvm')}/bin/rvm #{fetch(:rvm_ruby_version)} do"
)
end

# Default value for linked_dirs is []
set :linked_dirs,
fetch(:linked_dirs, []).push('log','tmp/pids', 'storage', 'public/feature-logos', 'node_modules', 'public/packs')
Expand Down

0 comments on commit 0886676

Please sign in to comment.