D
Dokploy•7mo ago
jamesst20

How to specify heroku buildpacks to use?

I tried adding this to an app.json as described here https://devcenter.heroku.com/articles/app-json-schema#buildpacks
"buildpacks": [
{ "url": "https://github.com/heroku/heroku-buildpack-nodejs.git" },
{ "url": "https://github.com/heroku/buildpacks-ruby.git" }
]
"buildpacks": [
{ "url": "https://github.com/heroku/heroku-buildpack-nodejs.git" },
{ "url": "https://github.com/heroku/buildpacks-ruby.git" }
]
but it had no effect
app.json Schema | Heroku Dev Center
app.json is a manifest format for describing web apps. It declares environment variables, add-ons, and other information required to deploy and run an app on Heroku.
33 Replies
Siumauricio
Siumauricio•7mo ago
is there a reasson you are specifying a buildpacks? the heroku buildpacks already have all the engines installed
jamesst20
jamesst20OP•7mo ago
Yes there is, the "auto detection" uses ===> DETECTING 3 of 5 buildpacks participating heroku/nodejs-engine 3.2.15 heroku/ruby 3.0.0 heroku/procfile 3.1.2 Thing is nodejs-engine is not same as the nodejs build pack. It ends up failing on "pnpm is not a known command" More specificallyt - Running bundle exec rake assets:precompile --trace Invoke assets:precompile (first_time) Invoke vite:install_dependencies (first_time) Invoke js:routes:typescript (first_time) Invoke js:routes (first_time) Invoke environment (first_time) Execute environment Execute js:routes Execute js:routes:typescript Execute vite:install_dependencies Invoke vite:build_all (first_time) Invoke vite:verify_install (first_time) Invoke environment Execute vite:verify_install Execute vite:build_all Building with Vite āš”ļø rake aborted! ViteRuby::MissingExecutableError: āŒ The vite binary is not available. Have you installed the npm packages? (ViteRuby::MissingExecutableError) ... ... Caused by: Errno::ENOENT: No such file or directory - pnpm (Errno::ENOENT)
Siumauricio
Siumauricio•7mo ago
mmm I'm not familiar with ruby, let me see if there is any way to specify a custom file
jamesst20
jamesst20OP•7mo ago
On heroku and also dokku it is enough to just specify those buildpacks to get a working deployment I sometimes also use custom buildpacks for dependencies like libvips, puppeteer, aptfile, etc. šŸ™‚
Siumauricio
Siumauricio•7mo ago
the thing is we use buildpacks https://buildpacks.io/docs/for-app-developers/how-to/build-inputs/configure-build-time-environment/#using-project-descriptor which internally allows to use multiple builders including heroku packs, but I cannot find information how we specify the app.json to the builder the only thing similar is this https://buildpacks.io/docs/for-app-developers/how-to/build-inputs/use-project-toml/ which you can specify, builders and more things, I'm not very familiar with that
Cloud Native Buildpacks
Use project.toml Ā· Cloud Native Buildpacks
Simplify your pack configuration.
Cloud Native Buildpacks
Customize buildpack behavior with build-time environment variables ...
Environment variables are a common way to configure various buildpacks at build-time.
Siumauricio
Siumauricio•7mo ago
probably dokku use the heroku cli directly, that's why it recognize the app.json automatically
jamesst20
jamesst20OP•7mo ago
Oh actually with dokku I use dokku buildpacks:set --index 1 https://github.com/heroku/heroku-buildpack-nodejs.git and then index 2 for the ruby buildpack
jamesst20
jamesst20OP•7mo ago
i.e
No description
Siumauricio
Siumauricio•7mo ago
according to the docs from heroku/buildpacks you can use the project.toml https://github.com/heroku/buildpacks/blob/main/TUTORIAL.md#configuring-multiple-languages
GitHub
buildpacks/TUTORIAL.md at main Ā· heroku/buildpacks
Heroku Cloud Native Buildpacks. Contribute to heroku/buildpacks development by creating an account on GitHub.
Siumauricio
Siumauricio•7mo ago
and there you can specify multiples buildpacks
jamesst20
jamesst20OP•7mo ago
Thanks! Just tested it didn't make any difference Hey nevermind it did do something
Siumauricio
Siumauricio•7mo ago
what did you do?
jamesst20
jamesst20OP•7mo ago
No description
jamesst20
jamesst20OP•7mo ago
I added this to the root I though it didn't work because the output during build is now ===> DETECTING heroku/nodejs-engine 3.2.15 heroku/nodejs-corepack 3.2.15 heroku/nodejs-pnpm-install 3.2.15 heroku/ruby 3.0.0
Siumauricio
Siumauricio•7mo ago
is the project.toml?
jamesst20
jamesst20OP•7mo ago
Yes šŸ™‚
Siumauricio
Siumauricio•7mo ago
Nicee
jamesst20
jamesst20OP•7mo ago
The deployment was successful but it seems to app is not being executed properly
Siumauricio
Siumauricio•7mo ago
can you check the logs?
jamesst20
jamesst20OP•7mo ago
No description
jamesst20
jamesst20OP•7mo ago
I am not sure what command it's trying to run
jamesst20
jamesst20OP•7mo ago
I do have the following procfile
No description
jamesst20
jamesst20OP•7mo ago
I added PORT=3000 in environment variables and it appears to have fixed it! I don't think the worker is running though. Do you know if it's possible to run it? Typically would be dokku ps:scale web=1 worker=1 with dokku
Siumauricio
Siumauricio•7mo ago
I'm not familiar with dokku in that way, what makes dokku when you run that command>?
jamesst20
jamesst20OP•7mo ago
It reads my Procfile and starts process accordingly When I do docker ps I can see both web and worker command executing in a docker (one docker for each) The release process is ran only once during the deployment at the end, it's used to execute database migration, this is how Heroku says to do. It appears it didn't run in my case with Dokploy Opening a terminal session or runnign docker exec -it <container id> bash won't let me do anything either. ruby, bundle, etc. are all "command not found" Got it ! Running /cnb/lifecycle/launcher bash gives you a proper sourced environment šŸ™‚ At least I could manually run migrations for now
Siumauricio
Siumauricio•7mo ago
I’m not familiar with that tbh 🤣, but happy you found a solution
jamesst20
jamesst20OP•7mo ago
Me neither! At first I though it was all different because I was using Dokploy but it's simply because it's using Heroku Cloud Native Buildpack The way it works is completly different It's up and running but couldn't find how to tell to run the worker from the procfile but I do see it detected Documentation says heroku ps:scale worker =1 But that command doesn't exist dokku ps:scale worker = 1 is the dokku equivalent
Siumauricio
Siumauricio•7mo ago
I guess scale is something specific to heroku platform you can scale aplications in dokploy, in advanced -> cluster -> set replicas I don't know if is the same thing but basically it creates multiples replicas of the same app
jamesst20
jamesst20OP•7mo ago
In my case it needs to run same docker image but with a different start command I'm gonna call it a night for now šŸ™‚ Thanks for the quick help! Have a good night
Piyush Dixit
Piyush Dixit•7mo ago
@Siumauricio can add at least app.json read capabilities to read Heroku build pack version, Currently Dokploy using Heroku build pack version 24 But I want 22 Or you can add additional options during selecting build pack Like when we select Dockerfile as build type, There are many additional options, You can add an option like the Heroku version to configure the Heroku build pack version
Piyush Dixit
Piyush Dixit•7mo ago
No description

Did you find this page helpful?