Imagine you're tasked with implementing a geo-fencing feature for your service. At first glance, dropping in an IP GeoLocation API might seem straightforward, but often, project constraints or requirements complicate the simplest solutions. Let's explore our options.
This method involves embedding a geolocation database directly within your application. It offers fast response times as it resides in-memory and operates independently of external services. However, this approach can be resource-intensive and harder to manage. Let’s see it in more detail.
Opting for a third-party API to handle geolocation queries reduces your application's resource load and ensures access to the most current data, but it comes with its own challenges:
Faced with these challenges, I developed Atlas—a robust solution designed to synergize the benefits of both approaches. Atlas acts as a self-hosting HTTP service that automatically manages and serves the latest MaxMind geolocation databases, providing:
Open and Free: Atlas is Open Source and freely available under Apache-2.0 License.
By hosting Atlas closer to your application but operating like a remote API, it offers a middle ground that maximizes efficiency without the drawbacks of either method we have discussed.
Atlas is written in Rust, a language chosen for its unparalleled safety, performance, and resource efficiency. Rust's ownership model ensures memory safety without the need for a garbage collector, which is particularly advantageous during database updates—these operations consume minimal memory, avoiding the typical overhead associated with garbage-collected languages.
This design choice not only boosts Atlas's performance but also enhances its reliability, making it an ideal solution for managing GeoIP data efficiently and safely.
Atlas Docker images are automatically built and pushed to Docker Hub via GitHub Actions, making it easy for anyone to use. For detailed instructions on using these Docker images or building Atlas from source and configuration parameters, please refer to the Atlas README.md.
Atlas features a straightforward API, documented with OpenAPI 3.0 Specs. You can access the API documentation from the public internet here: https://atlas-rs.fly.dev/swagger-ui/.
Here’s an example of how you can use curl to query the demo instance of Atlas (hosted publicly thanks to Fly.io and the GeoLite2 MaxMind database license) to retrieve country information for an IP address 8.8.8.8
:
> curl https://atlas-rs.fly.dev/geoip/lookup/country/8.8.8.8 | jq
{
"results": {
"8.8.8.8": {
"country": {
"iso_code": "US",
// additional fields...
},
// additional results...
}
},
"database_build_epoch": 1715091859
}
Please note that this demo instance is intended only for demonstration and documentation purposes.
As a newly introduced open-source project, Atlas is in the early stages of building its community. I am excited about the potential for Atlas to evolve and thrive with contributions from developers like you. Whether you're interested in refining functionality, adding new features, or simply improving documentation, your contributions are welcome and greatly valued.
Try Atlas: The best way to start is by using Atlas in your projects. Experiment with it, identify any issues, and suggest improvements based on your real-world usage.
Report Issues: If you encounter any bugs or issues while using Atlas, please report them on the GitHub issues page. This feedback is crucial for continual improvement.
Suggest Features: Have ideas for new features or enhancements? Open a discussion on the GitHub repository or contribute directly by submitting a pull request.
Improve Documentation: As Atlas evolves, so too does the need for clear and comprehensive documentation. Whether it's enhancing the current content or writing tutorials and guides, your knowledge-sharing is invaluable.
Spread the Word: If you find Atlas useful, consider sharing it within your networks. Blog about your experiences, talk about Atlas at meetups, or share it on social media.
I am relatively new to Rust but bring many years of experience from other technology stacks. This project presents a great opportunity for more experienced Rust developers to contribute, ensuring that Atlas adheres to Rust's best practices and conventions since I know that it is not as good as it can be right now.
I am committed to maintaining Atlas as a community-driven project and believe in open, collaborative development. I am eager to see how the community will shape Atlas's path forward and encourage you to join me in this journey, helping to build a tool that serves the needs of developers globally.
In the end, I would like to give a special thanks to oschwald for creating the rust maxminddb crate which made Atlas possible.
As we continue to develop and improve Atlas, my vision is to create a robust, user-friendly minimal service. As of today, Atlas only supports MaxMind databases, but it would be beneficial to have an extensible implementation so more and more formats can be supported.
Another aspect I would like to pay attention to is adding more endpoint types such as gRPC so that users can choose the best endpoint based on their requirements and needs.
Thank you for taking the time to learn about Atlas. I am excited to see where we can take this project with your support and collaboration!