-
Notifications
You must be signed in to change notification settings - Fork 151
Naming the build script build
makes PaaS detect a Rails apps as a Node app
#16
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
Comments
build
makes PasS detect a Rails apps as a Node app
build
makes PasS detect a Rails apps as a Node appbuild
makes PaaS detect a Rails apps as a Node app
Think we should get Heroku to be smarter about it's detection. Build is the standard indeed. Maybe @schneems can help adjust the buildpack detection? |
To be precise, this happened to us on a large / popular European PaaS that uses Heroku’s buildpacks. |
What's the PasS? Maybe we can tag them here so they can update and be ready for Rails 7. |
Because the detection is IN PART correct! A Rails 7 app with a build script in package.json is both a node app AND a Rails app at the same time. Needs both aspects configured correctly. |
They are https://github.com/Scalingo I'm currently checking with them if they have some internal scripts around/over Heroku's buildpacks that might be interfering. |
They have a custom flag Another solution seems to be relying on the Rails' Buildpack's default node/yarn versions (which can be a bit dated). Sorry for the trouble. |
No worries. This is a new path. Gotta smooth it all out. |
If an app has both a
Even with a package.json containing a
Originally I misunderstood the issue and thought this comment on The Ruby buildpack doesn't know anything about node, package.json or any of it's ecosystem.. The interface is that: if the app has Then we guarantee we will call That being said, there's change in the wind. I want to get the Ruby buildpack out of the node installation business. It knows too much already and it's really confusing that we have a separate The way forward is for the Ruby buildpack to depend on the node buildpack. Unfortunately this way forward not easy. Heroku is going through the process of switching our standard of buildpack interface from the existing "legacy" aka "v2" interface https://devcenter.heroku.com/articles/buildpack-api in favor of the fully spec-d Cloud Native Buildpack (CNB) interface (https://buildpacks.io/). Cloud Native Buildpacks allow one buildpack to "depend" on another. This allows the Ruby buildpack to say "I see you've got execjs/webpacker, make sure to run the nodejs buildpack first". We are currently re-writing buildpacks to support the CNB interface. You can see my work here github.com/heroku/buildpacks-ruby along with an "application contract" of what an application can expect while using the buildpack. There's a few more complicating factors: Heroku build system doesn't yet support running CNBs so we must support 2 buildpacks right now. There are issues depending on the node buildpack, for instance since it calls Organizationally we've also decided to move away from each buildpack defining what language to be written in (Previously Ruby is written in bootstrapped Ruby while all other buildpacks are written in bash). We landed on a choice of re-writing in Rust. This means my work on my re-write I linked to today is stopped and exists only as a spike/reference as we ramp up to re-write it yet again. It's fairly well spec-d out so It should go faster, but it's not here today as a thing we can use right now. Long termIn an ideal world our build ecosystem would support CNBs, we'll have customers transitioned over to that interface, the Ruby buildpack will be re-written in Rust and it will depend on the heroku/nodejs buildpack, the issues around clearing dev-dependencies between buildpacks will be offloaded (possibly to a RFC for a "clean" phase in cloud native buildpacks). And then you get your execution of I doubt all that will happen before Rails 7 hits the streets. Any ballpark when that might optimistically/pessimistically happen? If it's awhile away then maybe there's a chance. If it's soon, then we'll have to look elsewhere Short termIn the short term the workaround would be (if I understand the requirements) that developers add in the heroku/nodejs buildpack before deploying:
It does mean that deploying to Heroku is no longer a "zero config, one step process" which we worked to get to with Rails 5. I'm wondering if there might be other interfaces that could be leveraged to better tell heroku "do this thing by default". We do have the concept of an Into the future, once we get Ruby CNB shipped and these issues ironed out then it will go back to a "zero config" deploy and will "just work" and anyone who previously specified to use both I know that's a wall of text. I want to be very transparent about the state of the buildpack is currently in and where we're headed. Let me know if you've got additional questions about any of this. |
I'll review all this is detail, but a few quick notes, there's no Webpacker or execjs with Rails 7. jsbundling-rails uses node directly without any of that, and the default path doesn't use node at all. So shouldn't base any detection scheme for Rails 7 for any of that. With jsbundling-rails, though, it hooks onto assets:precompile to do its yarn install && yarn build automatically prior to running that task. Rails 7 is going to ship an alpha as soon as this week. Then probably the first beta within a month. Maybe quicker. And then final 1-2 months after that. So let's say final is 2-3 months away. |
Thanks for the update. I can try to port our Rails docs over to use Rails 7 as soon as a pre-release or alpha is available. If you're curious I use a custom build tool to dynamically "run" my documentation to ensure it actually deploys on Heroku. Here's the actual file I use for Rails 6 https://github.com/schneems/rundoc/blob/main/test/fixtures/rails_6/rundoc.md. If it uses The only incompatibility with Rails 7 I know of is these two tasks were previously deprecated and I believe they've been removed https://github.com/heroku/heroku-buildpack-ruby/blob/41a5b1fc25e1a7e3627f5a836e8f91c5c884507b/lib/language_pack/test/rails2.rb#L56-L57. We call them for test setup. It won't be a blocker for people trying Rails 7 on Heroku but will limit use of our CI feature until it gets fixed on our end to use whatever "propper" interface we deprecated those in favor of (I don't know off the top of my head). |
Got the alpha out the door for Rails 7. It ships with sprockets as-is, which I think default adds execjs to the Gemfile.lock? So the detection should work correctly? |
Looks like things are working fine on my build script
https://mobile.twitter.com/schneems/status/1438527886764376071
…On Friday, September 17, 2021, David Heinemeier Hansson < ***@***.***> wrote:
Got the alpha out the door for Rails 7. It ships with sprockets as-is,
which I think default adds execjs to the Gemfile.lock? So the detection
should work correctly?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOSYED3XFP2FJQVK6I2BDUCNO53ANCNFSM5DYYPQ4Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Richard Schneeman
https://www.schneems.com
he/him
|
Looking good for import maps. Is everything also working with jsbundling? You can do |
Confirmed that things work out of the box with |
Confirmed fine on other PaaS too. Thanks ! |
UPDATE: I ended up fixing the issue below by removing the
@schneems I am still experiencing the issue where Heroku detects the Rails app as a Node.js app due to the
In my case, I depend on
I tried placing the Ruby buildpack before the Node buildpack, but then I run into the issue where it defaults to Node 20 instead of the one specified in the package.json. Note that I don't have the execjs nor the webpacker gems in the app. What would be the solution in this case? How can I ensure Ruby gets built first, and that Heroku can respect the Node version in package.json? |
Uh oh!
There was an error while loading. Please reload this page.
When deploying a Rails app to a platform like Heroku with multiple buildpacks (Node + Ruby), the app is detected as as Node app because
package.json
contains abuild
script.Would you consider naming the build script
build:js
like in cssbundling-rails where the build script is namedbuild:css
?I would be happy to create a PR for that.
The text was updated successfully, but these errors were encountered: