From b9ce6615eab944930188d7db104980a6e0e8380d Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Tue, 11 Jun 2024 02:04:09 +0200 Subject: [PATCH] docs, readme --- .ruff.toml | 12 ++++++++---- README.md | 13 +++++++------ scripts/loadbalancer/loadbalancer_lib/cloudflare.py | 2 +- website/blocks/main.md | 8 ++++---- website/template.html | 4 +--- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 7ddd832..c4164f3 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -2,7 +2,9 @@ target-version = "py310" line-length = 100 extend-exclude = ["temp"] -select = [ + + +lint.select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes @@ -18,11 +20,12 @@ select = [ 'DTZ', # flake8-datetimez, https://beta.ruff.rs/docs/rules/#flake8-datetimez-dtz ] -ignore = [ +lint.ignore = [ 'A003', 'E501', 'E711', 'E712', + # 'E721', # type comparison 'E741', 'F401', # unused imports 'F841', @@ -36,9 +39,10 @@ ignore = [ [format] quote-style = "single" -[isort] +[lint.isort] known-first-party = ["ssh_lib"] lines-after-imports = 2 -[flake8-comprehensions] +[lint.flake8-comprehensions] allow-dict-calls-with-keyword-arguments = true + diff --git a/README.md b/README.md index d16d855..7595fd0 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ You can run `./host_manager.py --help` to see which options are available. Some _note: Tile generation is 100% optional, as we are providing the processed full planet files for public download._ -The `tile_gen` scripts downloads a full planet OSM extract and runs it through Planetiler. +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. @@ -87,9 +87,9 @@ A very important part, probably needs the most work in the long term future. Round Robin DNS based load balancer, script for health checking and updating records. -Pushed warnings to a Telegram bot. +Pushes warnings to a Telegram bot. -Currently it's running in warning-only mode, DNS updates need manual confirmation. +Currently it's running in read-only mode, DNS updates need manual confirmation. ## Self hosting @@ -103,7 +103,7 @@ The original idea of this project is to avoid using tile servers altogether. Ins 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. -I run some [benchmarks](docs/quick_notes/http_benchmark.md) on a Hetzner server, the aim was to saturate a gigabit connection. At the end, it was able to serve 30 Gbit on localhost, on a cold nginx cache. +I run some [benchmarks](docs/quick_notes/http_benchmark.md) on a Hetzner server, the aim was to saturate a gigabit connection. At the end, it was able to serve 30 Gbit on loopback interface, on cold nginx cache. ## FAQ @@ -158,7 +158,6 @@ Bigger tasks: Tasks outside the scope of this project: - Make a successor for the OpenMapTiles schema. -- Docker image for running this self-hosted on any machine. #### Dev setup @@ -166,7 +165,9 @@ See [dev setup docs](docs/dev_setup.md). ## Changelog -v0.1 - everything works. 1 server for tile gen, 2 servers for HTTP host. <- we are here! +##### v0.1 + +Everything works. 1 server for tile gen, 2 servers for HTTP host. Load-balancing script is running in a read-only mode. ## Attribution diff --git a/scripts/loadbalancer/loadbalancer_lib/cloudflare.py b/scripts/loadbalancer/loadbalancer_lib/cloudflare.py index 17f171c..b871a07 100644 --- a/scripts/loadbalancer/loadbalancer_lib/cloudflare.py +++ b/scripts/loadbalancer/loadbalancer_lib/cloudflare.py @@ -100,7 +100,7 @@ def delete_record(zone_id, *, id_: str, cloudflare_api_token: str): res = requests.delete( f'https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records/{id_}', headers=headers, - json=dict(), + json={}, ) res.raise_for_status() data = res.json() diff --git a/website/blocks/main.md b/website/blocks/main.md index 25a74de..503fc80 100644 --- a/website/blocks/main.md +++ b/website/blocks/main.md @@ -62,14 +62,14 @@ GitHub: [openfreemap](https://github.com/hyperknot/openfreemap) and [openfreemap ## What is the tech stack? -The map schema is [OpenMapTiles](https://github.com/openmaptiles/openmaptiles). -Special thanks go to [Michael Barry](https://github.com/msbarry) for developing [Planetiler](https://github.com/onthegomap/planetiler). It made it possible to generate the tiles in 5 hours instead of 5 weeks. -The [styles](https://github.com/hyperknot/openfreemap-styles) are forked and heavily modified. - There is no tile server running; only Btrfs partition images with 300 million hard-linked files. This was my idea; I haven't read about anyone else doing this in production, but it works really well. There is no cloud, just dedicated servers. The HTTPS server is nginx on Ubuntu. +Special thanks go to [Michael Barry](https://github.com/msbarry) for developing [Planetiler](https://github.com/onthegomap/planetiler). It made it possible to generate the tiles in 5 hours instead of 5 weeks. The map schema is [OpenMapTiles](https://github.com/openmaptiles/openmaptiles). + +The [styles](https://github.com/hyperknot/openfreemap-styles) are forked and heavily modified. + ## Domains `tiles.openfreemap.org` - Cloudflare proxied diff --git a/website/template.html b/website/template.html index cf8fb36..a672ae3 100644 --- a/website/template.html +++ b/website/template.html @@ -29,9 +29,7 @@ github - x + x {main}