Skip to content

Latest commit

 

History

History

service-registry

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Java Microservice - Service Registry

Dependencies

Configuration

src/main/docker/app.yml

version: '3.8'
services:
  service-registry:
    image: cevheri/service-registry
    environment:
      - _JAVA_OPTIONS=-Xmx512m -Xms256m
    ports:
      - 8761:8761

Development

$ ./mvnw package
$ java -jar target/*.jar

Visit : http://localhost:8761/


Production With Docker

We will create Docker Image using Google Container Tools and run this Docker Image with Docker Compose.

Build docker image:

$ ./mvnw -Pprod clean verify jib:dockerBuild

...
[INFO] Executing tasks:
[INFO] [==============================] 100.0% complete
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  17.728 s
[INFO] Finished at: 21:45:11+03:00
[INFO] ------------------------------------------------------------------------

Run:

$ docker-compose -f src/main/docker/app.yml up -d

Creating docker_service-registry_1 ... done

Visit : http://service-registry:8761/


View docker images:

$ docker images

REPOSITORY                   TAG            IMAGE ID       CREATED          SIZE
cevheri/service-registry     latest         3d6fd7dccfb5   14 minutes ago   291MB

View docker containers:

$ docker ps

CONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS          PORTS                                       NAMES
fac279d0d208   cevheri/service-registry   "bash -c /entrypoint…"   18 seconds ago   Up 16 seconds   0.0.0.0:8761->8761/tcp, :::8761->8761/tcp   docker_service-registry_1

Stop Docker Compose:

$ docker-compose -f src/main/docker/app.yml down

Screenshots