diff --git a/Dockerfile b/Dockerfile index e5bd925b..93da5a16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,14 @@ FROM scratch as buildstage -ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx.py /root-layer/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/run.py /root-layer/geoip2influx/run.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/__init__.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/GilbN/geoip2influx/master/geoip2influx/constants.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/influx_base.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/influx.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/influxv2.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/logger.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py +ADD https://raw.githubusercontent.com/gilbN/geoip2influx/master/geoip2influx/logparser.py /root-layer/geoip2influx/geoip2influx/geoip2influx.py COPY root/ /root-layer/ # runtime stage diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-swag-geoip2influx-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-swag-geoip2influx-add-package/run index 484bb0c6..d99e1978 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-swag-geoip2influx-add-package/run +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-swag-geoip2influx-add-package/run @@ -1,14 +1,19 @@ #!/usr/bin/with-contenv bash +echo -e "[init-geoip2influx-setup] Starting" + + if ! pip list 2>&1 | grep -q "influxdb"; then echo '-------------------------------------------------------------' echo '| Mod by Gilbn |' echo '| Adding required modules for Geoip2Influx to install list |' echo '-------------------------------------------------------------' echo "\ - geoip2==3.0.0 \ + geoip2==4.8.0 \ geohash2==1.1 \ - influxdb==5.3.0 \ + influxdb==5.3.2 \ + python-dotenv \ + influxdb-client==1.44.0 \ IPy==1.01" >> /mod-pip-packages-to-install.list fi @@ -25,19 +30,35 @@ lsiown -R abc:abc \ /geoip2influx \ /config/log/geoip2influx -chmod +x /geoip2influx/geoip2influx.py +chmod +x /geoip2influx/run.py # Display variables for troubleshooting -echo -e "Variables set:\\n\ -NGINX_LOG_PATH=${NGINX_LOG_PATH}\\n\ +echo -e "[init-geoip2influx-setup] Variables set:\\n\\n INFLUX_HOST=${INFLUX_HOST}\\n\ INFLUX_HOST_PORT=${INFLUX_HOST_PORT}\\n\ INFLUX_DATABASE=${INFLUX_DATABASE}\\n\ INFLUX_USER=${INFLUX_USER}\\n\ INFLUX_PASS=${INFLUX_PASS}\\n\ INFLUX_RETENTION=${INFLUX_RETENTION}\\n\ -INFLUX_SHARD=${INFLUX_SHARD}\\n\ +INFLUX_SHARD=${INFLUX_SHARD}\\n\\n +INFLUXDB_V2_TOKEN=${INFLUXDB_V2_TOKEN}\\n\ +INFLUXDB_V2_URL=${INFLUXDB_V2_URL}\\n\ +INFLUXDB_V2_ORG=${INFLUXDB_V2_ORG}\\n\ +INFLUXDB_V2_BUCKET=${INFLUXDB_V2_BUCKET}\\n\ +INFLUXDB_V2_RETENTION=${INFLUXDB_V2_RETENTION}\\n\ +INFLUXDB_V2_DEBUG=${INFLUXDB_V2_DEBUG}\\n\ +INFLUXDB_V2_BATCHING=${INFLUXDB_V2_BATCHING}\\n\ +INFLUXDB_V2_BATCH_SIZE=${INFLUXDB_V2_BATCH_SIZE}\\n\ +INFLUXDB_V2_FLUSH_INTERVAL=${INFLUXDB_V2_FLUSH_INTERVAL}\\n\\n GEO_MEASUREMENT=${GEO_MEASUREMENT}\\n\ LOG_MEASUREMENT=${LOG_MEASUREMENT}\\n\ +NGINX_LOG_PATH=${NGINX_LOG_PATH}\\n\ SEND_NGINX_LOGS=${SEND_NGINX_LOGS}\\n\ -GEOIP2INFLUX_LOG_LEVEL=${GEOIP2INFLUX_LOG_LEVEL}\\n" +GEOIP2INFLUX_LOG_LEVEL=${GEOIP2INFLUX_LOG_LEVEL}\\n\ +GEOIP2INFLUX_LOG_PATH=${GEOIP2INFLUX_LOG_PATH}\\n\ +GEOIP_DB_PATH=${GEOIP_DB_PATH}\\n\ +USE_INFLUXDB_V2=${USE_INFLUXDB_V2}\\n\ +MAXMINDDB_USER_ID=${MAXMINDDB_USER_ID}\\n\ +MAXMINDDB_LICENSE_KEY=${MAXMINDDB_LICENSE_KEY}\\n" + +echo -e "[init-geoip2influx-setup] Finished" diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-geoip2influx/run b/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-geoip2influx/run index 9dc871a5..07a4979b 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-geoip2influx/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-mod-swag-geoip2influx/run @@ -1,4 +1,4 @@ #!/usr/bin/with-contenv bash exec \ - python3 /geoip2influx/geoip2influx.py \ No newline at end of file + python3 /geoip2influx/run.py \ No newline at end of file