This node proyect cache data from https://ipstack.com (old https://freegeoip.net/)
Use image from https://hub.docker.com/r/gravadigital/ipstack-cache
docker pull gravadigital/ipstack-cache
Use docker-compose.yml
file as reference and configure your ipstack api key in IPSTACK_TOKEN
environment variable.
- require node v4 or higher
npm install
Copy .env.template file into .env and set your ipstack api key in IPSTACK_TOKEN
field.
npm start
GET :url/api/ip - return your ip info (not for local ip)
GET :url/api/ip/xx.xx.xx.xx - return ip info (not for local ip)
{
_id: (String),
ipRange: (String),
countryCode: (String),
countryName: (String),
regionCode: (String),
regionName: (String),
city: (String),
zipCode: (String),
timeZone: (String),
latitude: (Number),
longitude: (Number),
metroCode: (Number)
}
Request:
GET /api/ip/181.45.90.105
Response:
{
"ipRange": "181.45.90",
"countryCode": "AR",
"countryName": "Argentina",
"regionCode": "B",
"regionName": "Buenos Aires",
"city": "Claypole",
"latitude": -34.8,
"longitude": -58.3333
}
First of all, make sure you have incremented the package.json's version.
Make a commit in master. Then generate a tag pointing to this commit
git tag -a 1.1.2
where "1.1.2" is the new version
Push the commits and tag
git push --tags origin master
docker login
and complete with user and password from https://hub.docker.com
docker build -t gravadigital/ipstack-cache:1.1.2 .
where 1.1.2 is the current new version
Then make a "latest" version
docker tag gravadigital/ipstack-cache:1.1.2 gravadigital/ipstack-cache:latest
Push both versions: number and latest
docker push gravadigital/ipstack-cache:1.1.2
docker push gravadigital/ipstack-cache:latest
You must have permissions to edit this project in https://hub.docker.com