Adding Java to a IRIS Docker image

IRIS is a powerful platform and one of the new features is the Java Business Host (DOC: Connecting Systems Using Java Business Hosts) that allow you to develop Business Services and Business Operations directly in Java (JavaDocs of the InterSystems Gateway Package).

I was testing this feature using an IRIS Docker image, but this image doesn't come with Java, the image is a bare Ubuntu image plus IRIS. So I had to build a new image adding the Java stuff. After some research I finally get this Dockerfile:

FROM docker.iscinternal.com/intersystems/iris:2019.1.0.284.0
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y  software-properties-common && \
    add-apt-repository ppa:webupd8team/java -y && \
    apt-get update && \
    echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
    apt-get install -y oracle-java8-installer && \
    apt-get clean

I also build a docker compose file in order to create the container and start it in a easy way:

version: '3.6'
services:
  iris:
    build: .
    image: irisjava:v1.1.0   
    command: --log /usr/irissys/mgr/messages.log
    hostname: iris    
    container_name: iris2019.1
    volumes:
      - ${PWD}/shared/:/shared
    ports:
      - 51773:51773
      - 52773:52773
      - 55555:55555
    environment:
      - ISC_DATA_DIRECTORY=/shared/iris_conf.d

Everything works well after a 'docker-compose up -d'

Maybe this is useful for someone working with IRIS Docker images and Java Business Hosts.

Regards

  • + 3
  • 1
  • 268
  • 6

Comments

A small suggestion: you may not wish to use "--log /usr/irissys/mgr/messages.log" in conjunction with ISC_DATA_DIRECTORY.  As soon as the system has finished coming up, all ongoing logging will be written to ISC_DATA_DIRECTORY/mgr/messages.log.  The docker-compose file you have here will result in the output of "docker logs iris2019.1" being relatively short, ending in "Executing iris qlist", and omitting everything after the first few seconds of startup.

For better logging to container stdout, you might wish to use something like "--log /shared/iris_conf.d/mgr/messages.log".

Hope this helps!

Thank you Conor. You are right. Good point !!

There are some changes coming in the near future to the default logging behavior of the IRIS container . The goal is improve the usefulness of what is written to standard out by default. Of course, if you need to customize (or want to turn it off) --log is there for you, but soon you will not need to manually specify messages.log as it will be there by default (Durable %SYS or not, whichever one is active). The current syntax you have, and what Conor suggests, will work moving forward, but with an upcoming release (under wraps) it will become unnecessary.

If I am understood docker philosophy at all,   its much more convenient  to to run java applications in  other container than  your database container. So IMHO better example would be how to connect those.

Just my thoughts..

Ummmh... not sure about this.

Specially in the case of Java Business Host Services and Operations because the JVM must run inside the IRIS instance memory (AFAIK), in this case there is no way of interaction between two different Containers or... there is a way? when I use two or more containers the interaction always was done using TCP/IP (Understand container communication).

This is a good question to clarify.

Thanks

JGW (and therefore JBH) could be run as a separate container with TCP/IP interaction.