Deprecation Notice: If you are upgrading from N|Solid 2.x, here are the need-to-know steps for migrating to N|Solid 3.x. * N|Solid Storage has been eliminated, and its functionality is provided by the N|Solid 3.x Console server. Attempting to connect an existing N|Solid Storage instance to a N|Solid 3.x Console will not work unless the storage instance is running in relay mode. * Many of the settings and environment variables from N|Solid Storage are available in the 3.x N|Solid Console; substitute CONSOLE for STORAGE in the variable name. View the Networking documentation for specific settings. * Loading a N|Solid 3.x Console server with the same configuration as a N|Solid Storage instance will load some of your existing assets and metrics history, but Heap Snapshots will need to be accessed directly from your storage device. The default location has changed from ~/.nsolid-storage to ~/.nsolid-console. * The N|Solid 2.x Runtime is compatible with the N|Solid 3.x Console, but not all functionality will be available. * The environment variables used to configure N|Solid Runtime are the same as with N|Solid 2.x, however you must provide a valid license during any operation, either via a connection to an N|Solid Console, or by providing a License Token directly. Read the Configuration guide for more information. * The nsolid-cli syntax and behavior have changed from 2.x, be sure to read the Command Line Interface documentation if you use this functionality.
AWS Elastic Beanstalk, is an Amazon product for quickly deploying and managing scalable web applications. It reduces management complexity without restricting control of the infrastructure. You simply upload your application, and Elastic Beanstalk automatically handles the details of provisioning, load balancing, scaling, and monitoring.
They support Node.js among other technologies, but only official Node.js versions.
In this article we will explain how–with some minor changes—you can run an autoscaling application with N|Solid runtime in order to get information in another machine running N|Solid Console.
Starting with AWS Elastic Beanstalk
Before starting, you should have an AWS account and you should create a new Elastic Beanstalk application. To do that go to Elastic Beanstalk dashboard and follow the Elastic Beanstalk wizard after clicking the button of New Application. Add the details for your new application and then you're ready to go. To get more information about this process you can check the Getting started guide.
Workflow to deploy in AWS
Basically, this service allows you to upload a zip file with your application using the Versions section of Elastic Beanstalk dashboard but it also supports git to deploy, for more information about this method you can check here.
Installing N|Solid, N|Solid Storage, and N|Solid Console
In order to monitor your autoscaling application with the N|Solid Console, you should setup a separate instance running the N|Solid Storage, and the N|Solid Console. This machine will be the centralized point of information for your application and all instances running in the Elastic Beanstalk environment will connect there. This instance will not need a lot of resources so you can set up a small or even micro AWS EC2 instance.
The information about installing and configuring N|Solid 2.x can be found here
The information about installing and configuring N|Solid 3.x can be found here
More information about launching and working AWS EC2 instances can be found here.
Configuring security groups and ports
By default Elastic Beanstalk will create a security group for all instances launched by the application. This security group acts as a firewall for all instances launched. This means that you should configure the ports needed to operate with N|Solid, N|Solid Storage, and N|Solid Console.
The Security group for your application could be found in
Elastic Beanstalk environment > Configuration > Server and is easily identified because of the substring
AWSEBSecurityGroup in its name. The machine running N|Solid Storage and N|Solid Console should allow connections to TCP ports
9003 for N|Solid Storage and the
6753 for N|Solid Console, so find the security group associated for this instance and add the required rules.
More information about configuring AWS Security Groups can be found here.
Adding configuration to run N|Solid
Elastic Beanstalk supports provisioning extensions executing custom task and setting custom configurations in the environment at deploying time, they are called Beanstalk Extensions.
In order to run your application there with N|Solid Runtime you should follow these steps:
- Add to your project at the root a directory called
Inside create a file called
nsolid.configwith this content:
option_settings: - option_name: NODE_HOME value: /opt/nsolid - option_name: NSOLID_APPNAME value: my-app-name - option_name: NSOLID_COMMAND value: 10.0.0.4 - option_name: NODE_ENV value: production - namespace: aws:elasticbeanstalk:container:nodejs option_name: NodeCommand value: /opt/nsolid/bin/nsolid index.js sources: /opt/nsolid: https://s3-us-west-2.amazonaws.com/nodesource-public-downloads/2.1.3/artifacts/bundles/nsolid-bundle-v2.1.3-linux-x64.tar.gz commands: 01_move_nsolid: command: mv nsolid-bundle-v2.1.3-linux-x64/* ./ cwd: /opt/nsolid test: test ! -f /opt/nsolid/bin/nsolid
Be careful with indentation, this uses yaml formatting.
Customize these sections of the previous file to match your settings:
my-app-namewith the name that you want to display in N|Solid Console here:
- option_name: NSOLID_APPNAME value: my-app-name
10.0.0.4with the ip and port for your N|Solid Storage here:
- option_name: NSOLID_COMMAND value: 10.0.0.4
Customize the command running your application, N|Solid Runtime is being used to launch it, you just need to configure the script to execute and also add arguments if needed at the command line
- namespace: aws:elasticbeanstalk:container:nodejs option_name: NodeCommand value: /opt/nsolid/bin/nsolid index.js
Configure your application to serve in the port
8081, as this is the port where your application will be served and accessed by the load balancer
Finally, deploy your application in Elastic Beanstalk using your preferred method
After completing this process you should be able to see your application in N|Solid Console. In case of scaling, all new processes will be added there automatically.