gunpowderlabs / buildpack-ruby-rake-deploy-tasks Goto Github PK
View Code? Open in Web Editor NEWRun arbitrary rake tasks on deploy to Heroku
License: MIT License
Run arbitrary rake tasks on deploy to Heroku
License: MIT License
I haven't had luck running more than 1 rake task.
Given:
DEPLOY_TASKS="tmp:clear assets:clobber"
On deploy, when it runs the rake task I get the equivalent of:
Don't know how to build task 'tmp:clear assets:clobber'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/task_manager.rb:62:in `[]'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:149:in `invoke_task'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/Users/ubuntu/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/Users/ubuntu/.rubies/ruby-2.2.4/bin/rake:33:in `<main>'
Either of these work:
DEPLOY_TASKS="tmp:clear"
DEPLOY_TASKS="assets:clobber"
This is what I'm seeing when deploying. I'm using Rails 5.0.0.1.
I'm suspecting it may have something to do with the binstubs, but they are the default ones. Nothing special there.
-----> Rake app detected
/tmp/{redacted}/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
from /tmp/{redacted}/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/{redacted}/config/boot.rb:6:in `<top (required)>'
from bin/rake:2:in `require_relative'
from bin/rake:2:in `<main>'
! Push rejected, failed to compile Rake app.
! Push failed
Used your instructions exactly, Ruby buildpack works and then this:
-----> Fetching set buildpack https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks... done
! Push rejected, failed to detect set buildpack https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks
Can we recommend people use release phase in the readme? https://devcenter.heroku.com/articles/release-phase
I have several Rack apps I'm deploying on Heroku, and when using this buildpack as described in the readme, deployments started failing with
...
rake aborted!
Don't know how to build task 'default'
...
In my Rakefile I have
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
end
and when I run bundle exec rake or bundle exec rake default, it works locally (obviously not using the buildpack).
Could this be an issue with the buildpack, or am I just doing it wrong?
I ran into this problem when deploying a new instance of a Rails app that uses this buildpack to run migrations on deployment. The database doesn't appear to be available when it's first deployed/compiled. See https://gist.github.com/chrisroos/57b7c4d7750cdbc0fb96a131403526da for the output.
Have you come across this before, and if so have you found a workaround?
As an aside, while investigating this problem I came across Heroku Release Phase which seems suited to running these sort of tasks (rake db:migrate
) after a successful deployment of the slug. Using this technique allows me to run the migrations after the first deploy. See https://gist.github.com/chrisroos/cb3f0d29f65823ad6bfa461756a95d44 for the output.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.