https://github.com/maxmind/geolite2-ws-blogpost
Integrating MaxMind's Free and Paid IP Geolocation Web Services (in PHP)
https://github.com/maxmind/geolite2-ws-blogpost
geoip2 geolite2 geolocation ip maxmind php webservice
Last synced: 8 months ago
JSON representation
Integrating MaxMind's Free and Paid IP Geolocation Web Services (in PHP)
- Host: GitHub
- URL: https://github.com/maxmind/geolite2-ws-blogpost
- Owner: maxmind
- Created: 2021-01-08T03:43:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-18T15:28:36.000Z (almost 4 years ago)
- Last Synced: 2024-12-23T08:12:11.281Z (10 months ago)
- Topics: geoip2, geolite2, geolocation, ip, maxmind, php, webservice
- Language: PHP
- Homepage: https://blog.maxmind.com/2021/01/11/integrating-maxminds-free-and-paid-ip-geolocation-web-services-in-php/
- Size: 784 KB
- Stars: 4
- Watchers: 14
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README-Docker.md
Awesome Lists containing this project
README
# Docker README
* [Getting Started](#getting-started)
* [Building Your Docker Container](#building-your-docker-container)
* [Running the Code](#running-the-code)
* [Refactoring Your Code](#refactoring-your-code)
* [Mapping your local volume to the Docker container](#mapping-your-local-volume-to-the-docker-container)## Getting Started
A `Dockerfile` has been provided in order to make this code more convenient to
run. To get started via `Docker`, you'll need:* A working Docker environment
* A `git checkout` of this repository
* Your MaxMind Account ID and License Key## Building Your Docker Container
After you have checked out this repository, run this command from the root
directory. (Replace `YOURACCOUNTID` with your MaxMind Account ID and
`YOURLICENSEKEY` with your License Key first. Linux users may need to preface
this command with `sudo`.)```bash
docker build . -t geolite2-ws-blogpost --build-arg MM_ACCOUNT_ID=YOURACCOUNTID --build-arg MM_LICENSE_KEY=YOURLICENSE_KEY
```This will build your Docker container.
## Running the Code
To start up your server, run this command. (Linux users may need to preface this
command with `sudo`.)```bash
docker run -p 9595:9595 geolite2-ws-blogpost:latest
```Now you can visit http://localhost:9595 on your host machine and make GeoLite2
Web Service queries.## Refactoring Your Code
You can freely edit the code outside of the Docker container and then re-run it
from inside the container. To do so, you'll need to map your local volume to the
container and install the dependencies again as they won't exist in your local
volume. (Linux users may need to preface the Docker command with `sudo`.)### Mapping your local volume to the Docker container
```bash
docker run -it -p 9595:9595 --volume $PWD:/project geolite2-ws-blogpost:latest /bin/bash
curl -sS https://getcomposer.org/installer | php
php composer.phar require geoip2/geoip2:~2.0
php -S 0:9595
```