geolocation is a CLI App built with cobra and viper and go.
It parses location data from a csv file, sanitise and runs it through some validations and uploads it to a postgres table,
after the loading is done the data can be accessed over an api call by passing in an IP address.
That's in nut shell what the app dose.
The App exposes 2 main commands:-
ingestwhich parses acsvfile and persists it in databaseservewhich runs anhttp serverexposing and endpoint namedresolvewhich converts a givenIP Addresstolocationusing the database populated in step#1
./geolocation --help
./geolocation ingest --help
./geolocation serve --help
The App, at bare minimim needs a .env at the project's root with following details
DB_HOST=postgres
BD_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_DATABASE=postgres
DB_DRIVER=postgres
DB_EXPLORER_EMAIL=someone@postgres.com
DB_EXPLORER_PASSWORD=postgres
and a .csv file to ingest location data from.
For docker-compose to work, we've to mount the location where .csv file is present
line # 23 in docker-compose.yaml
cli commands -> service -> database
docker-compose up will bring up all services.
After all services have successfully come up visit
localhost and substitute the ip, either it will get resolved or you'll get an error.
To explore the postgres data visit postgres and login with DB_EXPLORER_EMAIL and DB_EXPLORER_PASSWORD and configure the database in there.