Please note that the code verification service URL has been shifted to http://162.222.183.53. The URL has been updated in this example app.
- If you have a Python Box, terminate it, OR create another Nitrous.IO account for Node.js
- Follow the SSH Lab to create an SSH key pair for this box
- Clone this repository
cd ~/ && git clone https://github.com/andrewbeng89/gamebots.git -b master
cd gamebots
- Reomve the .git directory
rm -rf .git
- Create a new GitHub repository with your account
- Initialise the demo app as a git repo in Nitrous.IO
git init
- Add the remote to the newly create GitHub repository
git remote add origin [email protected]:<your_username>/<your_new_repo>.git
- Run the GameBots app in the Nitrous.IO environment:
node app
- Sign up for Elastic Beanstalk, make sure you have created an AWS Secret Key
- From the Nitrous.IO terminal, navigate to "home":
cd ~/
- Download the modified version of the EB CLI Tools from the Nitrous.IO terminal:
wget https://dl.dropboxusercontent.com/u/6484381/AWS-ElasticBeanstalk-CLI-2.6.0.zip
- Unzip:
unzip AWS-ElasticBeanstalk-CLI-2.6.0.zip
- Edit the
.bashrc
file using the IDE to add the PATH for the EB tools to the end of the file:export PATH=$PATH:$PWD/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python2.7
source .bashrc
to refresh bash.- Navigate to application folder:
cd gamebots
- Initialise a new EB application:
eb init
- When prompted, enter your AWS Access Key ID and Secret respectively
- Select
Asia Pacific (Singapore)
when prompted for the region - Enter an application name:
<yourname>-gamebots
- Use this application name for environment name as well
- Select
WebServer::Standard::1.0
when promted for environment tier - Select option 12 for "solution stack" (64bit Amazon Linux 2014.02 running Node.js)
- Select single or load balanced environment type
- Do not create an RDS DB instance
- Start the environment:
eb start
git add -A .
git commit -a -m "creating new gamebots project"
git push origin master && git aws.push
- Visit the Elastic Beanstalk Console to view your application's build status
- Register for Travis-CI using your GitHub account
- From your Travis-CI profile page, enable the newly created GitHub repository
The Travi-CI gem will be used to encrypt a OAuth2 token that will be used to push updates to Google App Engine from the Travis build.
- From the terminal, install the gem by entering
gem install travis
- If you haven't, create an Access Key with a corresponding ID and Secret here
- From the EC2 console, create a new Key Pair
- Copy the values of the Access Key and Secret
These lines in the .travis.yml file automates the updates to EB. The AWS Access Key ID and Secrets will be encrypted by travis and used upon a successful build.
after_success:
- wget https://dl.dropboxusercontent.com/u/6484381/AWS-ElasticBeanstalk-CLI-2.6.0.zip
- unzip AWS-ElasticBeanstalk-CLI-2.6.0.zip
- export PATH=$PATH:$PWD/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python2.7
- echo "no"|eb init -S $AWS_ACCESS_SECRET -I $AWS_ACCESS_KEY -a gamebots -e gamebots-env
--region "ap-southeast-1" -t "WebServer::Standard::1.0" -s "64bit Amazon Linux 2014.02 running Node.js" -f
- eb push
- Encrypt you AWS Access Key ID with the travis gem:
travis encrypt AWS_ACCESS_KEY="<paste_key_id_from_clipboard>" --add
- Encrypt you AWS Access Key Secret with the travis gem:
travis encrypt AWS_ACCESS_SECRET="<paste_key_secret_from_clipboard>" --add
- Edit this line of the .travis.yml file:
-a <name-of-your-app> -e <name-of-your-app>-env
The Mocha module allows developers to create simple functional and unit tests. In this sample app, the tests are in the /test/test.js file. This file tests the funcitonality of a single API call /test. To break this test:
- Comment out lines 43-47 in /app.js
- Commit and push the changes
- Track the build progress on travis-ci
For for information on application development in the Cloud, including AngularJS, MongoDB and creating JSON APIs with Node.JS, please refer to this repository.