How to install scala on Heroku? - bash

I want to use a scala script in console on Heroku.
So, after command
$heroku run bash
I try a script ./scala_script.sh, but the result is scala: not found.
So, how to install scala or even some package on Heroku?
Thanks

If this is a Scala app, you should use the Scala buildpack. You can hardcode the buildpack url:
$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-scala
If you need Scala in addition to Play! Framework, you can experiment with buildpack-multi to get both buildpacks applied to your app.

Related

Pushing my Python Discord Bot onto Heroku

I wrote a program in VS Code for a Discord bot, and I am trying to run it in Heroku. I was using the Heroku CLI and navigated to the folder with the code in my Command Prompt (I'm on Windows). I tried to add and push my main code, but I got the error in the picture below.
How can I resolve this issue? I am using Windows and my code is in VS Code.
The error states that heroku is unable to determine the language of your project.
You should add a requirements.txt file with the python package names used in your project to allow heroku to detect it as a python project.
Other options include using a setup.py file or Pipfile.
You can also manually set the buildpack using
heroku buildpacks:set heroku/python
in the heroku CLI
For more information check the documentation

Meteor CLI + Heroku -- Deploying with a Flag in the CLI

I'm testing an older package and it won't successfully run unless I boot Meteor with:
meteor --allow-incompatible-update
It's my intention to deploy this application to Heroku. I'm also using a buildpack to accomplish this: https://github.com/jordansissel/heroku-buildpack-meteor
How does one deploy an app to Heroku while passing in a flag/setting on the CLI?
You need to fork the buildpack and edit this line: https://github.com/jordansissel/heroku-buildpack-meteor/blob/master/bin/compile_meteor#L64
meteor build ../build --allow-incompatible-update --directory 2>&1 | indent
You can then use this fork as your buildpack.

Getting PDFTK installed on heroku Cedar Stack for use in my app

so I have building management app, which locally uses the pdftk to generate pdf forms (prefilled with tenant/expense data). Works like magic on my local machine.
However, on Heroku I get the error:
pdftk executable /usr/local/bin/pdftk not found
in the logs when I try to generate the pdf file. I realize that I need to install pdftk on my heroku app using a buildpack. I've tried following some tutorials with Vulcan, but vulcan is deprecated and they say use heroku run, however I can't find much documentation of how to install the pdftk-source: https://github.com/millie/pdftk-source using heroku run.
I'm going to try https://github.com/millie/heroku-buildpack-ruby-pdftk, but if there is an easier/less messy way let me know, thanks!
EDIT:
Tried the above method, and now my heroku logs say:
RuntimeError (pdftk executable /app/vendor/pdftk/bin not found)
So I'm thinking the buildpack didn't include pdftk to begin with, which doesn't make sense.
I must be doing something wrong, but I followed the instructions exactly, only difference is I used dropbox instead of S3 to store the tar.gz file (the pdftk source)
EDIT:
OK, I figured out how to include pdftk executable in the heroku buildpack and upload it successfully as part of the app environment. HOWEVER, for some very strange reason, in the heroku bash console, when I cd into pdftk directory and try to run the executable, heroku bash says pdftk executable not found.
It works on my local machine, when cd into the pdftk directory and run pdftk, it runs the executable, so its not the executable..so why isn't it working inside the heroku bash directory?
SOLUTION:
Was missing setting LD_LIBRARY_PATH in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk. Just check out #heroku on IRC, that's where I got my answer.
Was missing setting LD_LIBRARY_PATH in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk. Just check out #heroku on IRC, that's where I got my answer.
This is how i setup pdftk in nodejs app in heroku
Create heroku app
heroku create
Set buildpack for pdftk
BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-apt
Set buildpack for nodejs
heroku buildpacks:add --index 1 heroku/nodejs
Add the libgcj.so.* to your search path:
heroku config:set LD_LIBRARY_PATH=/app/bin
Turn on at least one dyno
heroku ps:scale web=1
Create a Procfile in the root of your project and define the following:
web: node server.js
Push changes in heroku
git push heroku master
Adding answer that worked as of July 2019
Note: Thanks to shake-apps for creating the Buildpack https://elements.heroku.com/buildpacks/shake-apps/heroku-buildpack-pdftk
If you need to have PDFtk installed on Heroku for a Node JS Application, follow these instructions:
Heroku Installation
You'll need to set the base nodejs buildpack, and the pdftk buildpack by shake-apps.
Set them by running the following:
heroku buildpacks:set heroku/nodejs;
heroku buildpacks:add --index 1 https://github.com/shake-apps/heroku-buildpack-pdftk.git;
After build packs are set, the server can be deployed normally with
git push heroku master
If you have any issues with the deploy it could be your previous buildpack. You can clear it to start fresh with:
heroku buildpacks:clear

Using a headless browser with Heroku Rails Unicorn stack

I have seen posts that you can change the build on Heroku, to use PhantomJS with the Cedar stack, but is it possible to run a headless browser on the unicorn stack?
Yes, and someone already wrote a buildpack for including PhantomJS (the internet and open source are amazing).
If you want to run headless PhantomJS on a Heroku dyno, you will need to:
Switch to Heroku multi-buildpack: https://github.com/ddollar/heroku-buildpack-multi
Setup Ruby buildpack for your app: https://github.com/heroku/heroku-buildpack-ruby
Setup PhantomJS buildpack for your needs: https://github.com/stomita/heroku-buildpack-phantomjs
The multi buildpack must be configured as the official Heroku buildpack. You then need to add the other two buildpack URLs to the .buildpacks file. There are additional details for configuring each buildpack at the links above.
Using this, you should be able to deploy your Rails app, run your PhantomJS code/tests, all on a single dyno headlessly.

What does heroku rake and restart commands do?

I'm using heroku for a sort time and I have some doubts on what exactly do 2 'commands'
The first is rake, I've seen here some people use it and some others, use the same instructions without rake, so I'd like to know if there's any difference in using rake or not
The other is more simple: heroku restart
Does this only affect the database or it also affect the code?
If it only affects the database, what happens to the data?
Should I use it, or it's an emergency command?
All info explained here and related to these instructions will be really helpful
Thanks!
rake is a deprecated call.
Heroku ❯ heroku help rake
Alias: rake redirects to run:rake
Usage: heroku run:rake COMMAND
WARNING: `heroku run:rake` has been deprecated. Please use `heroku run rake` instead."
Basically it is/was a shortcut to running rake calls for Rails apps.
You should use heroku run rake <task> instead.
heroku restart restarts a application processes, which are explained in more detail here: https://devcenter.heroku.com/articles/process-model
heroku help restart for more info.
heroku restart does not restart your database.

Resources