Page tree

Michael O'Brien

Skip to end of metadata
Go to start of metadata

This page details a migration of an AWS elasticbeanstalk deployment of a Java microservice with an RDS backend database to docker, kubernetes and helm.

Spring boot based reference architecture - Reference Architecture

Spring boot war deployed to tomcat - Java Spring JPA Microservice on Kubernetes or EKS or ECS or Docker or Beanstalk or EC2 Tomcat Spring Boot

Spring boot jar running the spring embedded tomcat container - Spring Boot Microservice



Containerization of Maven Built Artifacts

DockerFile using tomcat image

FROM tomcat:8.0.48-jre8
COPY target/biometric.web-*-SNAPSHOT.war /usr/local/tomcat/webapps/biometric.web.war

DockerFile using alpine image

Build/Tag/Deploy Docker Image

see and under  BIOMETRIC-10 - Getting issue details... STATUS

obrienlabs:biometric.web.docker michaelobrien$ ./ 
Sending build context to Docker daemon  50.96MB
Step 1/2 : FROM tomcat:8.0.48-jre8
8.0.48-jre8: Pulling from library/tomcat
723254a2c089: Pull complete 
a23d5c1d9825: Pull complete 
Digest: sha256:b2cd0873b73036b3442c5794a6f79d554a4df26d95a40f5683383673a98f3330
Status: Downloaded newer image for tomcat:8.0.48-jre8
 ---> e072422ca96f
Step 2/2 : COPY target/biometric.web-*-SNAPSHOT.war /usr/local/tomcat/webapps/biometric.web.war
 ---> 5cd1152a967b
Successfully built 5cd1152a967b
Successfully tagged obrienlabs/biometric-web:latest
obrienlabs/biometric-web             latest              5cd1152a967b        1 second ago        608MB
Authenticating with existing credentials...
Login Succeeded
The push refers to repository []
2d64f287a896: Pushed 
7a5faefa0b46: Layer already exists 
d1a0f91a1ad8: Layer already exists 
c4d99fd86e94: Layer already exists 
04178c827c65: Layer already exists 
c571db474d75: Layer already exists 
93742a1ae069: Layer already exists 
7ffe9646653b: Layer already exists 
6ef532e39c1e: Layer already exists 
a4d7b0ac0438: Layer already exists 
06f4de5fefea: Layer already exists 
851f3e348c69: Layer already exists 
e27a10675c56: Layer already exists 
0.0.1: digest: sha256:dac09eb8c16fe9d5fb0080479e183acddbd178f77ab60d24fe7072aef0d7d073 size: 3048

Run Docker Image locally

obrienlabs:biometric.web.docker michaelobrien$ docker run /
  --name biometric_web \
  -d \
  -p 8888:8080 \
  -v ~/Dropbox/env/mbp4/biometric/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml \ 

obrienlabs:biometric.web.docker michaelobrien$ docker ps -a | grep biometric
f0f35ace3cac        obrienlabs/biometric-web   " run"        37 seconds ago      Up 36 seconds>8080/tcp   biometric_web
# check credentials
obrienlabs:biometric.web.docker michaelobrien$ docker exec -it biometric_web /bin/bash
root@f0f35ace3cac:/usr/local/tomcat# cat conf/tomcat-users.xml
  <role rolename="admin-gui"/>
  <user username="tomcat" password="tomcat" roles="manager-gui"/>


Check logs

obrienlabs:biometric.web.docker michaelobrien$ docker exec -it biometric_web /bin/bash
root@f0f35ace3cac:/usr/local/tomcat/logs# cat localhost.2019-09-04.log 

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'os.environment.configuration.dir' in string value "file://${os.environment.configuration.dir}/${os.environment.ecosystem}"

obrienlabs:biometric.web.docker michaelobrien$ docker stop biometric_web
obrienlabs:biometric.web.docker michaelobrien$ docker rm biometric_web
obrienlabs:biometric.web.docker michaelobrien$ docker run --name biometric_web -d -p 8888:8080 -v ~/Dropbox/env/mbp4/biometric/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml -v ~/Dropbox/env/mbp4/biometric/ -e os.environment.configuration.dir=/ -e os.environment.db.biometric.schema=biometric -e os.environment.db.url=jdbc... -e os.environment.db.username=yyyy -e os.environment.db.password=yyyy -e os.environment.discriminator=biometric -e os.environment.ecosystem=prod obrienlabs/biometric-web 

obrienlabs:biometric.web.docker michaelobrien$ docker exec -it biometric_web /bin/bash
root@af2c86207d63:/usr/local/tomcat# cat logs/localhost.2019-09-04.log 
04-Sep-2019 20:46:01.509 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
04-Sep-2019 20:46:01.664 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
04-Sep-2019 20:46:09.729 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
04-Sep-2019 20:46:09.729 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

Check website


Deployment to EC2

Deployment to ECS

Deployment to EKS

Deployment to Kubernetes

Deployment to Kubernetes on Docker Desktop

Deployment to Kubernetes on RKE

RDS for backend MySQL Database

  • No labels

1 Comment

  1. Figured out the issue of why the RDS tunnel is not connecting from inside docker - forgot that inside docker means "this" container itself - not the host machine where the tunnel is running. so will need to be "host.docker.internal" instead of when debugging appmgr locallythis works now
    connection = DriverManager.getConnection(
    "jdbc:mysql://host.docker.internal:3406/biometric?useSSL=" + useSSL, username, password);