diff --git a/akvorado.yaml b/akvorado.yaml index 17ce6087..bbac20c1 100644 --- a/akvorado.yaml +++ b/akvorado.yaml @@ -30,8 +30,9 @@ inlet: kafka: compression-codec: zstd geoip: - # asn-database: /usr/share/GeoIP/GeoLite2-ASN.mmdb - # country-database: /usr/share/GeoIP/GeoLite2-Country.mmdb + optional: true + asn-database: /usr/share/GeoIP/GeoLite2-ASN.mmdb + country-database: /usr/share/GeoIP/GeoLite2-Country.mmdb snmp: workers: 10 flow: diff --git a/console/data/docs/01-install.md b/console/data/docs/01-install.md index 50171f6e..9ef466e0 100644 --- a/console/data/docs/01-install.md +++ b/console/data/docs/01-install.md @@ -57,8 +57,6 @@ A few synthetic flows are generated in the background. Take a look at the `docker-compose.yml` file if you want to setup the GeoIP database. It requires two environment variables to fetch them from [MaxMind](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data). -The appropriate configuration also needs to be uncommented in -`akvorado.yaml`. Be sure to flush the conntrack table after starting. See the [troubleshooting section](05-troubleshooting.md#no-packets-received) diff --git a/console/data/docs/02-configuration.md b/console/data/docs/02-configuration.md index a538f990..24e02ebb 100644 --- a/console/data/docs/02-configuration.md +++ b/console/data/docs/02-configuration.md @@ -203,6 +203,8 @@ is provided, the component is inactive. It accepts the following keys: - `asn-database` tells the path to the ASN database - `country-database` tells the path to the country database +- `optional` makes the presence of the databases optional on start + (when not present on start, the component is just disabled) [MaxMind DB file format]: https://maxmind.github.io/MaxMind-DB/ diff --git a/docker-compose.yml b/docker-compose.yml index 2a79c9c7..be8a8fa0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,8 @@ volumes: services: geoip: + # Put ACCOUNT_ID and LICENSE_KEY here, or provide them on the command-line + # (env GEOIPUPDATE_ACCOUNT_ID=... GEOIPUPDATE_LICENSE_KEY=... docker-compose ...) image: maxmindinc/geoipupdate:v4 environment: - GEOIPUPDATE_ACCOUNT_ID diff --git a/inlet/geoip/config.go b/inlet/geoip/config.go index 6257e5a3..54762af3 100644 --- a/inlet/geoip/config.go +++ b/inlet/geoip/config.go @@ -9,6 +9,8 @@ type Configuration struct { ASNDatabase string // CountryDatabase defines the path to the country database. CountryDatabase string + // Optional tells if we need to error if not present on start. + Optional bool } // DefaultConfiguration represents the default configuration for the diff --git a/inlet/geoip/root.go b/inlet/geoip/root.go index defd5afa..d6c147e8 100644 --- a/inlet/geoip/root.go +++ b/inlet/geoip/root.go @@ -90,10 +90,10 @@ func (c *Component) openDatabase(which string, path string, container *atomic.Va // Start starts the GeoIP component. func (c *Component) Start() error { - if err := c.openDatabase("country", c.config.CountryDatabase, &c.db.country); err != nil { + if err := c.openDatabase("country", c.config.CountryDatabase, &c.db.country); err != nil && !c.config.Optional { return err } - if err := c.openDatabase("asn", c.config.ASNDatabase, &c.db.asn); err != nil { + if err := c.openDatabase("asn", c.config.ASNDatabase, &c.db.asn); err != nil && !c.config.Optional { return err } if c.db.country.Load() == nil && c.db.asn.Load() == nil {