Multiple apps, paid Dynos - heroku

Looking for best practice/implementation thoughts:
I often create small to medium web apps for client projects, usually webservices for mobile apps, sometimes websites.
Since the free Heroku model scales down/shuts down dynos if no activity is detected, the start up time of websites and web service calls are sometimes delayed.
I would like to pay monthly for 1-2 dynos so that the apps are available immediately, but I would like all my apps to use the same dynos. Does anyone one if this is possible and where should I start.
I'm looking for solutions other than pinging the apps to try to keep the dynos alive, i'm not even sure if this really works in the long term.
Thanks.

Related

Heroku pipeline dynos and add-ons

I'm using Heroku's Pipeline feature to manage the stages of my application. I received an email about Heroku getting rid of their free plans, so I went ahead and upgraded my plan just now. Currently, I have one app with two database add-ons in Heroku. This is the first time that I've used their Pipeline feature—and I'm by no means a Heroku expert. I have two questions:
Do I need to purchase dynos for every new app that I use Heroku for? The plan that I ended up purchasing was the Production plan (since the app is for a client), and I also purchased two psql database add-ons which are attached to the app.
Since I'm using their pipeline for my one app, I have staging and prod versions of the app assigned to their appropriate branches in the repo. The prod app is where I upgraded to the paid plan. Do I need to purchase any dynos or add-ons for the staging app within the Pipeline? I was able to attach the databases with no issue, but I purchased a dyno for the staging app just to be safe.
Feel free to share any of your favorite Heroku alternatives as well—I'm only using Heroku because that's what I learned how to use in school.
Fellow Heroku user here!
Do I need to purchase dynos for every new app that I use Heroku for?
Yes. Heroku have basically said they’re getting rid of free plans for all applications due to wanting to make more money security reasons. So staging apps will also fall under this.
Basically, it sounds like there’s going to be no free tier dynos or first party add-ons from Heroku going forward. They do suggest for non-production apps (like testing and staging apps) to turn your dynos on when in use, and off when not in use, and you’ll only be billed for the time the dyno is on.
I‘m not sure which plan is the Production plan (I couldn’t see it on the pricing page) but maybe try out Hobby first. I have multiple apps running with paid Hobby-tier dynos and they have ran just fine without really spiking the CPU or memory available in those dynos. But I’m running PHP apps, so your milage may vary if you’re using another tech stack, or do get more load than my apps.

Is there any Heroku request queue for storing requests while dyno is down?

I am using Heroku for one of my hobby projects. I bumped into the following problem if webhook sends a request to Heroku and Java app restarts at this time, the request will be lost. Is there any native Heroku way or plugin that ensures that Heroku will get a request, at least once?
I didn't find anything so far, and the default solution is to take AWS Lambda or Google Cloud Function to ensure scalability and availability. I feel that it adds unnecessary complexity and possibly a maintenance headache.
To Summarize:
Is there any Heroku native mechanism or Heroku plugin that ensures that requests will be delivered?
Assuming your Java application restarts are related to dyno restarts or deploys:
you might want to look into the preboot feature on Heroku.
From their documentation:
Preboot changes the standard dyno start behavior for web dynos. Instead of stopping the existing set of web dynos before starting the new ones, preboot ensures that the new web dynos are started (and receive traffic) before the existing ones are terminated. This can contribute to zero downtime deployments.
#Denis Cornehl's answer helped a lot. My answer is an extension to it.
You don't have a free solution if you have free or hobby tires. You will have to follow Enterprise Integration Patterns.
My solution was to put the queue in front of the application and consume messages when the application is up. Even though there is no free queue, some cloud providers give you free quotes for big loads. I recommend considering them before deploying and maintaining your own queues.

Difference between app and Dyno on Heroku?

I don't understand what the difference between an app and Dyno is.
I want to use the hobby plan so that I can use an own SSL domain and that the servers stops sleeping.
I have a backend (nodeJS) and a frontend (reactJS).
Heroku says $7/Dyno. Does that mean I have to pay $7 for one app? Or do I pay $7 and can use several apps with it, so that they don't sleep?
An App is a set of one or more different dynos. This latter can be either of the same or different type (e.g. web, workers, ...) and having a different tier (e.g. standard, hobby, performance ...). You can see here the details for your better understanding.
It is possible to execute more instances of the same dyno type (e.g. for high-availability, processing concurrency ...). You can see here and here for details.
You basically pay for the number of dynos you run.

Is it possible to run two applications on one hobby dyno?

I have $161 platform credits on heroku from GitHub student pack to spend for one hobby dyno:
The Heroku offer is for one (1) free Hobby Dyno for two years, which will be applied on your invoice as a discount of $7 for a Hobby Dyno.
I already deployed one spring app and changed its dyno to hobby. My question is if there is a way I could deploy second Java app and set it to use the same dyno which is assigned for the first app?
Right now I have one app which has hobby dyno and one app which uses free dyno. I read on the internet and people say that there is only one app allowed for one dyno and Heroku will charge me for the second one but there is also this thread How many apps are allowed on a 'Hobby' Heroku plan? which says that I can have more than one app per hobby dyno.
So what's the truth?
No, you can't run multiple apps on a single dyno.
Heroku's model is to run one app per dyno (and often many dynos for a single app). The question you reference discussed the Hobby plan¹, asking how many dynos can be run per account. Keep in mind that Heroku's model is different from the shared or VPS hosting you might be used to. Dynos don't provide an OS that you can put apps onto; they run apps directly.
¹Technically I don't think this makes a ton of sense since accounts don't have these kinds of tiers. One account can run free dynos, hobby dynos, and professional dynos. But there is a difference between unverified accounts, which can run up to five free dynos, and verified accounts which can run many more.
According to this article on the heroku page it is possible but not recommended.
Heroku post

Heroku pricing dramatically increases when using microservices architecture

I'm just starting with Heroku, and I'm considering using it to host my app.
The problem is, I'm planning to build my app with a micro services architecture.
As I understand Heroku's pricing, they charge per dyno. When using micro services, there are a bunch of "apps" or "services" working together to provide the functionality of one app.
It seems inevitable to do this without using multiple dynos, and by adding dynos, the price goes up very quickly.
I have three questions:
Is my interpretation of Heroku's pricing correct?
Is there a better way to do a micro services architecture using Heroku?
Or, is there a way to deploy multiple docker containers on a single dyno?
Your Heroku costs will definitely go up as you use more dynos and more apps, but if you are just starting out, the money you spend will be in no way more than the time you would spend setting up something like AWS to perform the same functionality.
You can always save money later, once your app is running and users are loving it. If you goal is to prototype and get it out fast, Heroku is still the best choice.
Did you know about Heroku price calculator?
Saw you run 10*1x dynos, plus some other services, like text messages and such. That will cost you $250-350 this month. That's a lot, sure. But you can get your app running tomorrow, and presumably that is worth a lot more than 250.

Resources