Code Monkey home page Code Monkey logo

hybrid-app's Introduction

Hybrid Application

This application demonstrates running both Linux and Windows containers within the same cluster. The application is used in the Docker Enterprise Edition workshop.

The purpose of this tutorial is demonstrate how an application can be deployed in different scenarios using Docker Enterprise Edition or Docker Community Edition. The first scenario is a monolithic Java CRUD (Create Read Update Delete) application that uses Springboot, Java Server Pages and MySQL. The second scenario adds a REST microservice written with .Net Framework and running in a Windows container. The third scenario uses a REST microservice written with .Net Core running in a Linux container. Each scenario uses a different orchestrator to deploy the application.

MySQL Database

All three scenarios use a MySQL database to store data. To build the container:

$ cd ./database
$ docker image build -t database .

Java Application

The Java application is in the java-app directory. To build the application, follow the instructions in the application directory or build it locally:

$ cd ./java-app
$ docker image build -t java-web .

To deploy both the application and the database, we use a Docker Compose file.

To start the application user Docker Compose:

$ cd ./hybrid-app
$ docker-compose -f ./app/docker-compose-java.yml up -d

To try out the application go to http://localhost:8080/java-web.

To shut down the application:

$ docker-compose down

Java and .Net Framework Application

This version of the application introduces a REST microservice written in .Net Framework and running in a Windows container that reads and writes to the MySQL database. The Java application was rewritten to use the microservice instead of Spring Data JPA to communicate with the database.

Instructions for building the updated Java application are in the java-app-v2 directory or to just build the image:

C:\> cd .\java-app-v2
C:\> docker image build -t java_web:2 .

The .Net Framework microservice must be built in a Windows host, clone the repository and build the image:

C:\> git clone https://github.com/dockersamples/hybrid-app.git
C:\> cd .hybrid-app\netfx-api
C:\> docker image build -t dotnet_api .

Instructions for deploying on Docker EE are available in the Docker EE Workshop which uses Play With Docker, an on line Docker environment.

To run the application locally in Docker for Windows CE Edge:

C:\> docker swarm init
C:\> cd .\hybrid-app
C:\> docker stack deploy -c .\app\docker-stack-netfx.yml signup

To shutdown the application:

C:\> docker stack rm signup

Java and .Net Core Application

In this scenario, we'll reuse the java_web:2 container and build a new image of the REST microservice using .Net Core which runs in a Linux container.

To build the the .Net Core microservice:

$ cd ./dotnet-api
$ docker image build -t dotnet_api:core .

To deploy the application in Docker EE using Kubernetes, follow the instructions in Task 4 of the Docker EE Workshop.

To deploy the application locally with Kubernetes in a single node cluster on either Docker for Mac CE Edge or Docker for Windows CE Edge, check that kubernetes is the orchestrator:

$ kubectl config current-context
docker-for-desktop

To run the application:

$ docker stack deploy -c ./app/docker-stack-k8s.yml signup

To shutdown the application:

$ docker stack rm signup

hybrid-app's People

Contributors

manomarks avatar sixeyed avatar spara avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hybrid-app's Issues

null networks in stack

in /app/docker-stack-hybrid.yml and /app/docker-stack.yml there's a few places where networks are referred to as null:

networks:
      back-tier: null

is this a file format artifact?

Tweet at each stage of the workshop

In the previous version of the workshop, when an attendee completed the Linux part of the workshop successfully, he was provided a page that could be tweeted from the Linux container and the same was also when the Windows container of the workshop was completed. This served as useful gateway markers of the workshop and also fostered a sense of achievement for the attendee and s/he could let the world know about it.

fix login method to mysql

The newer versions of MySQL default to caching_sha2_password and not the old mysql_native_password that the plugins seem to want to use.

add an api check in the main java webapp screen

right now to test that the app is connected to the api, you need to create a user, then login.
Add a line at the top of the main screen that displays the number of users in the system or something that can be pulled from the api, or an error message if the api cannot be reached. so you know right away if the system is healthy.

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.