Coder Social home page Coder Social logo

cinema-microservice's Introduction

Build a NodeJS microservice and deploy it to Docker

This is the repo example for the article.

Stack

We’ll use a simple NodeJS service with a MongoDB for our backend.

  • NodeJS 7.5.0
  • MongoDB 3.4.2
  • Docker for Mac 1.13.0

Microservices

How to run the cinema microservice

We need to have docker installed previously.

$ bash < kraken.sh

This will basically install every microservice and setup the docker swarm cluster

and deploy every docker service in the swarm.

To monitor the cluster in a graphic mode we can go and visit the following url: http://192.168.99.100:9000

and this will give us the rancherOS web interface.

Blog posts

LICENSE

The MIT License (MIT)

Copyright (c) 2017 Cristian Ramirez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cinema-microservice's People

Contributors

andrewwoz avatar crizstian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cinema-microservice's Issues

Duplicate code

Hi . Why is there a duplicate code in each service like di folder

Is it not better to create a parent repo and do all stuff there and include the parent as a package in package.json ?

And what can I do if I have 6 repo with 6 micro service
How I will update all file the 6 reps ?

Thanks for your very nice tutorials

Timeout errors in tests

I'm getting following on newly setup step-1 project. Any ideas why?


6 passing (12s)
  3 failing

  1) Mongo Connection should emit db Object with an EventEmitter:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.


  2) Repository should get movie premiers:
     Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.


  3) Repository should get movie by id:
     Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

License missing...

Hello Crizstian,

Thanks for putting this here. I wanted to use these tutorials and modify them to deploy on CloudFoundry instead of Docker. But there is no license mentioned any where and I hesitate to use it without seeing a license. Would be great if you can include something like AGPLv2 or MIT.

Keep up the good work.

Docker errors

Hi,
When I run kraken.sh I get the following errors:
docker: Error response from daemon: error while creating mount source path '/Users/Cramirez/.docker/machine/machines/manager1': mkdir /Users/Cramirez: protocol error.

docker: Error response from daemon: error while creating mount source path '/Users/Cramirez/.docker/machine/machines/worker1': mkdir /Users/Cramirez: protocol error.

docker: Error response from daemon: error while creating mount source path '/Users/Cramirez/.docker/machine/machines/worker2': mkdir /Users/Cramirez: protocol error.

Error: No such container: api-gateway-service

Error: No such image: api-gateway-service

I can open Rancher although I can't see any workers.
Any ideas? Sorry is this is really simple I am new to Microservices and Docker.

Thanks,
Jamie

Just a Thank you

Just wanted to drop a line saying thank you for publishing this! I get Docker, I get Microservices, all conceptually, but I was really struggling to put it all together the way I wanted. Every example I found was so limited, then I found this. THANK YOU sir, this is an amazing architecture! I will be building out HapiJS/Seneca Microservices using the pattern in this library.

Nice work!

server.js ?

hi,
why in your server.js the err middleware is before the api function?

container.registerValue is not a function in booking-service/src/index.js

Running npm start

I get the error : container.registerValue is not a function when i add a catch the Promise reject in src/index.js as below

mediator.on('di.ready', (container) => {
  repository.connect(container)
    .then(repo => {
      console.log('Connected. Starting Server')
      container.registerValue({repo})
      return server.start(container)
    })
    .then(app => {
      console.log(`Server started succesfully, running on port: ${container.cradle.serverSettings.port}.`)
      app.on('close', () => {
        container.resolve('repo').disconnect()
      })
    })
    .catch((err) => {
      console.log('Promise errorrr!');
      console.log(err);
    })
})

I realise that the container that is created with 'awilix' does not contain this function normally nor does the di.proto.js create this function, am i missing something here ?

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.