Geofeed Manager
A complete solution for managing RFC 8805 compliant IP geolocation feeds (geofeeds). This system provides a modern web interface for managing geofeed entries, stores data in MariaDB/MySQL, and automatically exports to BunnyCDN via n8n workflows.
Features
- Modern Apple-esque UI - Clean, responsive interface for managing geofeed entries
- RFC 8805 Compliant - Generates valid geofeed CSV files per the specification
- CRUD Operations - Create, read, update, and delete geofeed entries
- Search & Filter - Find entries by IP prefix, city, region, or country
- Audit Logging - Track all changes to your geofeed
- Automated Export - n8n workflow exports to BunnyCDN hourly
- CSRF Protection - Secure form submissions
Directory Structure
geofeed-manager/
├── database/
│ ├── schema.sql # Database schema
│ └── import_csv.php # CSV import utility (CLI)
├── webapp/
│ ├── config.php # Configuration & helpers
│ ├── api.php # RESTful API endpoints
│ └── index.php # Main web interface
├── n8n/
│ └── geofeed-export-workflow.json # n8n workflow
├── docker-compose.yml # Docker Compose configuration
└── .env.example # Environment variables template
Installation (Docker / Dokploy)
The application automatically pulls code from the Git repository on startup - no local files needed!
Quick Start
- Set environment variables in Dokploy (or create
.envfile):
# Git Repository
GIT_REPO=https://git.prpl.tools/PurpleComputing/geofeed-manager.git
GIT_BRANCH=main
# Database
DB_ROOT_PASSWORD=your_secure_root_password
DB_NAME=geofeed_manager
DB_USER=geofeed
DB_PASSWORD=your_secure_password
# Ports
WEB_PORT=8080
DB_PORT=3306
- Deploy with Docker Compose:
docker compose up -d
-
Access the web interface at
http://your-server:8080 -
Import your geofeed via the Advanced tab in the UI
How It Works
On startup, a git-sync container:
- Clones the repository from Git
- Copies
webapp/files to the PHP container volume - Copies
database/schema.sqlfor MariaDB initialization - Exits after sync completes
The webapp and database containers then start with the synced code.
Updating Code
To pull the latest code from Git, simply restart the stack:
docker compose down
docker compose up -d
Or in Dokploy, just redeploy the service.
Container Details
| Service | Port | Description |
|---|---|---|
| webapp | 8080 | PHP web interface |
| mariadb | 3306 | MariaDB database (exposed for n8n) |
| git-sync | - | Pulls code on startup, then exits |
| phpmyadmin | 8081 | Database admin (optional, use --profile admin) |
Connecting n8n to the Database
Since n8n is on the same Docker host, you can connect using:
Option A: Shared Network
- Add the geofeed network to your n8n compose as external
- Host:
geofeed-db - Port:
3306
Option B: Host Networking
- Host:
host.docker.internalor server IP - Port:
3306(or yourDB_PORT)
Database credentials:
- Database:
geofeed_manager - User:
geofeed - Password: Your
DB_PASSWORD
4. n8n Workflow Setup
-
In n8n, go to Settings > Environment Variables and add:
BUNNY_STORAGE_ZONE- Your BunnyCDN storage zone nameBUNNY_API_KEY- Your BunnyCDN Storage API key
-
Create MySQL credentials in n8n:
- Go to Credentials
- Add new MySQL credential
- Configure with your database details
- Note the credential ID
-
Import the workflow:
- Go to Workflows
- Click Import from File
- Select
n8n/geofeed-export-workflow.json
-
Update credential references:
- Open the imported workflow
- For each MySQL node, select your MySQL credential
- Save the workflow
-
Activate the workflow to start hourly exports
API Reference
List Entries
GET api.php?action=list&page=1&limit=25&search=term&country=GB
Get Single Entry
GET api.php?action=get&id=123
Create Entry
POST api.php?action=create
Content-Type: application/json
{
"ip_prefix": "192.168.1.0/24",
"country_code": "GB",
"region_code": "GB-ENG",
"city": "London",
"postal_code": "EC1A 1BB",
"notes": "Main office",
"csrf_token": "..."
}
Update Entry
POST api.php?action=update
Content-Type: application/json
{
"id": 123,
"ip_prefix": "192.168.1.0/24",
"country_code": "GB",
"region_code": "GB-ENG",
"city": "Manchester",
"postal_code": "M1 1AA",
"csrf_token": "..."
}
Delete Entry
POST api.php?action=delete
Content-Type: application/json
{
"id": 123,
"csrf_token": "..."
}
Export CSV
GET api.php?action=export&format=download
Get Statistics
GET api.php?action=stats
Geofeed Format (RFC 8805)
Each line in the exported CSV follows this format:
ip_prefix,country_code,region_code,city,postal_code
Example:
# Geofeed - Generated by Geofeed Manager
# Format: ip_prefix,country_code,region_code,city,postal_code
192.168.1.0/24,GB,GB-ENG,London,EC1A 1BB
10.0.0.0/8,US,US-CA,San Francisco,94105
2001:db8::/32,DE,DE-BY,Munich,80331
BunnyCDN Setup
- Create a Storage Zone in BunnyCDN
- Get your Storage API key from the FTP & API Access section
- The workflow uploads to:
https://storage.bunnycdn.com/{zone}/geofeed.csv - Your public URL will be:
https://{zone}.b-cdn.net/geofeed.csv
Security Considerations
- Always use HTTPS in production
- Keep your database credentials secure
- Consider adding authentication to the web interface
- The CSRF token helps prevent cross-site attacks
- Input validation is performed on all fields
Troubleshooting
Import fails with "Invalid IP prefix"
Ensure your IP prefixes are in valid CIDR notation (e.g., 192.168.1.0/24)
n8n workflow fails
- Check that environment variables are set correctly
- Verify MySQL credentials are configured
- Check BunnyCDN API key permissions
Web interface shows database error
- Verify database credentials in config.php
- Ensure the database and tables exist
- Check MySQL/MariaDB is running
License
MIT License - Feel free to use and modify as needed.