i deployed my rails app to the AWS server and tried running the rake assets:precompile locally and uploading on deploy .due to the out of memory issue on the server ,
this is my deploy.rb
# config valid only for current version of Capistrano
lock '3.5.0'
set :application, 'fullpower_tee'
set :repo_url, 'git_repo' # Edit this to match your repository
set :branch, :master
set :deploy_to, '/home/deploy/fullpower_tee'
set :pty, true
set :linked_files, %w{config/database.yml config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 2
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.2.1'
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_error.log"
set :puma_error_log, "#{shared_path}/log/puma_access.log"
set :puma_role, :app
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
set :puma_threads, [0, 8]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_preload_app, false
namespace :deploy do
namespace :assets do
Rake::Task['deploy:assets:precompile'].clear_actions
desc 'Precompile assets locally and upload to servers'
task :precompile do
on roles(fetch(:assets_roles)) do
run_locally do
with rails_env: fetch(:rails_env) do
execute 'bin/rake assets:precompile'
end
end
within release_path do
with rails_env: fetch(:rails_env) do
old_manifest_path = "#{shared_path}/public/assets/manifest*"
execute :rm, old_manifest_path if test "[ -f #{old_manifest_path} ]"
upload!('./public/assets/', "#{shared_path}/public/", recursive: true)
end
end
run_locally { execute 'rm -rf public/assets' }
end
end
end
end
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
and my config/environments/production.rb
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# config.assets.precompile += %w( *.css *.js )
# Add the fonts path
config.assets.paths << "#{Rails.root}/app/assets/fonts"
# Precompile additional assets
config.assets.precompile += %w( .svg .eot .woff .ttf )
config.assets.precompile += %w( *.js )
config.assets.precompile += [ 'admin.css',
'bootstrap.css',
'dark-red-theme.css',
'style.css',
'jquery.growl.css',
'default-theme.css',
'font-awesome.css',
'jquery.simpleLens.css',
'jquery.smartmenus.bootstrap.css',
'nouislider.css',
'sequence-theme.modern-slide-in.css',
'slick.css',
'admin/app.css',
'admin/cart.css',
'admin/foundation.css',
'admin/normalize.css',
'admin/help.css',
'admin/ie.css',
'autocomplete.css',
'application.css',
'foundation.css',
'home_page.css',
'login.css',
'markdown.css',
'myaccount.css',
'normalize.css',
'pikachoose_product.css',
'product_page.css',
'products_page.css',
'shopping_cart_page.css',
'signup.css',
'site/app.css',
'sprite.css',
'tables.css',
'cupertino/jquery-ui-1.8.12.custom.css',# in vendor
'scaffold.css' # in vendor
]
and my application.rb has
config.assets.initialize_on_precompile = false
the capistrano deploy is successfully able to precompile assets locally and then uploading it to the shared/public directory , but i cannot see the assets loading on my website , been stuck in this issue since a day Please help !