Skip to content

Commit fcad312

Browse files
committed
remove mitm, add onboarding flow, add basic docs
1 parent 9ae9b3a commit fcad312

20 files changed

Lines changed: 1062 additions & 1885 deletions

.github/workflows/docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/workflows/docs.yml
9+
- docs/**
10+
- mkdocs.yml
11+
- pyproject.toml
12+
- uv.lock
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
id-token: write
18+
pages: write
19+
20+
concurrency:
21+
group: pages
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v6
30+
31+
- name: Configure GitHub Pages
32+
uses: actions/configure-pages@v5
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v6
36+
with:
37+
python-version-file: pyproject.toml
38+
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v7
41+
with:
42+
enable-cache: true
43+
44+
- name: Install project
45+
run: uv sync --locked --extra dev
46+
47+
- name: Build docs
48+
run: uv run mkdocs build --strict
49+
50+
- name: Upload Pages artifact
51+
uses: actions/upload-pages-artifact@v4
52+
with:
53+
path: site
54+
55+
deploy:
56+
needs: build
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ __pycache__/
44
*.pyd
55
.pytest_cache/
66
data/
7+
site/
78
secrets/
89
config.toml

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ WORKDIR /app
1818

1919
COPY . /app
2020

21-
RUN pip install --no-cache-dir "/app[mitm]"
21+
RUN pip install --no-cache-dir /app
2222

23-
EXPOSE 443 8883 8081 51820/udp
23+
EXPOSE 443 8883
2424

2525
CMD ["roborock-local-server", "serve", "--config", "/app/config.toml"]

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ Pick one hostname under your domain, for example `roborock.example.com`.
4747
- Cloudflare is only used for DNS-01 certificate issuance. It does not need to proxy traffic to your server.
4848

4949
The vacuum needs to be able to hit your server on ports 443/tcp and 8883/tcp.
50-
If you use iPhone MITM intercept, expose 8081/tcp for the mitmweb UI (logs + WireGuard QR).
51-
When running in Docker, prefer the Admin "Open WireGuard Config (Docker-safe)" link over mitmweb's QR if the QR shows a container-only endpoint.
52-
The Admin MITM panel also provides an "Open WireGuard QR" code generated from the Docker-safe config.
5350

5451
- `443/tcp` for HTTPS
5552
- `8883/tcp` for MQTT over TLS
56-
- `8081/tcp` for mitmweb (optional, MITM only, access by IP not hostname)
57-
- `51820/udp` for WireGuard MITM tunnel traffic
5853

5954
## Project Layout
6055

@@ -83,34 +78,33 @@ cd roborock_local_server
8378
uv sync
8479
```
8580

86-
3. Generate an admin password hash.
81+
3. Run the setup wizard.
8782

8883
```bash
89-
uv run roborock-local-server hash-password
84+
uv run roborock-local-server configure
9085
```
9186

92-
4. Generate an admin session secret.
87+
The wizard asks only for:
9388

94-
```bash
95-
uv run roborock-local-server generate-secret
96-
```
89+
- your `stack_fqdn`
90+
- embedded MQTT or your own broker
91+
- whether to use Cloudflare DNS-01 auto-renew
92+
- your admin password
9793

98-
Both commands print a single value to your terminal and do not save it to a file for you.
94+
It then writes `config.toml` for you, generates `admin.password_hash`, generates `admin.session_secret`, and if you chose Cloudflare it also writes `secrets/cloudflare_token`.
9995

100-
- `hash-password` prints the value you should paste into `admin.password_hash`
101-
- `generate-secret` prints the value you should paste into `admin.session_secret`
102-
- if you did not save the output earlier, just run the command again and use the new value
103-
- if you change `session_secret` later, existing admin login sessions will be invalidated
96+
4. If you chose external MQTT, fill in `broker.host` in `config.toml` before starting the stack.
10497

105-
5. Create the secrets folder and save your Cloudflare API token.
98+
5. If you skipped Cloudflare, put your certificate files in `data/certs/fullchain.pem` and `data/certs/privkey.pem`.
10699

107-
```bash
108-
mkdir -p secrets
109-
printf '%s' 'YOUR_CLOUDFLARE_TOKEN' > secrets/cloudflare_token
110-
chmod 600 secrets/cloudflare_token
111-
```
100+
6. If you prefer doing setup manually, the wizard is equivalent to:
101+
102+
- `uv run roborock-local-server hash-password`
103+
- `uv run roborock-local-server generate-secret`
104+
- creating `secrets/cloudflare_token` yourself
105+
- writing `config.toml` yourself
112106

113-
6. Create `config.toml` with this baseline configuration.
107+
7. The wizard produces a config in this shape.
114108

115109
```toml
116110
[network]
@@ -206,17 +200,17 @@ session_secret = "PASTE_THE_SECRET_FROM_GENERATE_SECRET"
206200
session_ttl_seconds = 86400
207201
```
208202

209-
7. In your private DNS, point `roborock.example.com` to your server's LAN IP.
203+
8. In your private DNS, point `roborock.example.com` to your server's LAN IP.
210204

211-
8. Start the stack.
205+
9. Start the stack.
212206

213207
```bash
214208
docker compose up --build -d
215209
```
216210

217-
9. Open `https://roborock.example.com/admin` from a device on the same LAN.
211+
10. Open `https://roborock.example.com/admin` from a device on the same LAN.
218212

219-
10. Sign in and use the Cloud Import section to request an email code and import your Roborock cloud data.
213+
11. Sign in and use the Cloud Import section to request an email code and import your Roborock cloud data.
220214

221215
## External MQTT
222216

@@ -288,6 +282,7 @@ The admin UI is intentionally small:
288282
- show service health
289283
- show known vacuums
290284
- import cloud data with email-code login
285+
- pair a device and track onboarding progress
291286
- show built-in support links for the project
292287

293288
## Persistent Data

compose.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ services:
55
dockerfile: Dockerfile
66
container_name: roborock-local-server
77
restart: unless-stopped
8-
cap_add:
9-
- NET_ADMIN
108
ports:
119
- "443:443"
1210
- "8883:8883"
13-
- "8081:8081"
14-
- "51820:51820/udp"
1511
volumes:
1612
- ./config.toml:/app/config.toml:ro
1713
- ./data:/data

docs/custom_cert_management.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

docs/custom_mqtt.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

docs/installation.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Installation
2+
3+
## Requirements:
4+
5+
- Docker
6+
- Python
7+
- Two machines (one to run the server and one to do the onboarding)
8+
- A domain name that you own
9+
- A machine that can host this with the following ports exposed (INTERNALLY in YOUR network):
10+
```
11+
443
12+
8883
13+
```
14+
15+
## Docker Setup
16+
17+
1. You should clone this repository:
18+
19+
`git clone https://github.com/Python-roborock/local_roborock_server`
20+
21+
2. Change into the project folder.
22+
23+
```bash
24+
cd roborock_local_server
25+
```
26+
27+
3. Install the local project environment.
28+
29+
```bash
30+
uv sync
31+
```
32+
33+
4. Run the setup wizard.
34+
35+
```bash
36+
uv run roborock-local-server configure
37+
```
38+
39+
The wizard asks only for:
40+
41+
- your `stack_fqdn` (this is your URL for your server. It MUST start with 'api-')
42+
- embedded MQTT or your own broker
43+
- whether to use Cloudflare DNS-01 auto-renew
44+
- your admin password
45+
46+
It then writes `config.toml` for you, generates `admin.password_hash`, generates `admin.session_secret`, and if you chose Cloudflare it also writes `secrets/cloudflare_token`.
47+
48+
5. If you chose external MQTT, fill in `broker.host` in `config.toml` before starting the stack. See: [Custom MQTT](#Custom_mqtt)
49+
50+
6. If you skipped Cloudflare, put your certificate files in `data/certs/fullchain.pem` and `data/certs/privkey.pem`. See: [Custom cert](#custom_cert)
51+
52+
7. Decide on your url. it must start with 'api-'. Set the DNS record on your network to resolve your url to your server.
53+
54+
If your server is 'api-roborock.example.com', you should set the following DNS records to resolve to your server ip:
55+
'api-roborock.example.com'
56+
'mqtt-roborock.example.com'
57+
58+
7. Now you can start the container by running:
59+
`docker-compose up -d --build`
60+
61+
8.

mkdocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
site_name: Roborock Local Server
2+
3+
theme:
4+
name: material
5+
6+
nav:
7+
- Home: index.md

0 commit comments

Comments
 (0)