Container & OpenNMS
Operations
Docker & Docker Compose
DockerHub Account
http://tiny.cc/dj2019docker
http://tiny.cc/dj2019docker
docker-compose up -d
Start database and horizon
services in background
http://tiny.cc/dj2019docker
docker-compose stop [service]
Stops all services or a specific one.

The last state is preserved.
http://tiny.cc/dj2019docker
docker-compose down -v
Stops all services or a specific one.

Last state is removed.
Deletes also Volumes!
Upgrade
Backup etc, rrd, reports and database
1. Stop horizon: docker-compose stop horizon
2. Backup database:

docker-compose exec database 

pg_dump -W -U horizonuser 

-Fc -f /tmp/opennms.pgsql.gz horizondb
3. Get backup file from container:

docker cp postgresql:/tmp/opennms.pgsql.gz .
4. docker inspect horizon | grep data-horizon-rrd


demo_data-horizon-rrd:/opt/opennms/share/rrd:rw",
"Name": "demo_data-horizon-rrd",
"Source": "/var/lib/docker/volumes/demo_data-horizon-rrd/_data",
Initialise a new etc and apply changes
1. Delete the content of your ./etc directory
2. Bump the image version
3. Initalise a pristine etc from the new version with

docker-compose run horizon -i
4. Restore your modified config files and start
Merge changes from identified configs
1. Backup files you have modified
2. Merge your modified files, it means check XML schema
changes. Use

https://github.com/opennms/opennms-etc-pristine

with your target version for the merge
docker-compose exec horizon 
diff -rq -EBbw ./etc share/etc-pristine | grep "Only in ./etc[/|:]"
docker-compose exec horizon 

diff -rq -EBbw ./etc share/etc-pristine | grep "differ"
docker-compose exec horizon 

diff -rq -EBbw ./etc share/etc-pristine | grep "Only in share/etc-pristine[/|:]"
1. Identify changed configuration files
docker-compose exec horizon 
diff -rq -EBbw ./etc share/etc-pristine | grep "Only in ./etc[/|:]"
docker-compose exec horizon 

diff -rq -EBbw ./etc share/etc-pristine | grep "differ"
docker-compose exec horizon 

diff -rq -EBbw ./etc share/etc-pristine | grep "Only in share/etc-pristine[/|:]"
1. Identify changed configuration files
NMS-12129
volumes:

- ./etc-overlay:/opt/opennms-overlay
Overlay Directory
Everything is copied and overwrites files in the directory

/opt/opennms
Use it for files which are not changed from the Web UI

- opennms.properties.d

- Poller Configuration
- Notification Commands
Changes from the Web UI get overwritten on next restart:
- SNMP Communities
- Users, Groups, Destination Paths,
- Notifications, Thresholds, etc.
Troubleshooting
1. docker-compose logs -f horizon
2. docker-compose exec horizon bash
3. docker-compose run horizon -t
4. environment:

- JAVA_OPTS=-XX:+UseG1GC
5. docker cp <container-id>:/path/src /path/dest
6. Start with JPDA debugger:



JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,address=$*:8001,suspend=n
Development
• Build OCI with the CI/CD
• Integrate in Test environment
• Docker Images as artefacts
• Test the OCI itself
• target is Horizon 25
• horizon-core-web -> horizon
• Simplify overlay directories
• Run with OpenShift as non-root
• POC with confd
Challenges
Karaf Containers
926MiB
567MiB
232MiB
127MiB
CentOS 7 OpenJDK
Dependencies OpenNMS
Runtime configs Start-up configs
Double-click to edit
• Double-click to edit

Dev-Jam 2019 - Container & OpenNMS

  • 1.
  • 2.
  • 3.
    Docker & DockerCompose DockerHub Account
  • 4.
  • 5.
    http://tiny.cc/dj2019docker docker-compose up -d Startdatabase and horizon services in background
  • 6.
    http://tiny.cc/dj2019docker docker-compose stop [service] Stopsall services or a specific one.
 The last state is preserved.
  • 7.
    http://tiny.cc/dj2019docker docker-compose down -v Stopsall services or a specific one.
 Last state is removed. Deletes also Volumes!
  • 8.
  • 9.
    Backup etc, rrd,reports and database 1. Stop horizon: docker-compose stop horizon 2. Backup database:
 docker-compose exec database 
 pg_dump -W -U horizonuser 
 -Fc -f /tmp/opennms.pgsql.gz horizondb 3. Get backup file from container:
 docker cp postgresql:/tmp/opennms.pgsql.gz . 4. docker inspect horizon | grep data-horizon-rrd 
 demo_data-horizon-rrd:/opt/opennms/share/rrd:rw", "Name": "demo_data-horizon-rrd", "Source": "/var/lib/docker/volumes/demo_data-horizon-rrd/_data",
  • 10.
    Initialise a newetc and apply changes 1. Delete the content of your ./etc directory 2. Bump the image version 3. Initalise a pristine etc from the new version with
 docker-compose run horizon -i 4. Restore your modified config files and start
  • 11.
    Merge changes fromidentified configs 1. Backup files you have modified 2. Merge your modified files, it means check XML schema changes. Use
 https://github.com/opennms/opennms-etc-pristine
 with your target version for the merge
  • 12.
    docker-compose exec horizon diff -rq -EBbw ./etc share/etc-pristine | grep "Only in ./etc[/|:]" docker-compose exec horizon 
 diff -rq -EBbw ./etc share/etc-pristine | grep "differ" docker-compose exec horizon 
 diff -rq -EBbw ./etc share/etc-pristine | grep "Only in share/etc-pristine[/|:]" 1. Identify changed configuration files
  • 13.
    docker-compose exec horizon diff -rq -EBbw ./etc share/etc-pristine | grep "Only in ./etc[/|:]" docker-compose exec horizon 
 diff -rq -EBbw ./etc share/etc-pristine | grep "differ" docker-compose exec horizon 
 diff -rq -EBbw ./etc share/etc-pristine | grep "Only in share/etc-pristine[/|:]" 1. Identify changed configuration files NMS-12129
  • 14.
    volumes:
 - ./etc-overlay:/opt/opennms-overlay Overlay Directory Everythingis copied and overwrites files in the directory
 /opt/opennms Use it for files which are not changed from the Web UI
 - opennms.properties.d
 - Poller Configuration - Notification Commands Changes from the Web UI get overwritten on next restart: - SNMP Communities - Users, Groups, Destination Paths, - Notifications, Thresholds, etc.
  • 15.
  • 16.
    1. docker-compose logs-f horizon 2. docker-compose exec horizon bash 3. docker-compose run horizon -t 4. environment:
 - JAVA_OPTS=-XX:+UseG1GC 5. docker cp <container-id>:/path/src /path/dest 6. Start with JPDA debugger:
 
 JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,address=$*:8001,suspend=n
  • 17.
  • 18.
    • Build OCIwith the CI/CD • Integrate in Test environment • Docker Images as artefacts • Test the OCI itself • target is Horizon 25
  • 28.
    • horizon-core-web ->horizon • Simplify overlay directories • Run with OpenShift as non-root • POC with confd
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
    Double-click to edit •Double-click to edit