What I built
ipinfo.tw - An "What's my IP address" service in Docker 🐳
It's a privacy first, non-tracking, ad-free & cookie-free solution to show your IP info.
Category Submission:
Random Roulette
App Link
Custom domain:
https://do-app-hackathon.ipinfo.tw/json (without trailing slash!)
DigitalOcean App Platform Domain:
https://ipinfo-tw-3jxdg.ondigitalocean.app/json (without trailing slash!)
Use a browser, or ... any available http user agents like curl
or wget
to access it!
The https://do-app-hackathon.ipinfo.tw/ custom domain was having problem when I write this post, so I use DigitalOcean App Platform Domain for the screenshots, but it's currently working now, thanks to the support engineer Dikshith for the help!
Screenshots
Description
It's a simple "What's my IP address" web service, but without coding, without advertisement, without user tracking, without cookie, just simple.
JSON output for programming or other service is also available via the /json
endpoint: https://ipinfo-tw-3jxdg.ondigitalocean.app/json
For more details, please take a look at the source repository below ⬇️
Link to Source Code
- https://github.com/PeterDaveHello/ipinfo.tw (GitHub)
- https://gitlab.com/PeterDaveHello/ipinfo.tw (GitLab)
Permissive License
https://github.com/PeterDaveHello/ipinfo.tw/blob/master/LICENSE
Background
For IT, RD, network or system admin, toolman guys, including me, it's very common to check users' IP to debug the Internet or network related issues, and we usually look for "What is my IP" services on the Internet, via Google, DuckDuckGo or StartPage search engine.
Most of the IP address info service has advertisements, which will help the service to pay for its infrastructure or even make some money, but it's also sometimes annoying, and even dangerous, because the advertisements sometimes link to malicious websites, and the users may not notice that, even they noticed, they may not know how to deal with it properly.
Also, those browser based IP info services won't work with command line tool friendly, they usually need to be fancy, with icons, images, composing, etc. Otherwise they might look a little bit ... boring(?) or old school(?), but I'm a system admin who works with command line interface everyday, there are thousands of Linux and FreeBSD servers that I'm working on doesn't have a GUI browser, in that case, a command line friendly ipinfo service could be very helpful.
So... I think I can build one simple IP info service without advertisement, but command line friendly, even support json output for programmable usages, and it should just be simple :D
How I built it
It's based on Alpine Linux Docker image, with nginx http server, and MaxMind's GeoLite2 IP database.
Initially it can't be built on DigitalOcean App Platform, because the path /var/run
was missing! Thanks to Kamal Nasser from DigitalOcean for the help, we realized that DigitalOcean App Platform is using Google's kaniko to build Docker images, and there was a difference(a bug, maybe) with the official Docker engine, and will need a workaround to deal with it, he suggested me to simple write another Dockerfile to "include"(FROM
in Dockerfile) the image was built on Docker Hub(peterdavehello/ipinfo.tw
) already, and found another workaround later: https://github.com/GoogleContainerTools/kaniko/issues/1278#issuecomment-693459315.
Once I can build the image on DigitalOcean, I noticed that nginx can't deal with users' IP addresses, because it's not directly connected with users, the IP address will be a private, internal IP address, which is meaningless. After I found the same question on DigitalOcean community and contacted with the technical support, an unofficial HTTP header: DO-Connecting-IP
was confirmed can be used as the client's IP address, and then it works on DigitalOcean since here!
Top comments (2)
Wow, a unique project indeed!
This is awesome! Well done and good luck with the Hackathon! 🙌