Trying to deploy my first Java web app to Google Kubernetes. It must have 3 containers.
1 - front end web app
2 - back end Java web app- Jersey web service
3 - postgres server
The whole web app is working on Eclipse Jee (Tomcat) on my laptop with no issue. The web app is very simple SPA with no maven or gradle build. For backend: Dockerfile
FROM tomcat:9.0
ADD backend.war /usr/local/tomcat/webapps/backend.war
EXPOSE 8080
The image from the above is working fine. But for front end web app, I am really confused. Tried following variants without any success: a)
FROM tomcat:9.0
ADD frontend.war /usr/local/tomcat/webapps/frontend.war
b)
FROM tomcat:9.0
COPY frontend.war /usr/local/tomcat/webapps/frontend.war
EXPOSE 8080
c)
FROM 8.0-jre8-alpine
COPY frontend.war /usr/local/tomcat/webapps/frontend.war
When I tried to access my site using the loadbalancer IP which google provided on browser, getting Not reachable message.
Here is my sample web application with backend as mysql database.
Front-end Dockerfile
FROM tomcat:9.0
ADD art-gallery-management.war /usr/local/tomcat/webapps/art-gallery-management.war
WORKDIR /usr/local/tomcat/
CMD ["catalina.sh" "run"]
EXPOSE 8080/tcp
Back-end Dockerfile
FROM mysql:latest
WORKDIR /docker-entrypoint-initdb.d
ADD Schema.sql /docker-entrypoint-initdb.d
CMD ["mysqld"]
EXPOSE 3306/tcp
Starting containers
docker container run -d --name art-gallery-management-db -e MYSQL_ROOT_PASSWORD=vision -p 3306:3306 bukkasamudram/art-gallery-management:db-latest
docker container run -d --name art-gallery-management-app --link art-gallery-management-db -p 8090:8080 bukkasamudram/art-gallery-management:app-latest
Make sure to use link option to link front-end container with back-end container.