Skip to content

Commit

Permalink
Add new geoip2influx files from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
GilbN committed Sep 11, 2024
1 parent 6a87a2c commit 9e2c73a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/svc-mod-swag-geoip2influx/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bash

exec \
python3 /geoip2influx/geoip2influx.py
python3 /geoip2influx/run.py

0 comments on commit 9e2c73a

Please sign in to comment.