How do you run utility services on Heroku? - heroku

Heroku is fantastic for prototyping ideas and running simple web services, I often use it to run Python web services like Flask and Django and try out ideas. However I've always struggled to understand how you can use the infrastricture to run those amazingly powerful support or utility services every startup needs in its stack. 4 exmaples of services I can't live without and would recommend to any startup.
Jenkins
Statsd
Graphite
Graylog
How would you run these on Heroku? Would it be best just getting dedicated boxes (Rackspace, e.t.c) with these support services installed.
Has anyone one run utility deamons (services) on Heroku?

There are two basic options. The first is to find or create a Heroku addon to accomplish the task. For example, there are many hosted logging solutions you can use instead of Graylog; Rails on Fire or Travis can be used instead of Jenkins. If an appropriate addon doesn't exist, you can effectively make your own by just running the service on an AWS EC2 instance.
The other alternative is to push the service into being a 12factor application so that it can run on Heroku as well. For example, you could stub out whisper's filesystem calls so that they store in a backing service instead. This is often pretty painful and brittle, though, unless you can get your changes accepted by the upstream maintainers.

you could also use another free service in conjunction with it. OpenShift has a lot of Java related build services and tools that can be added.
I am using a mix of heroku, openshift, mongolab and my own web hosting. Throw in dropbox and box for some space...

Related

Question about deploying a Shopify app to Heroku

I have question about Shopify app development and the deployment process.
I've used the getting started guide here, and I have an app that works fine when I use npm run dev and view the app in the store admin.
However, of course, once I stop the server from running, the app is no longer accessible.
I believe I need to deploy the app to Heroku (or something similar) in order to have it work in a non-development environment.
It doesn't seem like there is much guidance online from Shopify about the best way to go about this.
Does anyone know what steps I need to take in order to deploy my app to Heroku, so that I can use the app in by test store on another device?
It seems like every guide online stops JUST BEFORE explaining this process and I can't figure out why! I have tried everything online but nothing has worked:
Adding the code to Github and connecting it to Heroku
Using Docker
Any help is appreciated. Thank you!
You have zero obligations to use Heroku. If you have an IP address dedicated to your house, you could host the App using your house. If you co-locate your own server at an Internet business, and they give you IP addresses you can use that. If you wanted to use Amazon directly, you could use EC2. If you wanted to use Linode, or Azure, or any other cloud service, feel free! It is up to you!
Using Heroku (built on AWS) is traditional only in the sense that it is the original easy peasy hosting in the cloud service. Play with Heroku by reading Heroku-specific documentation or hosting information. This has nothing to do with Shopify. Shopify only mentions Heroku because traditionally, developers used it. No other reason.
If you want to learn how to use Heroku, 100% there are blog posts within easy reach for you to study and learn from.

Managing mulitple apps/ecosystem.config.js files with pm2

I am building a project which will live on a single server that will contain multiple services running side by side. I am using ansible to provision the server to automate setting everything up.
Services running:
Headless CMS
Database
Other nodejs API etc...
If in the future I would need to scale this project up, I would then want to separate the above services out onto their own servers which has led me to creating separate ansible roles for each of the above services.
My Question:
I am having real difficulty in working with pm2 to get my 2 nodejs apps running with each other.
I know that I can have a single ecosystem.config.js file containing multiple apps which would fit my current architecture (everything hosted on a single server). However this would be a pain later down the road if I were to switch one of my ansible roles to its own server.
Is there a way to deploy to production my nodejs related apps using pm2 management but in a way where they have their own configuration files and systemd service which I can define in ansible?
If I have multiple ecosystem.config.js files for each nodejs app, can pm2 mangage these with the default systemd service it offers when running:
pm2 startup
Or should I just write my own separate systemd services which I could then manually install in each ansible role through templates?
I'm really lost here and have spent so much time trying to work out the best approach to take so any help would be great!!
After doing some more research on this matter I came across this super helpful thread on pm2's github. Basically it seems that for automation using systemd services is the way to go and not bother with pm2's startup (which does create a systemd service, but more complex to manage when using automation software such as ansible.)
I strongly recommend you read it if you stumble accross this question!
https://github.com/Unitech/pm2/issues/2914

Elasticsearch on cloudfoundary

I am trying to deploy my asp.net core 2.2 application using buildpacks on SCP cloudfoundary. My application has dependency on elasticsearch. How can I assembly my buildpack file so that I can install both my dotnet core 2.2. app along with Elasticsearch running as a service.
Thanks,
I don't think you would want to run Elasticsearch as an app on Cloud Foundry because it would be difficult to persist any data. The file system your app gets on CF is ephemeral, and is scoped to the lifetime of your app instance. Thus if your app restarts anything you've written to disk is gone. If that doesn't matter to you, I suppose you could proceed.
That said, you wouldn't want to run it as part of the same app. You'd want to push them separately as two different apps. That way you can scale them separately, if one crashes, you don't lose both, and you have dedicated memory limits for each app (i.e. one of the two, cannot consume more than it's share of memory and crash the app).
Having said all that, my suggestion would be to run cf marketplace and see if there is a Elasticsearch service in your Marketplace. That would be the easiest way forward. You could simply cf create-service and make your Elasticsearch service.
If there isn't one in your marketplace, then you can look at getting one through AWS/GCP/Azure or some other provider. Then you can create a service instance in CF with cf cups (it's called a user-provided service). You can bind this user-provided service to your app just like a service created through the marketplace.
If all else fails and you can't find a service from a provider you trust, you could always run your own. Then use a user-provided service to pass in creds.

