Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenNMS meets Docker

OpenNMS meets Docker

This presentation was hold at the OpenNMS User Conference Europe (OUCE) 2015. It describes how to ship OpenNMS with Docker.

Markus Schneider

October 01, 2015
Tweet

Other Decks in Technology

Transcript

  1. Schneider Matic picture source ­ https://flic.kr/p/jEnibL OpenNMS meets Docker Ship

    OpenNMS Faster, Easier and with more Fun 2015­10­01 | Markus Schneider | OUCE 2015
  2. 3 picture source ­ https://flic.kr/p/ovqps1 Schneider Matic Agenda  Docker

    Basics  Run OpenNMS with Docker  OpenNMS Dockerfiles on GitHub
  3. 4 picture source ­ https://flic.kr/p/ovqps1 Schneider Matic Agenda  Docker

    Basics  Run OpenNMS with Docker  OpenNMS Dockerfiles on GitHub
  4. picture source - https://flic.kr/p/5o5H1E Docker Mantra Build Ship Run Any

    App Anywhere picture source ­ https://flic.kr/p/i1cyb9
  5. picture source - https://flic.kr/p/5o5H1E Docker Products  Docker Architecture 

    Docker Engine  Docker Registry Hub  Docker Compose
  6. 8 Schneider Matic Docker Architecture Profile/ Organisation Docker Daemon Container

    Container Container Docker Host (My Linux Box) Image 2 Image 3 Image N Image 1 Image 2 Image 3 Image N Image 1 Docker Client Docker Registry Hub Further information - https://docs.docker.com/introduction/understanding-docker/
  7. 9 Schneider Matic Docker Engine  Docker Engine is build

    on top of the Linux kernel  Docker Engine can only be run directly on Linux OS  Boot2docker is needed for Mac and Microsoft Windows OS  https://docs.docker.com/installation/windows/#learn­ the­key­concepts­before­installing
  8. 10 Schneider Matic Docker Registry Hub  Central place for

    Docker images  Software­as­a­Service platform for sharing, finding and extending Docker images  Features  Private repositories  Organizations and teams  Automated Builds  Webhooks  https://hub.docker.com/
  9. 11 Schneider Matic Docker Compose  "Compose is a tool

    for defining and running multi­container applications with Docker. With Compose, you define a multi­ container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running. (source – http://docker.com) OpenNMS (Container) PostgreSQL (Container) Link docker-compose.yml opennms: image: opennms/app:16.0.2-1_co66 environment: - DB_POSTGRES_PASSWORD=mysecretpassword ports: - "8980:8980" - "18980:18980" - "1099:1099" - "8101:8101" - "61616:61616" links: - postgres postgres: image: postgres:9.4 environment: - DB_POSTGRES_PASSWORD=mysecretpassword ports: - "5432:5432"
  10. picture source - https://flic.kr/p/5o5H1E Docker Components  Docker Image 

    Docker Container  Dockerfile picture source ­ https://flic.kr/p/82cqTr
  11. 13 Schneider Matic Docker Image  A Docker image can

    build on top of another Docker image  The first image layer is called a base image  All the other layers except the last image layer are called parent images  Images inherit all the properties and settings of their parent images  Images can be referenced by image ID or names  Local Docker images can be listed with $ docker images
  12. 14 Schneider Matic Docker Container  A Docker container is

    created when we execute $ docker run <image>  A writeable layer is added on top of all the image layers  This layer can have two different states:  running  exited  Changes are permanent between start & stop  Changes are not written to the underlying image
  13. 15 Schneider Matic Dockerfile  A file written in a

    DSL that contains instructions on setting up a Docker image  The docker build command builds an image from a Dockerfile  OpenNMS Docker files are maintained on GitHub: https://github.com/opennms­forge/opennms­dockerfiles # Comment INSTRUCTION arguments FROM opennms/postgresql:pg9.3_co6.6 MAINTAINER [email protected] & [email protected] # Set work dir WORKDIR /tmp # JAVA ENV ENV JAVA_VERSION 8u45 ENV BUILD_VERSION b14 ENV JAVA_HOME=/usr/java/orajava8 # OPENNMS ENV ENV OPENNMS_HOME /opt/opennms ...
  14. picture source - https://flic.kr/p/5o5H1E OpenNMS Specifics  Docker Registry Hub

    Repositories  OpenNMS Docker Image Types  OpenNMS Docker Image Tags picture source ­ https://flic.kr/p/kaaStW
  15. 18 Schneider Matic OpenNMS Docker Image Types CentOS 6.6 PostgreSQL

    9.3 OpenNMS 16.0.2_01 All CentOS 6.6 OpenNMS 16.0.2_01 App CentOS 6.6 PostgreSQL 9.3 PostgreSQL
  16. 20 picture source ­ https://flic.kr/p/ovqps1 Schneider Matic Agenda  Docker

    Basics  Run OpenNMS with Docker  OpenNMS Dockerfiles on GitHub
  17. 21 Schneider Matic Docker Registry Hub Repoitory CentOS 6.6 PostgreSQL

    9.3 OpenNMS 16.0.2_01 All CentOS 6.6 OpenNMS 16.0.2_01 App CentOS 6.6 PostgreSQL 9.3 PostgreSQL
  18. 22 Schneider Matic Docker CLI ­ $ docker pull $

    docker pull opennms/all:16.0.2­1_pg9.3_co6.6 $ export IMAGE="opennms/all:16.0.2­1_pg9.3_co6.6" $ export NAME="opennms­1" $ mkdir ~/opennms­docker && touch HelloDocker.txt $ cd ~/opennms­docker Only for the presentation needed!
  19. 23 Schneider Matic Docker CLI ­ $ docker pull Profile/

    Organisation Docker Daemon Docker Host (My Linux Box) Docker Client $ docker pull <image> Docker Registry Hub opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6
  20. 24 Schneider Matic Docker CLI ­ $ docker run $

    docker run ­v $(pwd):$(pwd) ­w $(pwd) ­dit ­p 8980:8980 ­p 8443:8443 ­p 18980:18980 ­p 1099:1099 ­p 8101:8101 ­p 61616:61616 ­p 5432:5432 ­­name $NAME $IMAGE
  21. 25 Schneider Matic Docker CLI – $ docker run Profile/

    Organisation Docker Daemon Docker Host (My Linux Box) Docker Client $ docker run <image> Docker Registry Hub opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms-1
  22. 26 Schneider Matic Docker CLI ­ $ docker inspect $

    CONTAINER_ID=$(docker ps | grep "$IMAGE" | awk '{ print $1 }') $ IP_ADDRESS=$(docker inspect ­f '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID) $ printf "OpenNMS Console ­ http://$IP_ADDRESS:8980/opennms\n"
  23. 28 Schneider Matic Docker CLI – $ docker attach $

    docker stop $CONTAINER_ID && docker start $CONTAINER_ID $ docker attach $CONTAINER_ID $ CRTL + P, CRTL + Q # detach from the container
  24. 29 Schneider Matic Docker CLI – $ docker run Profile/

    Organisation Docker Daemon Docker Host (My Linux Box) Docker Client $ docker run <image> Docker Registry Hub opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms-1 psql
  25. 30 Schneider Matic Docker CLI – $ docker attach $

    psql ­U postgres ­h $IP_ADDRESS $ postgres # \l
  26. 31 Schneider Matic Docker Registry Hub Repoitory CentOS 6.6 PostgreSQL

    9.3 OpenNMS 16.0.2_01 All CentOS 6.6 OpenNMS 16.0.2_01 App CentOS 6.6 PostgreSQL 9.3 PostgreSQL
  27. 32 Schneider Matic Docker Compose $ cd ~/opennms­docker $ git

    clone https://github.com/opennms­forge/opennms­docker­compose $ cd ./opennms­docker­compose && git checkout app/16.0.2­1_co66 $ docker­compose up ­d
  28. 33 Schneider Matic Docker Compose Profile/ Organisation Docker Daemon Docker

    Host (My Linux Box) Docker Client Docker Registry Hub opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms-1 opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 Docker Compose $ docker­compose up ­d
  29. 34 Schneider Matic Docker Compose Profile/ Organisation Docker Daemon Docker

    Host (My Linux Box) Docker Client Docker Registry Hub opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms/all: 16.0.2-1_pg9.3_co6.6 opennms-1 opennms/app: 16.0.2-1_co6.6 opennms/postgres: pg9.3_co6.6 Docker Compose $ docker­compose up ­d opennms-2 postgresql-1
  30. 36 picture source ­ https://flic.kr/p/ovqps1 Schneider Matic Agenda  Docker

    Basics  Run OpenNMS with Docker  OpenNMS Dockerfiles on GitHub