forked from livingsocial/resque-web
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Still Requires Asset Pipeline on Server when not using the rails asset pipeline #117
Comments
This was referenced Aug 31, 2016
I just tried this as a fix :
with no luck as that tosses a 404 via NGINX and trying this: https://github.com/heroku/rails_serve_static_assets |
This is how I fixed this.. but there has to be a better way... ... and it still does not capture everything...
deploy.rb desc 'Resque Assets'
task :assets do
on roles(:app), in: :sequence, wait: 5 do
within(release_path) do
with rails_env: fetch(:rails_env) do
execute :rake, 'assets:precompile', '--trace'
execute :rake, 'resque:assets:setup', '--trace'
end
end
end
end
after 'deploy:finished', 'deploy:assets' resque.rake require 'resque/tasks'
require 'resque/scheduler/tasks'
# FYI: https://github.com/resque/resque-scheduler
# FYI: https://gist.github.com/snatchev/1316470
# FYI: http://stackoverflow.com/questions/2611747/rails-resque-workers-fail-with-pgerror-server-closed-the-connection-unexpectedl
namespace :resque do
desc 'Setup Resque'
task setup: :environment do
require 'resque'
# Resque.redis : Configured in config/initializers/resque.rb
ENV['QUEUE'] ||= '*'
end
task setup_schedule: :setup do
require 'resque-scheduler'
Resque.schedule = YAML.load_file('resque_schedule.yml')
end
task scheduler: :setup_schedule
namespace :cache do
desc 'Clears Rails cache'
task clear: :environment do
Rails.cache.clear
end
end
namespace :assets do
desc 'Fix Resque Web Assets as a Microservice'
task setup: :environment do
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
assets.each do |file|
next if File.directory?(file) || file !~ regex
source = file.split('/')
source.push(source.pop.gsub(regex, '.'))
non_digested = File.join(source)
FileUtils.mv(file, non_digested)
end
new_asset_path = "#{Rails.root}/public"
FileUtils.mkdir("#{new_asset_path}/images")
FileUtils.mkdir("#{new_asset_path}/stylesheets")
FileUtils.mkdir("#{new_asset_path}/javascripts")
FileUtils.mkdir("#{new_asset_path}/images/resque_web")
FileUtils.mkdir("#{new_asset_path}/stylesheets/resque_web")
FileUtils.mkdir("#{new_asset_path}/javascripts/resque_web")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.png"), "#{new_asset_path}/images/resque_web/")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.js"), "#{new_asset_path}/javascripts/resque_web/")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.js.gz"), "#{new_asset_path}/javascripts/resque_web/")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.css"), "#{new_asset_path}/stylesheets/resque_web/")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.css.gz"), "#{new_asset_path}/stylesheets/resque_web/")
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.svg"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.svg.gz"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.eot"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.eot.gz"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.ttf"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.ttf.gz"), new_asset_path)
FileUtils.mv(Dir.glob("#{Rails.root}/public/assets/**/*.woff"), new_asset_path)
FileUtils.rm_rf("#{new_asset_path}/assets")
end
end
end |
This still seems to be broken for me on Rails 6:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed Locally here: #111
Now the server is not working. Thoughts?
The text was updated successfully, but these errors were encountered: