Add ENABLE_DBIP to ``psql-app`` container to auto import DB-IP geo data
This commit is contained in:
parent
a50c553f66
commit
237345b476
@ -162,6 +162,7 @@ services:
|
||||
- RPKI_USER=None
|
||||
- ENABLE_RPKI=1 # 1 enables, 0 disables RPKI sync
|
||||
- ENABLE_IRR=1 # 1 enables, 0 disables IRR sync
|
||||
- ENABLE_DBIP=1 # 1 enables, 0 disables DBIP import
|
||||
- POSTGRES_REPORT_WINDOW='8 minute' # default POSTGRESS window to select when building
|
||||
# summary tables. For deployments that absorb large
|
||||
# bursts increase the value, ex 60 minute
|
||||
|
||||
@ -53,6 +53,7 @@ COPY --chmod=755 --from=build /ws/cron_scripts/gen-whois/*.py /usr/local/openbm
|
||||
COPY --chmod=755 --from=build /ws/cron_scripts/peeringdb/*.py /usr/local/openbmp/
|
||||
COPY --chmod=755 --from=build /ws/cron_scripts/rpki/*.py /usr/local/openbmp/
|
||||
COPY --chmod=755 --from=build /ws/scripts/geo-csv-to-psql.py /usr/local/openbmp/
|
||||
COPY --chmod=755 --from=build /ws/scripts/db-ip-import.sh /usr/local/openbmp/
|
||||
|
||||
# Add files
|
||||
ADD --chmod=755 obmp-docker/psql-app/scripts/run /usr/sbin/
|
||||
@ -86,7 +87,7 @@ RUN apt-get update \
|
||||
RUN cd /tmp && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
|
||||
&& python3 get-pip.py
|
||||
|
||||
RUN pip install ipaddr pykafka click
|
||||
RUN pip install ipaddr pykafka click netaddr
|
||||
|
||||
RUN pip3 install urllib3 requests
|
||||
|
||||
|
||||
@ -116,6 +116,25 @@ SETVAR
|
||||
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# Enable DB-IP import
|
||||
# -----------------------------------------------
|
||||
enable_dbip() {
|
||||
echo "===> Enabling DB-IP Import"
|
||||
|
||||
cat > /etc/cron.d/openbmp-dbip <<SETVAR
|
||||
MAILTO=""
|
||||
|
||||
$(( $RANDOM % 59 + 1 )) $(( $RANDOM % 23 + 1 )) 1 * * root /usr/local/openbmp/db-ip-import.sh > /var/log/cron-dbip-import.log
|
||||
|
||||
SETVAR
|
||||
|
||||
# Load DB-IP on start
|
||||
echo "Running DB-IP Import"
|
||||
/usr/local/openbmp/db-ip-import.sh > /var/log/cron-dbip-import.log &
|
||||
}
|
||||
|
||||
|
||||
# -----------------------------------------------
|
||||
# Enable IRR
|
||||
# -----------------------------------------------
|
||||
@ -256,15 +275,20 @@ source /usr/local/openbmp/pg_profile
|
||||
config_cron
|
||||
|
||||
rm -f /etc/cron.d/openbmp-rpki
|
||||
if [[ ${ENABLE_RPKI:-""} != "" ]]; then
|
||||
if [[ ${ENABLE_RPKI:-""} != "" && $ENABLE_RPKI == 1 ]]; then
|
||||
enable_rpki
|
||||
fi
|
||||
|
||||
rm -f /etc/cron.d/openbmp-irr
|
||||
if [[ ${ENABLE_IRR:-""} != "" ]]; then
|
||||
if [[ ${ENABLE_IRR:-""} != "" && $ENABLE_IRR == 1 ]]; then
|
||||
enable_irr
|
||||
fi
|
||||
|
||||
rm -f /etc/cron.d/openbmp-dbip
|
||||
if [[ ${ENABLE_DBIP:-""} != "" && $ENABLE_DBIP == 1 ]]; then
|
||||
enable_dbip
|
||||
fi
|
||||
|
||||
|
||||
initdb_postgres
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user