Skip to content

aslaners/micro_service

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Openshift 3.2 Node.js Microservice.

Node6, Docker & Openshift 3 ready microservice template.

Node.js RESTful scaffolding

Folders

routes/

Documentation

controller/crud

  • Class for CRUD functionality.

controller/

  • Put here classes to decorate crud default behaviour. (eg you want to implement a special type of search.)
  • Documentation

db/

ws

  • node soap client node-soap for quick integration with soap endpoints service.
  • long pulling functionality plus circuit breaker.

util/errors

  • error handling middleware.

routers/basic

  • create a basic router with body-parser and CORS enabled.

Dependencies

  • Mocha framework
  • Chai assertions library.
  • CORS
  • BodyParser
  • Mongoskin

How to run this

Openshift 3

Using Openshift Dashboard

Openshift 3.x

Console

oc login https://10.2.2.2:8443    #if your are using vagrant box; https://ip-addr:8443 otherwise.   

# Install the openshift-template, you need to edit the template to use the appropiate builder-image for Node.js v6.
# You just need to edit the BuilderConfig object for this.  
oc create -f openshift3/node-mongo.json

oc project <your project>  # jump to the project

# create the new app, this will create two pods one node.js & mongodb.
oc new-app nodejs6-mongodb  
  -p APPLICATION_NAME=<name_of_your_app> \
     SOURCE_REPOSITORY_URL=https://github.com/cesarvr/micro_service \
     DATABASE_USER=<user> \
     DATABASE_PASSWORD=<psw> \
     DATABASE_NAME=<dbname> \
     DATABASE_ADMIN_PASSWORD=<admin_db>          

### Docker

# boot up your docker mongodb
# docker run -d -p 27017:27017 mongo

#clone the repo and jump inside.
docker build -t node6 .

# it just create a container and make that container mount your work(current) folder.
docker run -it -d -e "MONGO_URL=mongodb://@ip-addr:27017/test" \
       -m "300M" --memory-swap "1G" \
       -p 8080:8080 -v $(echo $PWD):/usr/src/app  \
       --name micro_service node6 node application
http://localhost:8080  #Service deployed here.

Relevant links

Logging

Containers and Orchestration

About

Microservice template for node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.5%
  • Shell 0.5%