chessbaseLinux/website/docker/entrypoint.sh
vrubelroman 75692ede4d
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Site: the big clouds are machines, not people
A Windows installation 'in Cheyenne' right after a release is Microsoft's scanner running
the new program in Azure. The DB-IP Lite ASN database (fetched like the city one) tells
the networks of Microsoft, Amazon, Google, Oracle, Alibaba, Tencent and IBM apart: their
launches are not counted or announced, their downloads and visits count as crawlers.
Small hostings are left alone: people's VPNs run on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:58:38 +03:00

37 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
# Fetches the DB-IP Lite City geolocation databases and the DB-IP Lite ASN database (CC BY
# 4.0, MaxMind DB format, via the ip-location-db packages on unpkg) when they are missing
# or older than 35 days, then
# starts the server as the unprivileged user "site". Without them the site works and
# downloads are stored without a country.
set -u
# A bind-mounted ./data is created by Docker as root: hand it to "site".
if [ "$(id -u)" = 0 ]; then
chown -R site /app/data
exec setpriv --reuid=site --regid=site --init-groups "$0" "$@"
fi
base="${GEOIP_URL:-https://unpkg.com/@ip-location-db/dbip-city-mmdb}"
for v in ipv4 ipv6; do
f="/app/data/dbip-city-${v}.mmdb"
if [ ! -s "$f" ] || [ -n "$(find "$f" -mtime +35 2>/dev/null)" ]; then
echo "downloading ${f##*/}"
if curl -fsSL --retry 3 --max-time 600 -o "$f.part" "$base/dbip-city-${v}.mmdb"; then
mv "$f.part" "$f"
else
rm -f "$f.part"
echo "geolocation download failed; keeping what is there"
fi
fi
done
# The network owners (ASN): the big clouds are told apart from people.
f=/app/data/dbip-asn.mmdb
if [ ! -s "$f" ] || [ -n "$(find "$f" -mtime +35 2>/dev/null)" ]; then
echo "downloading ${f##*/}"
if curl -fsSL --retry 3 --max-time 600 -o "$f.part" "${ASN_URL:-https://unpkg.com/@ip-location-db/dbip-asn-mmdb}/dbip-asn.mmdb"; then
mv "$f.part" "$f"
else
rm -f "$f.part"
echo "network database download failed; keeping what is there"
fi
fi
exec chesspenguin-site