Skip to content

Latest commit

 

History

History

lagomKubeServiceRegister

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Building a Lagom Kube Service Registry and packing it into a Docker container

  1. Paste your Docker ID into the build.sbt file:

    ...
    dockerRepository := Some("docker.io/YOUR_DOCKER_REPOSITORY")
    ...

    If you don't already have a Docker ID, create a Docker account at the Docker Cloud.

  2. Set up the lagomServiceLocator dependency

    • To use lagomServiceLocator locally:

      git clone -b '1.3.4' --single-branch https://github.com/lagom/lagom.git
      
      cd lagom
      
      sbt
      
      project service-locator
      
      publishLocal
      
    • To download the lagomServiceLocator dependency automatically:

      If you don't want to use lagomServiceLocator locally, comment-out line 13

      ...
      // "com.lightbend.lagom" %% "lagom-service-locator" % "1.3.3"
      ...

      and uncomment line 22

      ...
      .dependsOn(lagomServiceLocator)
      ...

      in the build.sbt file.

  3. Download, install and run the Docker toolbox

  4. Run Lagom Kube Service Registry on a local machine in development mode

    • Download and install DBeaver, a free universal SQL client

    • Install Apache Cassandra inside of a docker container:

      docker run -d -p 7000-7001:7000-7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 cassandra:3

    • If Cassandra does not run locally, update the cassandra connection ip variable in [build.sbt][kube-service-registry-sbt-2931]:

      ...
      System.setProperty("CASSANDRA_CONNECTION_IP", "127.0.0.1")
      ...
    • Run the Service Registry in development mode:

      cd lagomKubeServiceRegister
      sbt
      setEnvTask
      run
  5. Build the Docker container

    • update docker repository settings in build.sbt

          ...
              dockerRepository := Some("docker.io/YOUR_DOCKER_REPOSITORY"),
          ...
    • In the lagomKubeServiceRegister folder, create and publish a Docker image:

      cd lagomKubeServiceRegister
      sbt docker:publish
    • To make sure that the Docker image has been created:

      docker images
  6. Push the image to the Docker hub as described in the Docker documentation