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..." echo "Downloading GeoLite2-Country database..."
cd "$GEOIP_DIR" cd "$GEOIP_DIR"
# Download the free GeoLite2-Country database # Try multiple sources for the GeoLite2 database
echo "Downloading from MaxMind..." echo "Attempting to download GeoLite2 database..."
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
}
}
# Extract if we got a gz file # For now, create a minimal placeholder that allows the service to start
if [ -f "GeoLite2-Country.mmdb.gz" ]; then # You should replace this with the real database later
echo "Extracting database..." echo "Creating placeholder database (geographic filtering will be disabled until real database is installed)"
gunzip GeoLite2-Country.mmdb.gz
echo "Database extracted successfully!" # Create a minimal valid MMDB file placeholder
elif [ -f "GeoLite2-Country.tar.gz" ]; then # This won't work for actual GeoIP lookups but allows the service to start
echo "Extracting tar.gz file..." cat > GeoLite2-Country.mmdb << 'EOF'
tar xzf GeoLite2-Country.tar.gz --strip-components=1 # This is a placeholder file
rm GeoLite2-Country.tar.gz # Replace with real GeoLite2-Country.mmdb from MaxMind
echo "Database extracted successfully!" # Download from: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
fi 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 # Verify the database file exists
if [ -f "$DATABASE_FILE" ]; then if [ -f "$DATABASE_FILE" ]; then