This example uses the expressjs framework.
To run the server, follow these simple steps:
cd server/src
npm install
npm start | bunyan -o short
Alternatively you can run nodemon index.js | bunyan -o short
cd server
To build the docker image run docker build -t sb-greetings .
To run the container run docker run -d -p 3000:3000 --name sb-greetings sb-greetings
.
To remove the container docker rm -f sb-greetings
- Create Droptlet based on centos then follow the checklist for a complete setup of the server.
- Install Docker on it by following the Docker Doc or the [Digital Ocean Doc}(https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7}.
Digital Ocean - Docker System Introduction
Follow those tracks:
GET http://localhost:3000/greetings/hello?name=
GET http://localhost:3000/greetings/bye?name=
Log is done with bunyan. Bunyan is "Logs for MAchines oriented, read this post for further details.
Driving ideas:
- Logs for MAchines oriented for further details.
- Each request should have a unique id present in all logs for better tracking of request processing. Use domain to get current request from anywhere in the code in order to add requestId to the log even if request is not in the arguments of the funciton as describe in this [post](http://stackoverflow.com/questions/12575858/is-it-possible-to-get-the-current-request-that-is-being-served-by-node-js.
- All general ideas from O'Reilly - Programming Javascript Application - Logging
Travis integration is enabled through "Repo/Settings/Webhooks & services"
On Travis side repo hook should be as well enabled.
.travis.yml contains all commands that Travis need to execute launch a build (docs on NodeJS integration)
Build details and logs can be checked on Travis website
According to default configuration every push on every branch will trigger a build (pull requests merge as well).
Repo README.md contains a link to the latest build status which si shown as an icon:
[![Build Status](https://travis-ci.org/mag3io/sb-greetings.svg?branch=master)](https://travis-ci.org/mag3io/sb-greetings)