frostfs-locode-db/README.md
Vitaliy Potyarkin 3a73e1c89c [#18] Stop using obsolete .github directory
This commit is a part of multi-repo cleanup effort:
TrueCloudLab/frostfs-infra#136

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-11-06 15:25:12 +03:00

104 lines
2.8 KiB
Markdown

<p align="center">
<img src="./.forgejo/logo.svg" width="500px" alt="FrostFS logo">
</p>
<p align="center">
UN/LOCODE database for <a href="https://frostfs.info">ForstFS</a>
</p>
---
# Overview
FrostFS uses UN/LOCODE in storage node attributes and storage policies. Inner
ring nodes converts UN/LOCODE into human-readable set of attributes such as
continent, country name, etc.
This repository tools generate UN/LOCODE database for FrostFS using data from
following sources:
- [UN/LOCODE](https://unece.org/trade/cefact/UNLOCODE-Download) database in CSV
format, licensed under the [ODC Public Domain Dedication and Licence (PDDL)](http://opendatacommons.org/licenses/pddl/1-0/)
- [OpenFlight Airports and
Countries](https://raw.githubusercontent.com/jpatokal/openflights/master/data/)
databases, licensed under the [GNU AGPL-3.0
license](https://github.com/jpatokal/openflights/blob/master/LICENSE)
- [OpenStreetMap](https://www.openstreetmap.org/)® open data, licensed under the [Open Data Commons Open
Database License](https://opendatacommons.org/licenses/odbl/) (ODbL)
# Build
## Prerequisites
- Go 1.21
## Quick start
Just run `make` to generate `locode_db` file for use with FrostFS InnerRing nodes.
``` shell
$ make
...
--out locode_db
```
## Building
Then run frost-cli command to generate UN/LOCODE database.
```
$ ./frostfs-locode-db generate
Generate UN/LOCODE database for FrostFS
Usage:
frostfs-locode-db generate [flags]
Flags:
--airports string Path to OpenFlights airport database (csv)
--continents string Path to continent polygons (GeoJSON)
--countries string Path to OpenFlights country database (csv)
-h, --help help for generate
--in strings List of paths to UN/LOCODE tables (csv)
--out string Target path for generated database
--subdiv string Path to UN/LOCODE subdivision database (csv)
$ ./frostfs-locode-db generate \
--airports airports.dat \
--continents continents.geojson \
--countries countries.dat \
--in 2022-2\ UNLOCODE\ CodeList.csv \
--subdiv 2022-2\ SubdivisionCodes.csv \
--out locode_db
```
**Database generation might take some time!**
You can test generated database with `frostfs-locode-db`.
```
$ frostfs-locode-db info --db locode_db --locode 'RU LED'
Country: Russia
Location: Saint Petersburg (ex Leningrad)
Continent: Europe
Subdivision: [SPE] Sankt-Peterburg
Coordinates: 59.88, 30.25
```
# Building Debian package
The most simple way is to run a make target
```shell
$ make debpackage
```
When packages are built, you can clean up the leftover with
```shell
$ dh clean
```
or
```shell
$ make debclean
```
## License
This project is licensed under the CC Attribution-ShareAlike 4.0 International -
see the [LICENSE](LICENSE) file for details