The purpose of this repository is to make it easy to import MaxMind's GeoLite2/GeoIP2 CSV databases into a local Docker 🐳 container which is running PostgreSQL. This is meant to provide an easy way to query the CSV data in PostgreSQL. It's not meant as a solution to deploy to production.
Before you get started, edit the DATABASES
variable in
bin/download/download-db.sh
. The currently tested list of databases is:
"GeoIP2-Anonymous-IP" "GeoLite2-City" "GeoIP2-Enterprise"
. Once you are happy
with this list you are ready to build the container.
./bin/download/docker-build.sh
Run the following script, replacing the word SEEKRIT
with a MaxMind license
key.
MM_LICENSE_KEY=SEEKRIT ./bin/download/docker-run.sh
You may run this script as often as you like. It will download a database if none exists locally or if there is a newer version available to download.
./bin/docker-build.sh
./bin/docker-run.sh
If you have psql
installed locally, use this command. When prompted for your password, enter "foo".
./bin/psql.sh
If you'd rather connect without a wrapper script, you can do something like:
psql -h localhost -U root -d mm_database
If you'd like to connect to the Docker container directly, get the Docker
container ID by running docker ps
. You can then use the id in the following
command:
docker exec -it CONTAINER_ID bash
Once you're inside the container, use the same command as above:
psql -h localhost -U root -d mm_database