I have a Play Framework app happily running on Heroku. I would like to run some rake tasks to backup the DB (OR, run anything for that matter to back up the db through a cron job on Heroku if there are other suggestions for java apps...).
So far i am striking out getting rake and Play Framework running together in the same app. As soon as I have a Gemfile there, Heroku things i am deploying a Ruby app and doesn't compile/deploy my play app. Appreciate any insights!
The Cron addon is no longer recommended on Heroku. The scheduler add on is recommended instead.
The way the documentation says to use the scheduler add on (if you are not building your apps in Rails) is to use Ruby by calling it from a script file in a bin directory. Check out the documentation here - https://devcenter.heroku.com/articles/scheduler
Related
I have just started learning ruby. So now I have setup a basic Sinatra project, just wondering where I can deploy it for free without credit card details? As Heroku has no free tier anymore. Also, I would like to know with the seeds.rb I generate random data, would those data be able to used after deploy.
I have tried couple other platforms(render, railway, AWS…), but they either are not free or hard for deploying
Currently Fly.io and Digital Ocean are popular replacement for Heroku.
Yes, you can seed the database used in the deployment.
Then you can either
Run rake db:seed on the deployed application or
Connect to the database from you development machine and run rake db:seed
I've previously deployed apps on heroku written in Rails and in Express.js, and never come across the concept of a Procfile before. Now that I've just gone to deploy a Flask app, I discovered this Procfile concept and found that the app would not run correctly without it. The Heroku docs say nothing about this being Flask-specific, and imply it's needed for all apps.
What's up with that? Why didn't I need it before, but needed it now?
In the package.json it tells Heroku how to execute the program. That's JavaScript specific. In other languages there is no such file hence the need for a Procfile.
Heroku needs to know how to execute your project.
I was wondering if Heroku Scheduler add-on for Ruby allows some kind of config file where I can set there what tasks to run and when, the same way that I would do it from the Heroku dashboard.
The reason I want this is because I have a lot of apps (development, staging, production) and I am too lazy to go set the Scheduler configuration for each one.
Thank you!
Unfortunately, no. The Heroku Scheduler add-on can only be configured through the web app.
I have deployed a rails application in a server using capistrano. What is the best way to debug this app in production?
Until now, when I used Apache+Phusion to deploy apps, I would write debug statements in the code and determine what was breaking.
But when I try the same now in the capistrano setup, I don't see the debug statements.
Where should I add the debug statements? In the code base that is pulled from the git repo? Or the current folder of capistrano?
Also, once I add the debug statement, is there anything I need to do to nginx server to reflect this change?
(Earlier, in Apache+Phusion, I used to do touch tmp/restart.txt to reflect the change)
Sorry for these questions, but this is my first time using Capistrano, Nginx.
I was deploying another agent's code, hence I wasn't fully aware of the deployment environment. On probing, I found out that the app server being used was Unicorn.
So, all I had to do to reflect the changes was restart Unicorn server by running unicorn appname restart
Well, my head is spinning a bit here. I started with what i thought would be a simple task, to take regular db dumps on heroku and push them to a personal S3 account for backup.
I am not sure the best a approach to do this. Accessing S3 within Java is crystal clear, getting the db dump from heroku is clear as mud right now...
Disclaimer: i don't know Ruby, and i don't really want to learn Ruby if i don't have to, i really want to use Java (that is why i chose play) and i want to have it hosted, that is why i chose Heroku :-)
So, I could use the heroku Scheduler, but i am not understanding what scripts are being executed here - is it all scripts in /bin? What kind of scripts are these, are they ruby scripts? How do i add them as 'tasks' when they aren't rake tasks?
Can I use the pgbackups via URL somehow? It looks like the rake examples do pg_dump instead, write to a tmp file and then move it around from there. I'm pretty unclear how to access the heroku databased stuff from a script, the examples i have seen so far are in rake, so any insight there would be helpful...
Or coming at it from inside my java app, what is the status of the Heroku java API? If there is a way to get to the heroku runtime from my java, or somehow use the heroku.jar?
It would great to get some overall guidance and best practices in this area - thanks!!!
From the google group i found this tidbit:
http://groups.google.com/group/heroku/browse_thread/thread/7fe984c3d2d01f21/9474f31138636332?lnk=gst&q=scheduler+#9474f31138636332
"Sorry for the delayed response. We updated the docs to mention running Procfile entries via heroku run:
http://devcenter.heroku.com/articles/oneoff-admin-ps
Anything that works via heroku run works via Heroku Scheduler. Just put the name of the process type as the 'task" in Scheduler. No special syntax required. And you can even pass it arguments. "
From this and James Ward's last example above i am considering this answered.