This repository includes helpers for deploying the GeoIP DB securely in production (VM or container hosts).
Options provided:
- Container runtime:
entrypoint.sh(already added) downloadsGEOIP_URLand verifiesGEOIP_SHA256orGEOIP_SHA256_URLbefore starting the binary. - VM / systemd:
deploy/download_geoip.shis a host script;deploy/ltt.serviceis a systemd unit template invoking that script before starting the binary. - CI helper:
scripts/ci_upload_geoip.shuploadsdata/GeoLite2-Country.mmdband checksum to S3 and prints presigned URLs.
Quick docker run example (for a docker-host production without compose):
# Environment variables should be provided via your secret manager or CI — avoid committing them into files.
export GEOIP_URL="https://...presigned-url..."
export GEOIP_SHA256="<hex>"
docker run --rm \
-e GEOIP_URL="$GEOIP_URL" \
-e GEOIP_SHA256="$GEOIP_SHA256" \
-v geoip-data:/etc/geoip \
--name ltt \
myregistry/basis-data-ltt:latestYou can use GitHub Releases to store the .mmdb and .sha256 as release assets. This works for public or private repos (private requires auth).
CI upload (example using gh CLI):
# from CI where GH_TOKEN/GITHUB_TOKEN is available in secrets
FILE=data/GeoLite2-Country.mmdb
sha256sum "$FILE" > "$FILE.sha256"
TAG=v-geoip-$(date +%Y%m%d%H%M%S)
gh release create "$TAG" --title "$TAG" --notes "GeoIP DB" --draft
gh release upload "$TAG" "$FILE" "$FILE.sha256" --clobber
gh release edit "$TAG" --draft=false
echo "https://github.com/${GH_REPO:-owner/repo}/releases/download/$TAG/$(basename $FILE)"Host download (systemd / VM):
Set environment variables securely (e.g. /etc/default/ltt):
GITHUB_REPO=owner/repo
GITHUB_RELEASE_TAG=v-geoip-20260130010101
GH_TOKEN="<short-lived-token>"
GEOIP_DB_PATH=/etc/geoip/GeoLite2-Country.mmdb
The deploy/download_geoip.sh script will construct the releases URL when GITHUB_REPO and GITHUB_RELEASE_TAG are present and will use GH_TOKEN for authenticated downloads if provided.
Notes:
- Prefer short-lived tokens (rotate often) or have your deployment CI fetch the asset and place it on the target host.
- Releases are versioned and easy to audit, but not a substitute for a secret manager for production secrets.
Systemd installation steps (VM)
- Copy binary and script to system paths (run as root during install):
install -m 0755 -o root -g root ./basis-data-ltt /usr/local/bin/basis-data-ltt
install -m 0755 -o root -g root ./deploy/download_geoip.sh /usr/local/bin/download_geoip.sh
mkdir -p /etc/geoip- Create a drop-in env file
/etc/default/lttcontaining secrets (use your secret manager to write this):
# /etc/default/ltt
GEOIP_URL="https://...presigned-url..."
GEOIP_SHA256_URL="https://...presigned-url-to-sha256..."
GEOIP_DB_PATH="/etc/geoip/GeoLite2-Country.mmdb"
- Install systemd unit and enable service:
install -m 0644 -o root -g root ./deploy/ltt.service /etc/systemd/system/ltt.service
systemctl daemon-reload
systemctl enable --now ltt.serviceNotes & security
- Use short-lived presigned URLs or instance role-based access; do not keep long-lived keys inside the env file.
- Enable server-side encryption and bucket access logging for the object store.
- Verify checksum on every install (scripts enforce this).