Coder Social home page Coder Social logo

microservice-course's Introduction

microservice-course

We will create an API server used to do full text search, via Elasticsearch, in sport facilities list in Paris deployed with docker and docker-compose.

Step 1

Create a Dockerfile to deploy the Golang application in main.go. It is recommended to use the official golang:1.12 image.

When you start the application with the following command:

docker run -it --rm <your image name>

The application should panic with the following error:

panic: health check timeout: Head http://127.0.0.1:9200: dial tcp 127.0.0.1:9200: connect: connection refused: no Elasticsearch node available

goroutine 1 [running]:
main.main()
	/usr/src/main.go:76 +0xdc2

At this point, try to identify why the application is returning an error and what should we do avoid it.

Useful documentation:

Step 2

Use docker-compose to run an Elasticsearch cluster besides the application.

NOTE: the Elasticsearch cluster can't start without the env var dicovery.type=single-node.

At this point, the application should start and load data into the Elasticsearch cluster if necessary. You can reset the Elasticsearch index with the following command:

curl -XDELETE http://<hostname of the elasticsearch container>:9200/_all

After starting (it could take multiple seconds the first time), the service should be available and you can test it with the following command:

curl http://<hostname of the application container>:<port exposed>/search?q=Paris

Useful documentation:

Petclinic features https://docs.google.com/document/d/1V28rAQzsKc9_5XF5kljyKiOLF0OjbbeBwZY3qXyIwNw

microservice-course's People

Contributors

lukkor avatar tauffredou avatar

Watchers

 avatar  avatar

Forkers

lcolat

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.