From b746263cea8fe2328bb8c9906398dba47bbb58ea Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Tue, 27 Aug 2024 02:02:37 +0200 Subject: [PATCH] docs --- README.md | 9 ++++----- scripts/tile_gen/tile_gen.py | 5 +++-- scripts/tile_gen/tile_gen_lib/extract.py | 8 ++++---- website/src/content/how_to_use/self_hosting.md | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 29a14f6..5179364 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ There is no cloud, just dedicated servers. The HTTPS server is nginx on Ubuntu. Production-quality hosting of 300 million tiny files is hard. The average file size is just 450 byte. Dozens of tile servers have been written to tackle this problem, but they all have their limitations. -The original idea of this project is to avoid using tile servers altogether. Instead, the tiles are directly served from Btrfs partition images + hard links using an optimised nginx config. I wrote [extract_mbtiles](scripts/tile_gen/extract_mbtiles) and [shrink_btrfs](scripts/tile_gen/shrink_btrfs) scripts for this very purpose. +The original idea of this project is to avoid using tile servers altogether. Instead, the tiles are directly served from Btrfs partition images + hard links using an optimised nginx config. I wrote [extract_mbtiles](scripts/tile_gen/scripts/extract_mbtiles.py) and [shrink_btrfs](scripts/tile_gen/scripts/shrink_btrfs.py) scripts for this very purpose. This replaces a running service with a pure, file-system-level implementation. Since the Linux kernel's file caching is among the highest-performing and most thoroughly tested codes ever written, it delivers serious performance. @@ -91,7 +91,7 @@ _note: Tile generation is 100% optional, as we are providing the processed full The `tile_gen` script downloads a full planet OSM extract and runs it through Planetiler. -The created .mbtiles file is then extracted into a Btrfs partition image using the custom [extract_mbtiles](scripts/tile_gen/extract_mbtiles) script. The partition is shrunk using the [shrink_btrfs](scripts/tile_gen/shrink_btrfs) script. +The created .mbtiles file is then extracted into a Btrfs partition image using the custom [extract_mbtiles](scripts/tile_gen/scripts/extract_mbtiles.py) script. The partition is shrunk using the [shrink_btrfs](scripts/tile_gen/scripts/shrink_btrfs.py) script. Finally, it's uploaded to a public Cloudflare R2 bucket using rclone. @@ -111,10 +111,9 @@ See [self hosting docs](docs/self_hosting.md). ### Full planet downloads -You can directly download the processed full planet runs on the following URLs: +You can directly download the processed full planet runs on the following URL patterns: -https://planet.openfreemap.com/20240607_232801_pt/tiles.mbtiles // 89 GB, mbtiles file -https://planet.openfreemap.com/20240607_232801_pt/tiles.btrfs.gz // 86 GB, Btrfs partition image +https://planet.openfreemap.com/20240607_232801_pt/tiles.btrfs.gz // 86 GB Replace the `20240607_232801_pt` part with any newer run, from the [index file](https://planet.openfreemap.com/index.txt). diff --git a/scripts/tile_gen/tile_gen.py b/scripts/tile_gen/tile_gen.py index e871467..567f9ef 100755 --- a/scripts/tile_gen/tile_gen.py +++ b/scripts/tile_gen/tile_gen.py @@ -25,8 +25,9 @@ def make_tiles(area): Generate tiles for a given area """ - # run_planetiler(area) - make_btrfs(Path('/data/ofm/tile_gen/runs/monaco/20240826_230406_pt')) + run_folder = run_planetiler(area) + make_btrfs(run_folder) + # make_btrfs(Path('/data/ofm/tile_gen/runs/monaco/20240826_230406_pt')) @cli.command() diff --git a/scripts/tile_gen/tile_gen_lib/extract.py b/scripts/tile_gen/tile_gen_lib/extract.py index 81c1411..fbb0e43 100644 --- a/scripts/tile_gen/tile_gen_lib/extract.py +++ b/scripts/tile_gen/tile_gen_lib/extract.py @@ -66,6 +66,8 @@ def make_btrfs(run_folder: Path): stderr=err, ) + os.unlink('tiles.mbtiles') + shutil.copy('mnt_rw/extract/osm_date', '.') # process logs @@ -122,15 +124,13 @@ def make_btrfs(run_folder: Path): os.unlink('image.btrfs') shutil.move('image2.btrfs', 'tiles.btrfs') - # parallel gzip + # parallel gzip (pigz) subprocess.run(['pigz', 'tiles.btrfs', '--fast'], check=True) - # logs + # move logs Path('logs').mkdir() for pattern in ['*.log', '*.txt']: for file in Path().glob(pattern): shutil.move(file, 'logs') print('extract_btrfs.py DONE') - - return run_folder diff --git a/website/src/content/how_to_use/self_hosting.md b/website/src/content/how_to_use/self_hosting.md index 2e53e0b..e7220ff 100644 --- a/website/src/content/how_to_use/self_hosting.md +++ b/website/src/content/how_to_use/self_hosting.md @@ -1,3 +1,4 @@ ## Self-hosting -You can also download our processed planet MBTiles and Btrfs images if you want to self-host yourself. Details can be found on [GitHub](https://github.com/hyperknot/openfreemap). +You can also download our processed full planet Btrfs images if you want to self-host yourself. Details can be found on [GitHub](https://github.com/hyperknot/openfreemap). +