Switch geolocation to MaxMind

This commit is contained in:
Corey 2024-04-25 23:17:43 +00:00
parent 16847bda59
commit 9ff42ce914
9 changed files with 37 additions and 23 deletions

2
.gitignore vendored
View File

@ -450,3 +450,5 @@ sketch
.ionide
# End of https://www.toptal.com/developers/gitignore/api/python,django,node,react,git,visualstudiocode,dotenv
api/geoip

View File

@ -6,7 +6,7 @@ Ixion is designed to catalog public [LandSandBoat](https://github.com/LandSandBo
The React client fetches server data from the API and displays it in a relevant way to users. Filtering is built into the client for now. When the API response fails or is empty, a default LSB demo server is displayed, pulling some info from GitHub.
[IP Geolocation by DB-IP](https://db-ip.com)
[This product includes GeoLite2 Data created by MaxMind.](https://www.maxmind.com/)
## Features

View File

@ -6,3 +6,8 @@ CORS_ALLOWED_ORIGINS=https://ixion.dev
# API configuration
SERVER_UPDATE_INTERVAL=10
GEOIPUPDATE_ACCOUNT_ID=XXXXXX
GEOIPUPDATE_LICENSE_KEY=XXXXXXXXXXXXXXXX
GEOIPUPDATE_EDITION_IDS=GeoLite2-City
GEOIPUPDATE_FREQUENCY=72

View File

@ -84,7 +84,7 @@ WSGI_APPLICATION = "api.wsgi.application"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
"NAME": BASE_DIR / "db" / "db.sqlite3",
}
}

View File

@ -4,39 +4,46 @@ services:
command: gunicorn api.wsgi:application --bind 0.0.0.0:8000
restart: always
volumes:
- .:/app
- database:/app/db
- static:/app/static
- geoipupdate_data:/app/geoip
expose:
- 8000
depends_on:
- redis
- geoipupdate
celery:
build: .
command: celery -A api worker -l info
restart: always
volumes:
- .:/app
depends_on:
- redis
- api
celery-beat:
build: .
command: celery -A api beat -l info
restart: always
volumes:
- .:/app
depends_on:
- redis
redis:
image: redis:alpine
restart: always
- api
nginx:
image: nginx
restart: always
ports:
- 9969:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./static:/app/static
- static:/app/static
depends_on:
- api
redis:
image: redis:alpine
restart: always
geoipupdate:
image: ghcr.io/maxmind/geoipupdate
env_file: .env
restart: always
volumes:
- geoipupdate_data:/usr/share/GeoIP
volumes:
database:
static:
geoipupdate_data:

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d059fb98f00275a580adb0c5f75ccb6d5722e7a2c9139084f3b50a753ad6a3c
size 105210428

View File

@ -147,9 +147,12 @@ class Server(models.Model):
# except socket.error:
# return False
try:
g = GeoIP2()
city = g.city(f"{self.url}")
self.location = city["continent_code"]
except:
self.location = "??"
return True

View File

@ -174,12 +174,12 @@ export default function ServerCard({ server }: { server: ServerData }) {
<Tooltip
arrow
disableInteractive
title="Estimated server geolocation provided by DB-IP."
title="Estimated server geolocation provided by MaxMind."
>
<Typography
variant="caption"
component={Link}
to="https://db-ip.com"
to="https://www.maxmind.com/"
target="_blank"
onClick={(event) => {
event.stopPropagation();

View File

@ -144,12 +144,12 @@ export default function ServerDetails({
<Tooltip
arrow
disableInteractive
title="Estimated server geolocation provided by DB-IP"
title="Estimated server geolocation provided by MaxMind"
>
<Typography
variant="caption"
component={Link}
to="https://db-ip.com"
to="https://www.maxmind.com/"
target="_blank"
onClick={(event) => {
event.stopPropagation();