← Back to Blog

Stop Using Heroku to Deploy NodeJS Apps! Use This Platform Instead...

Don't take the title too seriously — the point of this post is to introduce another platform with similar, and in some ways better, capabilities than Heroku. Just as importantly, this platform is free to use.

No more wasting time rambling — right after this I'll introduce you to this platform and walk through how to deploy a NodeJS App onto it.

What is Bizfly App Engine?

Bizfly App Engine is a platform my team and I have recently been developing. This platform lets you deploy applications written in many different languages, like: Python, Golang, JavaScript, Ruby, C#, Java, etc., quickly — on average it only takes a few minutes to deploy. The system automatically detects the language and builds it accordingly.

This platform also simplifies operating an application, like: updating to a new version, restarting, stopping, rolling back, etc.

Hope you'll like this product and use it regularly!

Product docs: docs.bizflycloud.vn/app_engine

Preparation

Preparing the application

To deploy an application, you'll definitely need Source Code first, right 😁. You can use your own source code, or code you already have.

The code I'll use in this post is here: github.com/bizflycloud/app-engine-nodejs-sample

Let's take a quick look at this code. Content of file server.js:

const express = require('express');
const port = process.env.PORT || 8080;

const app = express();

app.get('/', (request, response) => {
    response.send(`<!DOCTYPE html>
<html>
  <head>
    <title>BizflyCloud App Engine</title>
  </head>
  <body>
    <img style="display: block; margin-left: auto; margin-right: auto; width: 50%;" src="..."></img>
  </body>
</html>`);
});

app.listen(port);

This application simply opens a web app listening on the port set by the PORT environment variable — if this variable isn't declared, it uses port 8080.

When a user visits this application, the server returns an HTML snippet for the user's browser to render.

Next, the content of packages.json. Here we define the dependencies and scripts — the dependent components and the command the application will run, respectively.

{
    "author": "BizflyCloud App Engine",
    "dependencies": {
        "express": "^4.18.1"
    },
    "description": "Sample Node.js Application using NPM",
    "license": "Apache-2.0",
    "name": "sample",
    "repository": {
        "type": "git",
        "url": "https://github.com/paketo-buildpacks/samples"
    },
    "scripts": {
        "start": "echo \"start\" && node server.js"
    },
    "version": "0.0.0"
}

So now you understand what this application does, right — now let's move to the deployment phase.

Preparing an account

To deploy the application onto Bizflycloud's App Engine, you need an account first — this isn't too difficult, go ahead and do it yourself:

Register an account here: manage.bizflycloud.vn/register

Once you have an account, log in, and you'll see the App Engine service in the left-side menu

Deploying the application

Creating an App and Service

Applications you deploy on App Engine that are related to each other can be grouped into the same App. So first we need to create an App. Here I'll create an app named example. Once created, we'll get pushed into that app — here I continue by choosing Create Service to create a new service for deploying the NodeJS App

In the create service section, I'll enter the following info:

  • Service name: This is the name of the service you want to deploy — this name will be used as the path from the 2nd service onward.
  • Location: The location where your application gets deployed — choose the closest location to reduce latency. (Currently we only support Hanoi, more locations in the future 😁)

In the deployment info section, this covers info about the application source you'll deploy.

  • Source type: You can choose to deploy via image or source code. I have source code stored on git, so I'll choose GIT
  • Source URL: The link to your repo, in http:// or https:// form.
  • Branch: The branch you want to deploy code from.
  • Private mode: For private repos. My repo is Public so I don't need to check this.

Application config is the section holding info about the infrastructure and network you'll deploy:

  • Config: This is the config of each container running your application.
  • Replicas: The number of copies running with the config above.
  • Port: The port your service is running on
  • Application type: Each type of application gets packaged differently — choose the correct type for the application you want to deploy. You can hover over each button to understand each application type.

Once you've filled in everything, just hit Confirm Info to deploy the application immediately.

Result

Once deployed, the system returns a URL for you to access the service, as shown.

You can try accessing it here: example-nnwpu.appengine.bfcplatform.vn/nodejs-npm

Operational actions

Monitoring

With a monitoring system, you can easily spot abnormal application behavior quickly.

The system monitors important infrastructure metrics like CPU, Memory, Network, and Disk I/O.

Logs

Logs are split into 2 types: Runtime Logs and Build Logs

  • Runtime Logs contain logs during operation
  • Build Logs contain logs during the packaging/building process

AutoScale

This feature lets your application automatically expand its infrastructure when overloaded. You can configure the max number of copies you want to auto-scale to, and the CPU percentage threshold that triggers this feature.

Wrapping up

Thanks for reading all the way through — hope you'll take the time to try out this product! If you have any feedback, or want a feature developed in the future, feel free to comment below this post or message me directly on Telegram @HoangViet12. All your feedback is very valuable to me.

If you found this post good, please Up Vote and Follow me to keep seeing more posts about Bizfly App Engine! 👋👋👋

This post is part of the BizflyCloud App Engine Tutorials Series

If you're running into technical challenges or need help with systems, DevOps tools, I'm confident I can help. Get in touch at hoangviet.io.vn

Have thoughts on this?

I'd love to hear your perspective. Send me a message.

Get in touch