As we mentioned in the first part of this article, "Target the cloud effortlessly with your MEAN application and Stacksmith", Stacksmith monitors the application components for updates and security patches. It provides a simple way to repackage your application making updates easy to incorporate.
In this post, I will walk you through the process of updating both dependencies and application code, to deploy the new version on AWS or Kubernetes. This article assumes that your MEAN application is now live, and there are some new features and new versions of dependent packages released so you want to update it.
There are typically two types of updates you'll want to perform: updating the packages your application is dependent on and/or updating your application code. Step 1 discusses the first case and Step 2 the second. Step 3 shows you how to redeploy your updated application to AWS or Kubernetes. Let's start at the beginning:
On the application details page in Stacksmith, you will see a list of the packages included in the image.
When the image gets outdated, new versions available for your installed packages will appear here automatically.
Rebuilding your application with the latest dependencies is a simple one-click process— just hit the "Repackage" button. This repeats the build process with the same version of your codebase, but with fresh system packages.·
In this example, it will also get fresh
npm dependencies. Depending on your release process, you might prefer to use the shrinkwrap feature of npm, so the versions of the dependencies remain locked. That is as easy as adding the
npm-shrinkwrap.json to your project.
Let's suppose that you want to package a new version of the app. To generate this new version, you can apply the patch provided in the repo that changes the color of the counter in the app from blue to orange:
cd stacksmith-examples/nodejs-with-nosql/todo git apply ./change_color.patch tar czf app.orange.tar.gz app
Or just download the provided tarball called app.orange.tar.gz instead.
To package a new version of the app, follow these steps:
2in this example).
This process differs depending on whether you have deployed the application in AWS or Kubernetes.
Once the new version is ready:
This will spin up a new instance with the new version of the app, and when it is ready, it will destroy the old one. After a while, the operation will finish. That means that the changes are now deployed.
Use the name you gave to the helm release to run the following command:
$ helm upgrade my-todo-app ./my-to-do-application-2-docker-977028011.tgz
After the upgrade has finished, refresh the page where your app was being served (or open it again).
You will notice that the counter has changed the color from blue to orange—proof that the new version has been deployed.
This is a really simple and convenient way of building, deploying, and maintaining your applications on AWS and Kubernetes. You can easily deploy your application to your desired platform targets, and release new versions smoothly.
Stacksmith supports other sets of runtimes—check out the different templates. And there are more to come.
Package, deploy, and maintain your own Node.js application today. And if you have any feedback, let us know in our community forum. We look forward to hearing from you!