View on GitHub

Make your Microservices sing!

Presentation and code examples from Oracle Code Sydney

Overview

This is a collection of supporting material from the Make you Microservices sing! talk at Oracle Code Sydney on the 18th of July, 2017.

The presentation

The presentation slides are available here.

The code

Prerequisites for running the examples

Run the MedRec Monolithic example

  1. Follow the first two steps here to ensure you have connected to Oracle Container Registry.
  2. Pull down the Oracle WebLogic Domain image with the command
    docker pull container-registry.oracle.com/middleware/weblogic:12.2.1.1
    
  3. Checkout the medrec monolithic codebase and navigate to it
    git clone https://github.com/craigbarrau/medrec-monolith
    cd medrec-monolith
    
  4. Install WebLogic natively and select the option to include the samples. We need to do this to get access to the MedRec source and distribution files. Sorry about the extra pain but this is the only way to get the sample source code and/or distribution ear files. They are not shared on a public repository by Oracle other than via download of WebLogic from here. You will need an Oracle account to download.
  5. After installation, copy medrec.ear and physician.ear from the local WebLogic installation (refered to as ORACLE_HOME) to the medrec-monolith directory which we previously cloned from git
    cp $ORACLE_HOME/wlserver/samples/server/medrec/dist/standalone/medrec.ear .
    cp $ORACLE_HOME/wlserver/samples/server/medrec/dist/standalone/physician.ear .
    
  6. Copy medrec-data-import.jar and medrec-domain.jar to the seed directory. We will need to use these when we seed the data for the MedRec application
    mkdir -p seed
    cp $ORACLE_HOME/wlserver/samples/server/medrec/dist/modules/medrec-data-import.jar seed/.
    cp $ORACLE_HOME/wlserver/samples/server/medrec/dist/modules/medrec-domain.jar seed/.
    
  7. Navigate ot the medrec-monolithic directory and run
    docker build -t medrec-monolith .
    
  8. Run the medrec-monolith container image that we built in the previous step
    docker run -d -p 7001:7001 --name medrec medrec-monolith 
    

    Wait for the instance to startup at http://localhost:7001/medrec.

We can tail the logs with docker logs -f medrec. We know it is running when we see a log message like this:

<Jul 19, 2017, 12:23:01,939 AM UTC> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> 
<Jul 19, 2017, 12:23:01,965 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>

Seed the data for our monolithic MedRec application by running the following

docker exec -ti medrec /bin/bash -c "java -classpath \$ORACLE_HOME/seed/medrec-data-import.jar:\$ORACLE_HOME/seed/medrec-domain.jar:\$ORACLE_HOME/wlserver/common/derby/lib/derbyclient.jar:\$ORACLE_HOME/wlserver/server/lib/weblogic.jar com.oracle.medrec.util.DataImporter"

If it is successful we should see the message All the data has been imported successfully!

We can access our application at http://localhost:7001/medrec

Run the MedRec Physicians NodeJS Microservice

  1. Checkout the Physicians project
    git clone https://github.com/craigbarrau/medrec-physicians
    
  2. Navigate to the project and start it using docker-compose
    cd medrec-physicians
    docker-compose up –d
    
  3. Test access to the API using
    curl http://localhost:10010/physicians
    
  4. If you want to test the Swagger definition, try this:
    swagger project edit
    
  5. If you want to build using wercker try this:
    wercker dev
    

Run the MedRec Patients Java Spring + Liquibase Microservice

  1. Checkout the Physicians project
    git clone https://github.com/craigbarrau/medrec-patients
    
  2. Navigate to the project and start it using docker-compose
    cd medrec-patients
    docker-compose up –d
    
  3. Test access to the API using
    curl http://localhost:10011/medrec/patients
    

Supporting articles

Other Resources

Wishlist