chore(docs): clean up debugging_names.md and self_hosting.md for clarity and conciseness

feat(docs): enhance self_hosting.md with additional instructions for quick setup and deployment
fix(nginx.py): add missing directory creation for nginx certificates in ssh_lib
refactor(nginx.py): update curl command filtering logic based on skip_planet configuration in http_host_lib
This commit is contained in:
Zsolt Ero
2024-10-12 00:08:27 +03:00
parent 4d93db437a
commit ac786ea084
5 changed files with 38 additions and 13 deletions

View File

@@ -22,10 +22,6 @@ Now we can compare where the naming problem is coming from.
In conclusion: for the **one specific example**, please link the OSM pages and add the inspector screenshot, then we can start with the debugging. In conclusion: for the **one specific example**, please link the OSM pages and add the inspector screenshot, then we can start with the debugging.
## Next steps ## Next steps
It'd be nice to compare with other OpenMapTiles implementations like [tilemaker](https://github.com/systemed/tilemaker) or the [OpenMapTiles reference](https://github.com/openmaptiles/openmaptiles). I don't have full planet datasets from these implementations currently, so if someone is willing to run one it'd be a great contribution. It'd be nice to compare with other OpenMapTiles implementations like [tilemaker](https://github.com/systemed/tilemaker) or the [OpenMapTiles reference](https://github.com/openmaptiles/openmaptiles). I don't have full planet datasets from these implementations currently, so if someone is willing to run one it'd be a great contribution.

View File

@@ -30,10 +30,12 @@ If you run it on a non-clean server, please understand that this will modify you
## Instructions ## Instructions
I recommend running things quickly first, with `SKIP_PLANET=true` and then once it works, running it with `SKIP_PLANET=false`.
#### 1. DNS setup #### 1. DNS setup
Set up a server with at least 300 GB SSD space and configure the DNS for the subdomain of your choice. Set up a server with at least 300 GB SSD space and configure the DNS for the subdomain of your choice.
For example "maps.example.com" -> 185.199.110.153 For example, make an A record for "maps.example.com" -> 185.199.110.153
#### 2. Clone and prepare `config` folder #### 2. Clone and prepare `config` folder
@@ -46,7 +48,7 @@ In the config folder, copy `.env.sample` to `.env` and set the values.
`DOMAIN_LE` - Your subdomain \ `DOMAIN_LE` - Your subdomain \
`LE_EMAIL` - Your email for Let's Encrypt `LE_EMAIL` - Your email for Let's Encrypt
It's recommended to set `SKIP_PLANET=true` first, check if everything works, and run `./init-server.py` a second time with `SKIP_PLANET=false`. This way you get a quick feedback loop for setting up your system. Set `SKIP_PLANET=true` first.
#### 3. Set up Python if you don't have it yet #### 3. Set up Python if you don't have it yet
@@ -54,7 +56,7 @@ On Ubuntu you can get it by `sudo apt install python3-pip`
On macOS you can do `brew install python` On macOS you can do `brew install python`
#### 4. Deploy http-host #### 4. Prepare the Python environment
You run the deploy script locally, and it deploys to a remove server over SSH. You can use a virtualenv if you are used to working with them, but it's not necessary. You run the deploy script locally, and it deploys to a remove server over SSH. You can use a virtualenv if you are used to working with them, but it's not necessary.
@@ -63,17 +65,42 @@ cd openfreemap
pip install -e . pip install -e .
``` ```
Then run the actual deploy command #### 5. Deploy quick version with `SKIP_PLANET=true`
Run the actual deploy command and wait a few minutes
``` ```
./init-server.py http-host-static HOSTNAME ./init-server.py http-host-static HOSTNAME
``` ```
If you used `SKIP_PLANET=true` then wait a few minutes and see what happens. #### 5. Check
If you use `SKIP_PLANET=false` then go for a walk and by the time you come back it should be up and running with the latest planet tiles deployed. Don't worry about the "Download aborted" lines in the meanwhile, it's a bug in CloudFlare. If everything is OK, you'll have some curl lines printed. Run the first one locally and make sure it's showing HTTP/2 200. For example this is an OK response.
*// Note: If your server doesn't have an SSD, the download + uncompressing process can take hours.* ```locally to test them.
curl -sI https://test.openfreemap.org/monaco | sort
HTTP/2 200
access-control-allow-origin: *
cache-control: max-age=86400
cache-control: public
content-length: 5776
content-type: application/json
date: Fri, 11 Oct 2024 21:01:23 GMT
etag: "670991d1-1690"
expires: Sat, 12 Oct 2024 21:01:23 GMT
last-modified: Fri, 11 Oct 2024 21:00:01 GMT
server: nginx
x-ofm-debug: latest JSON monaco
```
#### 6. Deploy and check with `SKIP_PLANET=true`
Update your `.env` file and re-run the same `./init-server.py http-host-static HOSTNAME` as before.
Go for a walk and by the time you come back it should be up and running with the latest planet tiles deployed. Don't worry about the "Download aborted" lines in the meanwhile, it's a bug in CloudFlare.
If your server doesn't have an SSD, the download + uncompressing process can take hours.
--- ---

View File

@@ -93,7 +93,9 @@ def write_nginx_config():
subprocess.run(['systemctl', 'reload', 'nginx'], check=True) subprocess.run(['systemctl', 'reload', 'nginx'], check=True)
curl_text_lines = sorted(curl_text_mix.splitlines()) curl_text_lines = sorted(curl_text_mix.splitlines())
if '/monaco' in curl_text_mix: if config.ofm_config.get('skip_planet'):
curl_text_lines = [l for l in curl_text_lines if '/planet' not in l]
else:
curl_text_lines = [l for l in curl_text_lines if '/monaco' not in l] curl_text_lines = [l for l in curl_text_lines if '/monaco' not in l]
curl_text_mix = '\n'.join(curl_text_lines) curl_text_mix = '\n'.join(curl_text_lines)

View File

@@ -1,5 +1,4 @@
import shutil import shutil
from datetime import datetime, timezone
from http_host_lib.assets import download_assets from http_host_lib.assets import download_assets
from http_host_lib.btrfs import download_area_version from http_host_lib.btrfs import download_area_version

View File

@@ -37,6 +37,7 @@ def nginx(c):
c.sudo('mkdir -p /data/nginx/sites') c.sudo('mkdir -p /data/nginx/sites')
c.sudo('mkdir -p /data/nginx/acme-challenges') c.sudo('mkdir -p /data/nginx/acme-challenges')
c.sudo('mkdir -p /data/nginx/certs')
if not exists(c, '/etc/nginx/ssl/dummy.crt'): if not exists(c, '/etc/nginx/ssl/dummy.crt'):
c.sudo('mkdir -p /etc/nginx/ssl') c.sudo('mkdir -p /etc/nginx/ssl')