mirror of https://github.com/cocosolos/ixion.git
Switch geolocation to MaxMind
This commit is contained in:
parent
16847bda59
commit
9ff42ce914
|
|
@ -450,3 +450,5 @@ sketch
|
||||||
.ionide
|
.ionide
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/python,django,node,react,git,visualstudiocode,dotenv
|
# End of https://www.toptal.com/developers/gitignore/api/python,django,node,react,git,visualstudiocode,dotenv
|
||||||
|
|
||||||
|
api/geoip
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,8 @@ CORS_ALLOWED_ORIGINS=https://ixion.dev
|
||||||
|
|
||||||
# API configuration
|
# API configuration
|
||||||
SERVER_UPDATE_INTERVAL=10
|
SERVER_UPDATE_INTERVAL=10
|
||||||
|
|
||||||
|
GEOIPUPDATE_ACCOUNT_ID=XXXXXX
|
||||||
|
GEOIPUPDATE_LICENSE_KEY=XXXXXXXXXXXXXXXX
|
||||||
|
GEOIPUPDATE_EDITION_IDS=GeoLite2-City
|
||||||
|
GEOIPUPDATE_FREQUENCY=72
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ WSGI_APPLICATION = "api.wsgi.application"
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.sqlite3",
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
"NAME": BASE_DIR / "db.sqlite3",
|
"NAME": BASE_DIR / "db" / "db.sqlite3",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,39 +4,46 @@ services:
|
||||||
command: gunicorn api.wsgi:application --bind 0.0.0.0:8000
|
command: gunicorn api.wsgi:application --bind 0.0.0.0:8000
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- database:/app/db
|
||||||
- static:/app/static
|
- static:/app/static
|
||||||
|
- geoipupdate_data:/app/geoip
|
||||||
expose:
|
expose:
|
||||||
- 8000
|
- 8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
|
- geoipupdate
|
||||||
celery:
|
celery:
|
||||||
build: .
|
build: .
|
||||||
command: celery -A api worker -l info
|
command: celery -A api worker -l info
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- api
|
||||||
celery-beat:
|
celery-beat:
|
||||||
build: .
|
build: .
|
||||||
command: celery -A api beat -l info
|
command: celery -A api beat -l info
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- api
|
||||||
redis:
|
|
||||||
image: redis:alpine
|
|
||||||
restart: always
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx
|
image: nginx
|
||||||
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 9969:80
|
- 9969:80
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./static:/app/static
|
- static:/app/static
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- 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:
|
volumes:
|
||||||
|
database:
|
||||||
static:
|
static:
|
||||||
|
geoipupdate_data:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:6d059fb98f00275a580adb0c5f75ccb6d5722e7a2c9139084f3b50a753ad6a3c
|
|
||||||
size 105210428
|
|
||||||
|
|
@ -147,9 +147,12 @@ class Server(models.Model):
|
||||||
# except socket.error:
|
# except socket.error:
|
||||||
# return False
|
# return False
|
||||||
|
|
||||||
|
try:
|
||||||
g = GeoIP2()
|
g = GeoIP2()
|
||||||
city = g.city(f"{self.url}")
|
city = g.city(f"{self.url}")
|
||||||
self.location = city["continent_code"]
|
self.location = city["continent_code"]
|
||||||
|
except:
|
||||||
|
self.location = "??"
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,12 @@ export default function ServerCard({ server }: { server: ServerData }) {
|
||||||
<Tooltip
|
<Tooltip
|
||||||
arrow
|
arrow
|
||||||
disableInteractive
|
disableInteractive
|
||||||
title="Estimated server geolocation provided by DB-IP."
|
title="Estimated server geolocation provided by MaxMind."
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="caption"
|
variant="caption"
|
||||||
component={Link}
|
component={Link}
|
||||||
to="https://db-ip.com"
|
to="https://www.maxmind.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -144,12 +144,12 @@ export default function ServerDetails({
|
||||||
<Tooltip
|
<Tooltip
|
||||||
arrow
|
arrow
|
||||||
disableInteractive
|
disableInteractive
|
||||||
title="Estimated server geolocation provided by DB-IP"
|
title="Estimated server geolocation provided by MaxMind"
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="caption"
|
variant="caption"
|
||||||
component={Link}
|
component={Link}
|
||||||
to="https://db-ip.com"
|
to="https://www.maxmind.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue