From 10bcce6dabd0417103f7a6bc547f42cc0f89f0d1 Mon Sep 17 00:00:00 2001 From: oznu Date: Mon, 15 Oct 2018 19:08:52 +1100 Subject: [PATCH] add netflow service --- Dockerfile | 15 +++++++++++++++ Dockerfile.raspberry-pi | 15 +++++++++++++++ root/etc/services.d/netflow/run | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 root/etc/services.d/netflow/run diff --git a/Dockerfile b/Dockerfile index bd089e6..1a40fa6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # Multi-stage build - See https://docs.docker.com/engine/userguide/eng-image/multistage-build FROM ubnt/unms:0.13.0 as unms +FROM ubnt/unms-netflow:0.13.0 as unms-netflow FROM oznu/s6-node:8.12.0-amd64 # base deps redis, rabbitmq @@ -40,6 +41,19 @@ COPY --from=unms /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entry RUN chmod +x /usr/local/bin/docker-entrypoint.sh # end ubnt/unms dockerfile # +# start unms-netflow dockerfile # +RUN mkdir -p /home/app/netflow + +COPY --from=unms-netflow /home/app /home/app/netflow + +RUN devDeps="vips-dev fftw-dev make python g++" \ + && apk add --no-cache ${devDeps} \ + && cd /home/app/netflow \ + && JOBS=$(nproc) npm install \ + && apk del ${devDeps} + +# end unms-netflow dockerfile # + # ubnt/nginx docker file # ENV NGINX_UID=1000 \ NGINX_VERSION=nginx-1.12.2 \ @@ -116,6 +130,7 @@ ENV PATH=/home/app/unms/node_modules/.bin:$PATH \ WS_PORT=443 \ PUBLIC_HTTPS_PORT=443 \ PUBLIC_WS_PORT=443 \ + UNMS_NETFLOW_PORT=2055 \ SECURE_LINK_SECRET=enigma \ SSL_CERT="" diff --git a/Dockerfile.raspberry-pi b/Dockerfile.raspberry-pi index 69e17bf..b047c2f 100644 --- a/Dockerfile.raspberry-pi +++ b/Dockerfile.raspberry-pi @@ -1,5 +1,6 @@ # Multi-stage build - See https://docs.docker.com/engine/userguide/eng-image/multistage-build FROM ubnt/unms:0.13.0 as unms +FROM ubnt/unms-netflow:0.13.0 as unms-netflow FROM oznu/s6-node:8.12.0-armhf # base deps redis, rabbitmq @@ -40,6 +41,19 @@ COPY --from=unms /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entry RUN chmod +x /usr/local/bin/docker-entrypoint.sh # end ubnt/unms dockerfile # +# start unms-netflow dockerfile # +RUN mkdir -p /home/app/netflow + +COPY --from=unms-netflow /home/app /home/app/netflow + +RUN devDeps="vips-dev fftw-dev make python g++" \ + && apk add --no-cache ${devDeps} \ + && cd /home/app/netflow \ + && JOBS=$(nproc) npm install \ + && apk del ${devDeps} + +# end unms-netflow dockerfile # + # ubnt/nginx docker file # ENV NGINX_UID=1000 \ NGINX_VERSION=nginx-1.12.2 \ @@ -116,6 +130,7 @@ ENV PATH=/home/app/unms/node_modules/.bin:$PATH \ WS_PORT=443 \ PUBLIC_HTTPS_PORT=443 \ PUBLIC_WS_PORT=443 \ + UNMS_NETFLOW_PORT=2055 \ SECURE_LINK_SECRET=enigma \ SSL_CERT="" diff --git a/root/etc/services.d/netflow/run b/root/etc/services.d/netflow/run new file mode 100644 index 0000000..db265c8 --- /dev/null +++ b/root/etc/services.d/netflow/run @@ -0,0 +1,21 @@ +#!/usr/bin/with-contenv sh + +export HOME=/home/app +export HTTP_PORT=8081 +export WS_PORT=8082 +export WS_SHELL_PORT=8083 +export UNMS_RABBITMQ_HOST=localhost +export UNMS_RABBITMQ_PORT=5672 +export UNMS_REDISDB_HOST=localhost +export UNMS_REDISDB_PORT=6379 +export UNMS_PG_HOST=localhost +export UNMS_PG_PORT=5432 +export UNMS_FLUENTD_HOST=localhost +export UNMS_FLUENTD_PORT=8081 +export UNMS_NGINX_HOST=localhost +export UNMS_NGINX_PORT=12345 +export NODE_ENV=production + +echo "Starting unms-netflow..." + +s6-setuidgid root node /home/app/netflow/index.js