From 3e72b6a35f2aff6a299019c34f4b57e97ba480aa Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Tue, 19 Jan 2016 14:04:29 +0000 Subject: Switch to phusion's docker-baseimage, to get service management and process reaping --- Dockerfile | 11 +++++++---- extra/oxidized.runit | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100755 extra/oxidized.runit diff --git a/Dockerfile b/Dockerfile index b2aecfb..01a0c5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ -FROM debian:latest +FROM phusion/baseimage:0.9.18 MAINTAINER Samer Abdel-Hafez -RUN apt-get update && \ - apt-get install -y ruby ruby-dev libsqlite3-dev libssl-dev pkg-config make cmake +RUN add-apt-repository ppa:brightbox/ruby-ng && \ + apt-get update && \ + apt-get install -y ruby2.1 ruby2.1-dev libsqlite3-dev libssl-dev pkg-config make cmake RUN gem install oxidized oxidized-web --no-ri --no-rdoc RUN apt-get remove -y ruby-dev pkg-config make cmake -RUN apt-get -y autoremove \ No newline at end of file +RUN apt-get -y autoremove + +ADD extra/oxidized.runit /etc/service/oxidized/run diff --git a/extra/oxidized.runit b/extra/oxidized.runit new file mode 100755 index 0000000..c4ce129 --- /dev/null +++ b/extra/oxidized.runit @@ -0,0 +1,2 @@ +#!/bin/bash +exec setuser root oxidized -- cgit v1.2.1 From eb3d86fe6debc286d74e0eed5a61d5a564b324c4 Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Tue, 19 Jan 2016 14:07:54 +0000 Subject: Add the option of automatically reloading the config every X seconds. Fixes #271 --- Dockerfile | 1 + README.md | 5 +++++ extra/auto-reload-config.runit | 12 ++++++++++++ 3 files changed, 18 insertions(+) create mode 100755 extra/auto-reload-config.runit diff --git a/Dockerfile b/Dockerfile index 01a0c5f..0eeeb8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,3 +12,4 @@ RUN apt-get remove -y ruby-dev pkg-config make cmake RUN apt-get -y autoremove ADD extra/oxidized.runit /etc/service/oxidized/run +ADD extra/auto-reload-config.runit /etc/service/auto-reload-config/run diff --git a/README.md b/README.md index e4c02e8..a6766ec 100644 --- a/README.md +++ b/README.md @@ -230,6 +230,11 @@ rvm use --default 2.1.2 root@bla:~# ``` +If you want to have the config automatically reloaded (e.g. when using a http source that changes) +``` + root@bla:~# docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -e CONFIG_RELOAD_INTERVAL=3600 -t oxidized/oxidized:latest oxidized +``` + ## Cookbook ### Debugging In case a model plugin doesn't work correctly (ios, procurve, etc.), you can enable live debugging of SSH/Telnet sessions. Just add a ```debug``` option, specifying a log file destination to the ```input``` section. diff --git a/extra/auto-reload-config.runit b/extra/auto-reload-config.runit new file mode 100755 index 0000000..5eaecc8 --- /dev/null +++ b/extra/auto-reload-config.runit @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ -z "$CONFIG_RELOAD_INTERVAL" ]; then + # Just stop and do nothing + read +fi + +while true; do + sleep $CONFIG_RELOAD_INTERVAL + echo "Reloading config..." + curl -s http://localhost:8888/reload?format=json -O /dev/null +done -- cgit v1.2.1