Update GeoIP setup to create placeholder database with manual installation instructions

This commit is contained in:
Patrick Britton 2026-02-01 12:36:42 -06:00
parent b26f806002
commit 189fa7a56e

View file

@ -18,28 +18,32 @@ sudo chown patrick:patrick "$GEOIP_DIR"
echo "Downloading GeoLite2-Country database..."
cd "$GEOIP_DIR"
# Download the free GeoLite2-Country database
echo "Downloading from MaxMind..."
wget -O GeoLite2-Country.tar.gz "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb.gz" 2>/dev/null || {
echo "Primary download failed, trying alternative source..."
# Alternative source - GitHub mirror
wget -O GeoLite2-Country.mmdb.gz "https://raw.githubusercontent.com/P3TERX/GeoLite.mmdb/download/GeoLite2-Country.mmdb.gz" || {
echo "All downloads failed. Please manually download GeoLite2-Country.mmdb"
exit 1
}
}
# Try multiple sources for the GeoLite2 database
echo "Attempting to download GeoLite2 database..."
# Extract if we got a gz file
if [ -f "GeoLite2-Country.mmdb.gz" ]; then
echo "Extracting database..."
gunzip GeoLite2-Country.mmdb.gz
echo "Database extracted successfully!"
elif [ -f "GeoLite2-Country.tar.gz" ]; then
echo "Extracting tar.gz file..."
tar xzf GeoLite2-Country.tar.gz --strip-components=1
rm GeoLite2-Country.tar.gz
echo "Database extracted successfully!"
fi
# For now, create a minimal placeholder that allows the service to start
# You should replace this with the real database later
echo "Creating placeholder database (geographic filtering will be disabled until real database is installed)"
# Create a minimal valid MMDB file placeholder
# This won't work for actual GeoIP lookups but allows the service to start
cat > GeoLite2-Country.mmdb << 'EOF'
# This is a placeholder file
# Replace with real GeoLite2-Country.mmdb from MaxMind
# Download from: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
EOF
echo ""
echo "⚠️ IMPORTANT: This is a placeholder database!"
echo " Geographic filtering will be DISABLED until you install the real database."
echo ""
echo "To install the real database:"
echo "1. Sign up at: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data"
echo "2. Get your license key"
echo "3. Download: curl -o GeoLite2-Country.tar.gz 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=YOUR_KEY&suffix=tar.gz'"
echo "4. Extract: tar xzf GeoLite2-Country.tar.gz --strip-components=1"
echo "5. Restart service: sudo systemctl restart sojorn-api"
echo ""
# Verify the database file exists
if [ -f "$DATABASE_FILE" ]; then