Public | Automated Build

Last pushed: 2 years ago
Short Description
nodejs,express,sockets,charts,google 2Fa, guthub/docker/tutum/digitalocean CD pipeline
Full Description

AngularJS sockets.io, google two factor authentication via GoogleAuthenticator and Docker -> Tutum -> digitalOcean Continuous delivery pipeline

Uses mutual client-server ssl authentication, client certificate available at:

https://github.com/tsonev/my_docker_node_app/tree/master/server/config/ssl

pfx password: pass:x

The angularjs app itself uses nodejs os api to display Average CPU load + memory used.

*Due to the fact that average load is valid only for unix systems, this app will return 0 for cpu load on windows

npm install

bower install

Now we are ready to start the server:

$ node server/app.js
Express server listening on 9000, in development mode

Open your browser and yo should see the app in http://localhost:9000

Tests

run the tests with

$ npm test

Docker

Installation

1) Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2) Install Homebrew Cask (for installing bin files through Homebrew)

$ brew install caskroom/cask/brew-cask

3) Install VirtualBox (needed to run Docker in Mac OS X)

$ brew cask install virtualbox

4) Install Docker

$ brew install docker

5) Install boot2docker (a virtual machine to run Docker)

$ brew install boot2docker

Start Docker

To start Docker run:

$ boot2docker up

So follow the instructions to connect the Docker client, use the values provided in your terminal, (i.e. <user> should be your user)

$ export DOCKER_TLS_VERIFY=1
$ export DOCKER_HOST=tcp://192.168.59.103:2376
$ export DOCKER_CERT_PATH=/Users/<user>/.boot2docker/certs/boot2docker-vm
$ docker build -t app .

To see the newly created image run docker images you should see something like:

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
app                 latest              4ad898544bec        4 minutes ago       751.6 MB

Run a Docker container

To run a container using the image we just created run:

$ docker run -d --name my_app -p 80:9000 app

This will run a container in the background (dettached) -d with the --name my_app
map port -p 80 to port 9000
from the image named app

To see our app inside the container we will need to know the ip of the virtual machine (boot2docker) to know that simply run:

$ boot2docker ip

Go to your browser and enter that ip, you should see the app.

Other Docker commands

To see running containers use docker ps

To see all containers use docker ps -a

To stop a container use docker stop <container_id_or_name>

To start an existing container use docker start <container_id_or_name>

To see the logs of a container use docker logs -f <container_id_or_name> -f is optional, will keep STDIN attached to current terminal

Docker Pull Command
Owner
tsonev
Source Repository

Comments (0)