Compare commits
4 Commits
0e56d778bc
...
compartmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 690a117ffd | |||
| 9dfbded5b8 | |||
| 7b7d422890 | |||
| 2d6083f530 |
@@ -11,14 +11,14 @@ ENV \
|
|||||||
# Set the invariant mode since ICU package isn't included (see https://github.com/dotnet/announcements/issues/20)
|
# Set the invariant mode since ICU package isn't included (see https://github.com/dotnet/announcements/issues/20)
|
||||||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
|
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
|
||||||
|
|
||||||
RUN apk add --upgrade --no-cache \
|
#RUN apk add --upgrade --no-cache \
|
||||||
ca-certificates-bundle \
|
# ca-certificates-bundle \
|
||||||
\
|
# \
|
||||||
# .NET dependencies
|
# # .NET dependencies
|
||||||
libgcc \
|
# libgcc \
|
||||||
libssl3 \
|
# libssl3 \
|
||||||
libstdc++ \
|
# libstdc++ \
|
||||||
zlib
|
# zlib
|
||||||
|
|
||||||
# Create a non-root user and group
|
# Create a non-root user and group
|
||||||
RUN addgroup \
|
RUN addgroup \
|
||||||
|
|||||||
60
README.md
60
README.md
@@ -4,25 +4,46 @@
|
|||||||
|
|
||||||
This web application provides a self-published IP geolocation feed, conforming to the standards set out in [RFC 8805](https://www.rfc-editor.org/rfc/rfc8805). It is designed to interface with NetBox, a web-based infrastructure resource modeling (IRM) tool, to retrieve and format geolocation data for IP addresses.
|
This web application provides a self-published IP geolocation feed, conforming to the standards set out in [RFC 8805](https://www.rfc-editor.org/rfc/rfc8805). It is designed to interface with NetBox, a web-based infrastructure resource modeling (IRM) tool, to retrieve and format geolocation data for IP addresses.
|
||||||
|
|
||||||
The application is implemented in C# using .NET 8.0, ensuring a robust and modern back-end architecture. It's built to communicate securely over HTTPS with the NetBox API, adhering to best practices for data transmission and security.
|
The application is implemented in C# using .NET 8.0, ensuring a robust and modern back-end architecture. It's built to communicate securely over HTTPS with the NetBox API, adhering to best practices for data transmission and security.
|
||||||
|
|
||||||
|
This project was inspired by the GitHub project [GeoBox](https://github.com/FrumentumNL/GeoBox), which provided foundational ideas for the development of this application.
|
||||||
|
|
||||||
|
## Application Variants
|
||||||
|
|
||||||
|
### AS1024.GeoFeed - MVC Version (Recommended)
|
||||||
|
|
||||||
|
The standard version of this application, named `AS1024.GeoFeed`, is built using the Model-View-Controller (MVC) architecture. This variant is fully supported and recommended for most use cases. It offers a complete set of features and is optimized for robustness and scalability.
|
||||||
|
|
||||||
|
### AS1024.GeoFeed.MinimalAPI - MinimalAPI Version (Experimental)
|
||||||
|
|
||||||
|
In addition to the standard MVC version, there is an experimental MinimalAPI version of the application named `AS1024.GeoFeed.MinimalAPI`. This variant is designed for environments that require extremely fast startup times, such as serverless containers. However, it comes with limited support and a reduced feature set. We recommend using the `AS1024.GeoFeed.MinimalAPI` version only if your deployment environment necessitates near-instant startup times and you are comfortable with its experimental nature and limitations.
|
||||||
|
|
||||||
|
**Note**: While the `AS1024.GeoFeed.MinimalAPI` version offers performance benefits in specific scenarios, we strongly recommend deploying the `AS1024.GeoFeed` MVC version for most applications to ensure full functionality and support.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **GeoFeed Generation**: Dynamically generates a geolocation feed in CSV format as specified in RFC 8805.
|
- **GeoFeed Generation**: Dynamically generates a geolocation feed in CSV format as specified in RFC 8805.
|
||||||
- **Caching Mechanism**: Implements an efficient caching strategy to reduce redundant API calls and enhance performance.
|
- **Caching Mechanism**: Implements an efficient caching strategy to reduce redundant API calls and enhance performance.
|
||||||
- **Local Disk Fallback Caching Mechanism**: In the event of a failure to communicate with the NetBox instance specified, the web app will return data that is locally cached inside a SQLite database.
|
- **Local Disk Fallback Caching Mechanism**: In the event of a failure to communicate with the NetBox instance specified, the web app will return data that is locally cached inside a SQLite database. In the minimal API version of the GeoFeed application, this will be stored as a file, rather than a SQLite database as Minimal API does not yet support Entity Framework Core at this time.
|
||||||
- **Secure Communication**: Ensures secure data retrieval from NetBox over HTTPS.
|
- **Secure Communication**: Ensures secure data retrieval from NetBox over HTTPS.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The application requires the following configuration variables to be set:
|
The application requires the following configuration variables to be set, depending on the version you are using:
|
||||||
|
|
||||||
|
### For AS1024.GeoFeed - MVC Version
|
||||||
1. **APIKey**: This is the API key used for authenticating with the NetBox API. Ensure this key has the necessary permissions to access the required resources.
|
1. **APIKey**: This is the API key used for authenticating with the NetBox API. Ensure this key has the necessary permissions to access the required resources.
|
||||||
2. **NetBoxHost**: The hostname of the NetBox instance from which the application retrieves data. For example, `netbox.example.com`.
|
2. **NetBoxHost**: The hostname of the NetBox instance from which the application retrieves data. For example, `netbox.example.com`.
|
||||||
3. **LocalFeedCache**: This connection string is for a local SQLite Database that caches the geofeed data from Netbox.
|
3. **LocalFeedCache**: This connection string is for a local SQLite Database (using EF Core) that caches the geofeed data from Netbox. The syntax should follow the standard SQLite EF Core connection string format.
|
||||||
|
|
||||||
|
### For AS1024.GeoFeed.MinimalAPI - MinimalAPI Version
|
||||||
|
1. **APIKey**: This is the API key used for authenticating with the NetBox API. Ensure this key has the necessary permissions to access the required resources.
|
||||||
|
2. **NetBoxHost**: The hostname of the NetBox instance from which the application retrieves data. For example, `netbox.example.com`.
|
||||||
|
3. **TempCache** (optional): This configuration is specific to the Minimal API version. It is optional, but if users wish to specify a different location for storing and serving the cached geofeed data, this value can be adjusted to point to the desired save location.
|
||||||
|
|
||||||
These variables can be set in your application's configuration file or through environment variables, depending on your deployment strategy.
|
These variables can be set in your application's configuration file or through environment variables, depending on your deployment strategy.
|
||||||
|
|
||||||
|
|
||||||
## NetBox Custom Fields
|
## NetBox Custom Fields
|
||||||
|
|
||||||
Ensure that your NetBox instance is configured with the following custom fields:
|
Ensure that your NetBox instance is configured with the following custom fields:
|
||||||
@@ -46,6 +67,37 @@ To build and run the application, follow these steps:
|
|||||||
5. After a successful build, you can start the application by running `dotnet run`.
|
5. After a successful build, you can start the application by running `dotnet run`.
|
||||||
6. The application will start, and you can access the endpoints as specified.
|
6. The application will start, and you can access the endpoints as specified.
|
||||||
|
|
||||||
|
## Building a Docker Image
|
||||||
|
|
||||||
|
### Building a Docker Image for the Minimal API Version
|
||||||
|
|
||||||
|
To containerize the `AS1024.GeoFeed` version using Docker, you can follow these steps to build a Docker image:
|
||||||
|
|
||||||
|
1. Open your terminal or command line interface.
|
||||||
|
2. Navigate to the root directory of this repository.
|
||||||
|
3. Execute the following Docker build command: ``docker buildx build --platform=linux/amd64,linux/arm64 -f .\AS1024.GeoFeed\Dockerfile .``
|
||||||
|
|
||||||
|
### Building a Docker Image for the Minimal API Version
|
||||||
|
|
||||||
|
To containerize the `AS1024.GeoFeed.MinimalAPI` version using Docker, you can follow these steps to build a Docker image:
|
||||||
|
|
||||||
|
1. Open your terminal or command line interface.
|
||||||
|
2. Navigate to the root directory of this repository.
|
||||||
|
3. Execute the following Docker build command: ``docker buildx build --platform=linux/amd64 -f .\AS1024.GeoFeed.MinimalAPI\Dockerfile.alpine-selfcontained .``
|
||||||
|
|
||||||
|
**Currently the minimal API version does not support being cross compiled for different CPU architectures. It is best built with the same CPU architecture where the build machine is targeting to.**
|
||||||
|
|
||||||
|
Ensure you have Docker installed and configured on your machine before executing this command. This Docker image can then be used to deploy the application in containerized environments such as Kubernetes or Docker Compose setups.
|
||||||
|
|
||||||
|
## Docker Deployment
|
||||||
|
|
||||||
|
To deploy the Docker container of this GeoFeed application, simply pull the image for the following variants:
|
||||||
|
|
||||||
|
- MVC Variant ``docker pull git.startmywifi.com/as1024/geofeed:latest``
|
||||||
|
- Minimal API Variant ``docker pull git.startmywifi.com/as1024/geofeed:aot-minimal``
|
||||||
|
|
||||||
|
To configure the container, please refer to the Configuration section above. You should be able to configure this with either an environment variable or map an ``appSettings.json`` file to the container.
|
||||||
|
|
||||||
## Endpoints
|
## Endpoints
|
||||||
|
|
||||||
The application provides the following key endpoints:
|
The application provides the following key endpoints:
|
||||||
|
|||||||
Reference in New Issue
Block a user