As you can say, I have an app running in Heroku, recently I installed Heroku Scheluder Standard add-on to automatize heroku pgbackups:capture --expire --app my-app, but it's been 3 days and it doesn't make the backup, so…
How can I make it do them?
You may find the pgbackups addon will work for you, depending on the frequency with which you want the backups to occur. heroku addons:add pgbackups:auto-month will configure the appropriate addon.
Related
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
I have to load pg_dump and the pg_restore to Heroku so that I can load a local database to Heroku. How can I install pg_dump and pg_restore on Heroku? What are their addresses?
So they way Heroku works is you install an addon to your Heroku app called Heroku Postgres. Then you add another app called PGBackups. These apps expose commands to your command line. They are like subcommands to the heroku command. So you'd do heroku pgbackups:restore to restore (or really, load initially) a database to your Heroku instance. See this link:
https://devcenter.heroku.com/articles/heroku-postgres-import-export
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.
I'm totally new to Heroku and Postgres and I'm trying to figure out how to setup and access the Postgres db in a Heroku Ruby app.
I'm not sure how to go about setting this up. I've found some information about using the command:
rake db:create
Where do I enter this command? I'm completely in the dark on this.
Any help with how to setup/access the Postgres db in Heroku would be greatly appreciated.
Thanks.
Without info on what type of Ruby app you're building, what gems you may be utilizing, or what frameworks you may be building on, it is impossible to completely guide you through how to connect your Ruby app to the Heroku Postgres database. But here are a few things to point you in the right direction:
Install the Heroku Toolbelt as #jordan.baucke suggested. Beyond just adding plugins, you'll be using this toolbelt for nearly every Heroku-related action. Just follow the link, download, and install. Easy!
Now that you have the toolbelt, login to your account from the command line: heroku login.
Now make your app. While in your app folder (on the command line), execute: heroku apps:create <app name> -s cedar.
Now add the Postgres db: heroku addons:add heroku-postgresql:dev -a <app name>
From Ruby, you can connect to the db through the environment variable: ENV['DATABASE_URL'].
Deploy the app via git: git push heroku master.
From here, we really can't give you any further guidance since we don't know how you're interfacing with Postgres. But the above steps should at least get you to be able to connect to the db from your Heroku app.
For starters, are you using the the Heroku toolbelt? (command line tools?)
You can do it from the website as well, but with the toolbelt, you can enter heroku addons:add heroku-postgresql:dev --app *your app name*
Heroku will automatically inject the database into your app's database.yml when you deploy your app into Heroku.
Finally, you need to migrate the production database to your current migrations. You can do this remotely with the toolbelt again:
$ heroku run rake db:migrate
This will remotely connect a console and pull your migrations into your production database on the server.
I am using Heroku and normally I do commands like:
heroku run rake db:reset --app myapp
which resets my database. I have read online that Heroku didn't support all rake commands (including db:reset, but the article may be outdated? as it works fine for me)
However, I have a production app and a staging app and am concerned about my late night programming, with regards to an accidental hit of db:reset on my production app.
Is there a way i could implement a prevention confirmation with a command like:
heroku run rake db:reset --app myapp or heroku run rake db:migrate --app myapp
or
git push production?
Be very careful when running any destructive commands. Just incase use https://devcenter.heroku.com/articles/pgbackups to make sure you can recover data if you do accidentally drop the database.