Giter Site home page Giter Site logo

todo's Introduction

Demo App

The app used in this comparason is written in nodejs using the expressjs framework. Initially I created it using mongoDb as a backend locally so i could deploy it to AWS and converting the data layer to leverage documentDb when deploying to Azure. The tools used were sublime text for text editing and bower for retrieveing front end assets.

The app is a simple single page app that has three endpoints to get todo tasks, create todo tasks and to complete todo tasks. The frontend code uses angular to utilize the full MEAN (MongoDb, ExpressJs, AngularJs, NodeJs) stack.

Cloud Deployment Shootout

Both AWS and Azure provide simular products for deploying web apps but the experience and steps required are very different. AWS provides a set of custom command line tools that hook into you git repository to deploy your current branch. Whereas Azure provides a much wider and range of ways to deploy your web app to the cloud. you can setup a traditional git repo in azure to push you content to (no extra tools required) or have azure point to your current source control to pull changes or even your onedrive account.

AWS

Get tools

Get credentials

  • Sign into AWS and navigate to the EC2 service
  • Click on the link to key pairs
  • Create a new key pair

The key pair will allow us to connect to the EC2 instance that is created as part of the deployment

  • Click on your username in the top right of the website and select "Security Credentials"
  • Create a new access key (Access Key ID and Secret Access Key)
  • Save the generated credentials somewhere sercure.

Deploy app

  • Open a command prompt in your project directory
  • If you do not have a git repo create one, add the files and commit.

The ElasticBeanstalk tools will hook into your git branch and deploy the latest commit

  • Enter the following command : eb init
  • You will then be prompted for a environment name and the Elastic Beanstalk instance that the deployment will generate, the key pair to use and the type of deployment (NodeJS)
  • You will also be prompted for the Access Key ID and Secret Access Key generated earlier
  • Enter the following command: eb create

Install mongoDB on the EC2 instance

Elastic Beanstalk automates the process of deploying web applications to EC2 Instances, You could alternativly spin up a EC2 instance and deploy yourself but it would require installing all dependencies manually

  • Select your newly deployed instance and get the Public DNS

  • Enter the host name ec2-user@<Your Public DNS>

  • Open the SSH tab and select auth

  • Under authentication parameters click "Browse" and select the .ppk file created earlier

  • Click open

  • Once the console is logged in run the following commands :

    • Add the mongoDb repo source
    echo "[10gen]
    name=10gen Repository
    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
    gpgcheck=0" | sudo tee -a /etc/yum.repos.d/10gen.repo
    
    • Install MongoDB and the sysstat diagnostic tools
    sudo yum -y install mongo-10gen-server mongodb-org-shell
    sudo yum -y install sysstat
    
    • Create the data directories
    sudo mkdir /var/lib/mongo/data
    sudo mkdir /var/lib/mongo/log
    sudo mkdir /var/lib/mongo/journal
    
    • Set the storage items (data, log, journal) to be owned by the user (mongod) and group (mongod) that MongoDB will be starting under
    sudo chown mongod:mongod /var/lib/mongo/data
    sudo chown mongod:mongod /var/lib/mongo/log
    sudo chown mongod:mongod /var/lib/mongo/journal
    
    • Start MongoDb
    sudo chkconfig mongod on
    sudo /etc/init.d/mongod start
    
  • Browse to your deployed web app.

Azure

Create Azure Website and database

  • Login to the Azure
  • Create a resource group
  • Create a web app in the resource group
  • create a documentDb instance in the resource group
  • Navigate to the webapp and select the continous deployment option
  • Choose source of local Git Repository
  • Navigate to the properties and select the Git Url
  • Open a command prompt in you project directory
  • If you do not have a git repo create one
  • Change the database script to point to the document db version in the route/index.js file and credentials to point at your documentDb, add the files and commit.
  • Run the following commands

git remote add azure <Your Git Url>
git push azure

  • Browse to your deployed web app.

References

todo's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.