Skip to content

Instantly share code, notes, and snippets.

@Austex
Last active May 28, 2019 15:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Austex/dd4ec3eb9547d55a96f389feb257c2ec to your computer and use it in GitHub Desktop.
Save Austex/dd4ec3eb9547d55a96f389feb257c2ec to your computer and use it in GitHub Desktop.
Capistrano deploy webpacker:install error - Webpack binstubs not found. Have you run rails webpacker:install ?
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
DEBUG [6d67c844] Running [ -d ~/.rvm ] on 138.197.99.1
DEBUG [6d67c844] Command: [ -d ~/.rvm ]
DEBUG [6d67c844] Finished in 1.312 seconds with exit status 1 (failed).
DEBUG [2be79dee] Running [ -d /usr/local/rvm ] on 138.197.99.1
DEBUG [2be79dee] Command: [ -d /usr/local/rvm ]
DEBUG [2be79dee] Finished in 0.213 seconds with exit status 0 (successful).
DEBUG [5e5fabda] Running /usr/local/rvm/bin/rvm version on 138.197.99.1
DEBUG [5e5fabda] Command: /usr/local/rvm/bin/rvm version
DEBUG [5e5fabda] rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
DEBUG [5e5fabda]
DEBUG [5e5fabda] Finished in 0.665 seconds with exit status 0 (successful).
rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
DEBUG [c937a780] Running /usr/local/rvm/bin/rvm current on 138.197.99.1
DEBUG [c937a780] Command: /usr/local/rvm/bin/rvm current
DEBUG [c937a780] ruby-2.3.4
DEBUG [c937a780] Finished in 0.560 seconds with exit status 0 (successful).
ruby-2.3.4
DEBUG [777cf0b0] Running /usr/local/rvm/bin/rvm default do ruby --version on 138.197.99.1
DEBUG [777cf0b0] Command: /usr/local/rvm/bin/rvm default do ruby --version
DEBUG [777cf0b0] ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
DEBUG [777cf0b0]
DEBUG [777cf0b0] Finished in 0.941 seconds with exit status 0 (successful).
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
INFO [dd007e65] Running /usr/bin/env mkdir -p /tmp/signal0x/ on 138.197.99.1
DEBUG [dd007e65] Command: /usr/bin/env mkdir -p /tmp/signal0x/
INFO [dd007e65] Finished in 0.220 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/signal0x/nvm-exec.sh 0.0%
INFO Uploading /tmp/signal0x/nvm-exec.sh 100.0%
INFO [a5e0b490] Running /usr/bin/env chmod +x /tmp/signal0x/nvm-exec.sh on 138.197.99.1
DEBUG [a5e0b490] Command: /usr/bin/env chmod +x /tmp/signal0x/nvm-exec.sh
INFO [a5e0b490] Finished in 0.243 seconds with exit status 0 (successful).
DEBUG [47dc8f11] Running [ -d $HOME/.nvm/v8.5.0 ] || [ -d $HOME/.nvm/versions/node/v8.5.0 ] on 138.197.99.1
DEBUG [47dc8f11] Command: [ -d $HOME/.nvm/v8.5.0 ] || [ -d $HOME/.nvm/versions/node/v8.5.0 ]
DEBUG [47dc8f11] Finished in 0.189 seconds with exit status 0 (successful).
Environment
Ruby ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]
Rubygems 2.6.13
Bundler 1.15.4
Command /Users/sid/.rvm/gems/ruby-2.3.4/bin/cap production doctor
Gems
capistrano 3.9.1
airbrussh 1.3.0
rake 12.1.0
sshkit 1.14.0
net-ssh 4.2.0
capistrano-bundler 1.2.0
capistrano-nvm 0.0.7
capistrano-rails 1.3.0
capistrano-rvm 0.1.2
capistrano-yarn 2.0.2
capistrano3-puma 3.1.1
Variables
:application "signal0x"
:assets_prefix "assets"
:assets_roles [:web]
:branch :master
:bundle_bins ["gem", "rake", "rails", "puma", "pumactl"]
:bundle_flags "--deployment --quiet"
:bundle_path #<Pathname:/home/root/apps/signal0x/shared/bundle>
:bundle_roles :all
:bundle_servers [#<Capistrano::Configuration::Server:0x007fd0592a9d20 @keys=[], @local=false, @user=nil, @hostname="138.197.99.1", @port=22, @properties=#<Capistrano::Configuration::Server::Properties:0x007fd0592a9938 @properties={:primary=>true}, @roles=#<Set: {:web, :app, :db}>>>]
:bundle_without "development test"
:chruby_map_bins ["puma", "pumactl"]
:conditionally_migrate false
:default_env {:node_version=>"v8.5.0"}
:deploy_to "/home/root/apps/signal0x"
:format :pretty
:git_environmental_variables {:git_askpass=>"/bin/echo", :git_ssh=>"/tmp/git-ssh-signal0x-production-sid.sh"}
:git_shallow_clone false
:git_wrapper_path "/tmp/git-ssh-signal0x-production-sid.sh"
:keep_releases 5
:linked_dirs ["bin", "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle", "public/system", "node_modules", "client/node_modules", "public/assets"]
:local_user "sid"
:log_level :debug
:migration_role :db
:migration_servers #<Capistrano::Configuration::Server:0x007fd0592a9d20 @keys=[], @local=false, @user=nil, @hostname="138.197.99.1", @port=22, @properties=#<Capistrano::Configuration::Server::Properties:0x007fd0592a9938 @properties={:primary=>true}, @roles=#<Set: {:web, :app, :db}>>>
:nvm_map_bins ["node", "npm", "yarn"]
:nvm_node "v8.5.0"
:nvm_node_path ["$HOME/.nvm/v8.5.0", "$HOME/.nvm/versions/node/v8.5.0"]
:nvm_path "$HOME/.nvm"
:nvm_prefix "/tmp/signal0x/nvm-exec.sh"
:nvm_roles :all
:nvm_type :user
:pty true
:puma_access_log "/home/root/apps/signal0x/current/log/puma.error.log"
:puma_bind "unix:///home/root/apps/signal0x/shared/tmp/sockets/signal0x-puma.sock"
:puma_conf "/home/root/apps/signal0x/shared/puma.rb"
:puma_control_app false
:puma_daemonize false
:puma_default_control_app "unix:///home/root/apps/signal0x/shared/tmp/sockets/pumactl.sock"
:puma_env :production
:puma_error_log "/home/root/apps/signal0x/current/log/puma.access.log"
:puma_init_active_record true
:puma_pid "/home/root/apps/signal0x/shared/tmp/pids/puma.pid"
:puma_preload_app true
:puma_rackup "/home/root/apps/signal0x/current/config.ru"
:puma_role :app
:puma_state "/home/root/apps/signal0x/shared/tmp/pids/puma.state"
:puma_tag ""
:puma_threads [4, 16]
:puma_workers 0
:rails_env :production
:rbenv_map_bins ["puma", "pumactl"]
:repo_url "git@github.com:Gennovacap-Technology/signal0x.git"
:rvm_map_bins ["gem", "rake", "ruby", "bundle", "puma", "pumactl"]
:rvm_path "/usr/local/rvm"
:rvm_ruby_version "default"
:rvm_type :auto
:ssh_options {:user=>"root", :keys=>["~/.ssh/id_rsa"], :forward_agent=>true}
:stage :production
:tmp_dir "/tmp"
:user "root"
:yarn_bin :yarn
:yarn_flags "--production --silent --no-progress"
:yarn_prune_flags ""
:yarn_roles :all
Servers (1)
138.197.99.1:22 [:web, :app, :db] { :primary => true }
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require "capistrano/rvm"
require 'capistrano/nvm'
require 'capistrano/yarn'
# require "capistrano/rbenv"
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/puma"
install_plugin Capistrano::Puma
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
# require "capistrano/passenger"
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
# config valid only for current version of Capistrano
lock "3.9.1"
server '138.197.99.1', port: 22, roles: [:web, :app, :db], primary: true
set :application, "signal0x"
set :repo_url, "git@github.com:Gennovacap-Technology/signal0x.git"
set :user, 'root'
set :puma_threads, [4, 16]
set :puma_workers, 0
# Don't change these unless you know what you're doing
set :pty, true
set :stage, :production
set :deploy_to, "/home/#{fetch(:user)}/apps/#{fetch(:application)}"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log, "#{release_path}/log/puma.access.log"
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }
set :puma_preload_app, true
set :puma_init_active_record, true # Change to false when not using ActiveRecord
## Add node and yarn
set :nvm_type, :user # or :system, depends on your nvm setup
set :nvm_node, 'v8.5.0'
set :nvm_map_bins, %w{node npm yarn}
set :yarn_flags, '--production --silent --no-progress' # default
set :yarn_roles, :all # default
## Defaults:
set :scm, :git
set :branch, :master
set :format, :pretty
set :log_level, :debug
set :keep_releases, 5
## Linked Files & Directories (Default None):
# set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system node_modules client/node_modules}
namespace :puma do
desc 'Create Directories for Puma Pids and Socket'
task :make_dirs do
on roles(:app) do
execute "mkdir #{shared_path}/tmp/sockets -p"
execute "mkdir #{shared_path}/tmp/pids -p"
end
end
before :start, :make_dirs
end
namespace :deploy do
desc "Make sure local git is in sync with remote."
task :check_revision do
on roles(:app) do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
before :starting, :check_revision
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :restart
end
set :ssh_options, {
user: fetch(:user),
keys: %w(~/.ssh/id_rsa),
forward_agent: true,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment