---
# System prepended metadata

title: GeoLite2-Country

---

GeoLite2-Country
===
Sequence diagrams

```mermaid
sequenceDiagram
    participant IpInfoService
    participant MaxMind
    participant S3
    
    IpInfoService->>MaxMind: Download *.tar.gz
    MaxMind->>IpInfoService: *.tar.gz
    Note left of IpInfoService: Extract *.mmdb, apply new file to bean
    IpInfoService->>S3: Upload *.mmdb
    S3->>IpInfoService: Done    
```

Flow chart
- Build application with a database *.mmdb at the same folder with jar file.
- When application start, It will use this file *.mmdb (may be out date).
- Create a @Schedule Job run every (7 days) to get the new file from MaxMind server (It also run at start up and run every 7 days).
- When download completed, extract to get a folder like **GeoLite2-Country_20220805** which contains **GeoLite2-Country.mmdb** inside
- Load the new file to the bean of DataBaseReader to get IpInfo.
- Upload file with it parent folder (**GeoLite2-Country_20220805**) to S3 to backup 

```mermaid
flowchart TD

A[Start]-->B[Load Local *.mmdb]
B-->C[Schedule get file *.tar.gz from MaxMind Server]
C-->D[Extract *.mmdb] -->F[apply new *mmdb to Bean] --> G[End]
D-->E[Upload to S3 repository to backup] -->G

```