Heroku Applications within AWS VPC

I have a small Rails app which I'm keen to deploy through Heroku (as I do with other clients) however this is not intended to be a publicly available application and they need to deploy it within their AWS VPC as if it is accessible within their internal network.
Is this something which is possible? I know that Heroku is built on top of EC2 but wasn't sure quite how flexible it was and haven't been able to find anything documented.
If not possible would anyone be able to offer experiences of pre-built Rails AMIs that I might be able to use in order to replicate some for the Heroku deployment simplicity without having to worry too much about configuring and managing my own infrastructure for the app.
Sounds like git-deploy might be what you need for git-style deployment.
I also found quite an interesting blog post by Giles Bowkett that might be interesting to you.

What exactly is Heroku?

I just started learning Ruby on rails and I was wondering what Heroku really is? I know that its a cloud that helps us to avoid using servers? When do we actually use it?
Heroku is a cloud platform as a service. That means you do not have to worry about infrastructure; you just focus on your application.
In addition to what Jonny said, there are a few features of Heroku:
Instant Deployment with Git push - build of your application is performed by Heroku using your build scripts
Plenty of Add-on resources (applications, databases etc.)
Processes scaling - independent scaling for each component of your app without affecting functionality and performance
Isolation - each process (aka dyno) is completely isolated from each other
Full Logging and Visibility - easy access to all logging output from every component of your app and each process (dyno)
Heroku provides very well written tutorial which allows you to start in minutes. Also they provide first 750 computation hours free of charge which means you can have one processes (aka Dyno) at no cost. Also performance is very good e.g. simple web application written in node.js can handle around 60 - 70 requests per second.
Heroku competitors are:
OpenShift by Red Hat
Windows Azure
Amazon Web Services
Google App Engine
VMware
HP Cloud Services
Force.com
It's a cloud-based, scalable server solution that allows you to easily manage the deployment of your Rails (or other) applications provided you subscribe to a number of conventions (e.g. Postgres as the database, no writing to the filesystem).
Thus you can easily scale as your application grows by bettering your database and increasing the number of dynos (Rails instances) and workers.
It doesn't help you avoid using servers, you will need some understanding of server management to effectively debug problems with your platform/app combination. However, while it is comparatively expensive (i.e. per instance when compared to renting a slice on Slicehost or something), there is a free account and it's a rough trade off between whether it's more cost effective to pay someone to build your own solution or take the extra expense.
Heroku Basically provides with webspace to upload your app
If you are uploading a Rails app then you can follow this tutorial
https://github.com/mrkushjain/herokuapp
As I see it, it is a scalable administrated web hosting service, ready to grow in any sense so you don't have to worry about it.
It's not useful for a normal PHP web application, because there are plenty of web hosting services with ftp over there for a simple web without scalability needs, but if you need something bigger Heroku or something similar is what you need.
It is exposed as a service via a command line tool so you can write scripts to automate your deployments. Anyway it is pretty similar to other web hosting services with Git enabled, but Heroku makes it simpler.
That's its thing, to make the administration stuff simpler to you, so it saves you time. But I'm not sure, as I'm just starting with it!
A nice introduction of how it works in the official documentation is:
https://devcenter.heroku.com/articles/how-heroku-works
Per DZone: https://dzone.com/articles/heroku-or-amazon-web-services-which-is-best-for-your-startup
Heroku is a Platform as a Service (PaaS) product based on AWS, and is vastly different from Elastic Compute Cloud. It’s very important to differentiate ‘Infrastructure as a Service’ and ‘Platform as a Service’ solutions as we consider deploying and supporting our application using these two solutions.
Heroku is way simpler to use than AWS Elastic Compute Cloud. Perhaps it’s even too simple. But there’s a good reason for this simplicity. The Heroku platform equips us with a ready runtime environment and application servers. Plus, we benefit from seamless integration with various development instruments, a pre-installed operating system, and redundant servers.
Therefore, with Heroku, we don’t need to think about infrastructure management, unlike with AWS EC2. We only need to choose a subscription plan and change our plan when necessary.
That article does a good job explaining the differences between Heroku and AWS but it looks like you can choose other iaas (infrastructure) providers other than AWS. So ultimately Heroku seems to just simplify the process of using a cloud provider but at a cost.

Resources