Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a microservice

Building a microservice

How to create a basic microservice? What technologies to use?

Julian Espinel

May 23, 2015
Tweet

More Decks by Julian Espinel

Other Decks in Programming

Transcript

  1. Agenda 1. What is a microservice? (Fast!) 2. Let's build

    a microservice 3. Continuous Integration (CI) 4. Deploying in DigitalOcean 5. Q&A 6. References
  2. 1. What is a microservice? "Designing software applications as suites

    of independently deployable services." Martin Fowler
  3. 1. What is a microservice? Each service: 1. Responsible for

    a business capability. 2. Run in its own process. 3. Independently deployable.
  4. 2. Let's build a microservice Basic CRUD microservice of movies.

    1. Create a movie 2. Read (find) a movie 3. Update a movie 4. Delete a movie
  5. 2. Let's build a microservice { "Title": "The Matrix", "Year":

    "1999", "Rated": "R", "Released": "31 Mar 1999", "Runtime": "136 min", "Genre": "Action, Sci-Fi", "Director": "Andy Wachowski, Lana Wachowski", "Writer": "Andy Wachowski, Lana Wachowski", "Actors": "Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving", "Plot": "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.", "Language": "English", "Country": "USA, Australia", "Awards": "Won 4 Oscars. Another 34 wins & 39 nominations.", "Poster": "http://ia.media-imdb.com/images/M/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQx MTE@._V1_SX300.jpg", "Metascore": "73", "imdbRating": "8.7", "imdbVotes": "1023621", "imdbID": "tt0133093", "Type": "movie", "Response": "True" }
  6. 2. Let's build a microservice What are we going to

    need? 1. HTTP server to expose the API to the world. 2. A DB to store the movies info. 3. Tests to make Continuous Integration. 4. Be able to deploy the system independently.
  7. 2. Let's build a microservice Dropwizard is a Java framework

    for developing ops-friendly, high-performance, RESTful web services. http://www.dropwizard.io
  8. 2. Let's build a microservice Dropwizard Nothing more than a

    set of great libraries. Jackson Metrics
  9. 2. Let's build a microservice Let's write some code! Source

    code: https://github.com/julianespinel/movies
  10. 3. Continuous Integration "Continuous Integration doesn’t get rid of bugs,

    but it does make them dramatically easier to find and remove." Martin Fowler
  11. 4. Deploying in DigitalOcean Steps: 1. Create an account 2.

    Create a droplet 3. Provision that droplet (We can do this effectively with docker, may be in other talk!) 4. Install Jenkins 5. Configure Jenkins 6. Pull our microservice code 7. Do continuous integration (CI) 8. Build the microservice 9. Deploy the microserice 10. Use it from your browser
  12. 6. References 1. http://martinfowler.com/articles/microservices.html 2. http://www.thoughtworks.com/insights/blog/microservices-nutshell 3. http://sanderhoogendoorn.com/blog/index.php/microservices-the-good-the- bad-and-the-ugly/ 4.

    http://microservices.io/patterns/monolithic.html 5. http://martinfowler.com/articles/continuousIntegration.html 6. http://martinfowler.com/bliki/ContinuousDelivery.html 7. http://www.dropwizard.io/ 8. https://jenkins-ci.org/ 9. https://www.digitalocean.com/