In this quick write up we are going to show you how to get LoopBack, an open source API server and StrongOps, a Node performance monitoring and cluster manager, up and running on Amazon’s Elastic Beanstalk.
What is Elastic Beanstalk?
With AWS Elastic Beanstalk, you can quickly deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs those applications. AWS Elastic Beanstalk reduces management complexity without restricting choice or control. You simply upload your application, and AWS Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.
If you are new to Amazon Web Services, you can sign up here and check out their free tier.
Ok, let’s get started…
Install StrongLoop locally
Install the LoopBack API tier and sample application plus the StrongOps performance monitoring dashboard locally, by following these instructions.
Note: These instructions assume you already have Node installed and aren’t running a previous version of StrongLoop. Platform specific instructions on how to install Node, individual StrongLoop components, plus how to upgrade can be found here.
1. Install the StrongLoop Command Line Interface (cli)
$ npm install -g strong-cli
If you get permission errors, re-run commands with sudo
2. Verify your installation
$ slc version
3. Install the sample LoopBack application
$ slc example
$ cd sls-sample-app
4. Install and setup the StrongOps agent
$ slc strongops --register
5. Provide your full name, email and password when prompted
6. Create a StrongLoop account to access your StrongOps dashboard
Use the same “email” and “password” you provided in Step #5.
7. Populate the StrongOps dashboard with data by running the LoopBack sample app.
$ slc run .
8. You can now browse the LoopBack sample app at the URL below
9. Start up a load generator to make the data that populates the StrongOps dashboard more interesting by opening up a new shell and executing:
$ cd sls-sample-app
$ slc run bin/create-load.js
10. Your dashboard is now ready
You will not see any data until your application has been running for a few minutes, so please be patient!
Zip up your application files
Compress your application files into a zip file, in this case the application is the LoopBack sample app called, “sls-sample-app”.
Add the sample application to Elastic Beanstalk
Head on over to the Elastic Beanstalk Management Console and preform these actions:
- Actions > Launch New Environment. If it’s your first application, click Create New Application.
- Enter a name for your application.
- For Environment tier choose Web Server.
- For Predefined configuration choose Node.js.
- For Environment type choose single instance and click Continue.
- Under Application Version, Choose Upload your own, click Choose File, then select the zip file you created in Step 3.
- Enter a name, URL and description for your environment and click Continue.
- Select Additional Resources if you need them then click Continue.
- Under Configuration details, select instance type as micro. If you need SSH access to your virtual machine, select a key pair or create one. Enter all the other information such as email address you require then click Continue.
- Review all the information then click Create.
- This will start your LoopBack application. You can access your app by clicking on the link <environment_name>.elasticbeanstalk.com/explorer shown in the title of the managment console.
- If you enabled StrongOps monitoring, you can then view application metrics in the StrongOps dashboard once you’re logged in.
Note: We recommend using Node 0.10.22. To change the version of node in your environment, click on Configuration > Software Configuration and edit the Node version to 0.10.22.
- Get the technical paper on how to “mobilize” data with models in LoopBack.
- Check out this short video on how the new features in StrongOps 2.0 including: memory and heap profiling, error detection and cluster management work.
- Do you want to keep up on the latest Node, Mobile and StrongLoop news? Sign up for our newsletter, “In the Loop” or follow us on Twitter.