Skip to content

Commit 1deda84

Browse files
committed
Update docs
1 parent 4160804 commit 1deda84

2 files changed

Lines changed: 139 additions & 96 deletions

File tree

‎agent/MACOS.md‎

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# macOS Setup Guide
2+
3+
On macOS, containers run inside OrbStack/Docker which has isolated networking. Additional setup is required for WireGuard traffic to reach containers.
4+
5+
## Prerequisites
6+
7+
- OrbStack or Docker Desktop
8+
- WireGuard (`brew install wireguard-tools`)
9+
- BuildKit client (`brew install buildkit`)
10+
11+
## Enable IP Forwarding
12+
13+
```bash
14+
sudo sysctl -w net.inet.ip.forwarding=1
15+
```
16+
17+
To persist across reboots:
18+
```bash
19+
echo "net.inet.ip.forwarding=1" | sudo tee -a /etc/sysctl.conf
20+
```
21+
22+
## NAT Setup for Container Traffic
23+
24+
Containers only respond to IPs on their local subnet. Traffic from other servers via WireGuard needs NAT.
25+
26+
**1. Create NAT rule file:**
27+
28+
Replace `X` with your subnet ID (check your WireGuard IP - if it's 10.100.5.1, your subnet ID is 5):
29+
30+
```bash
31+
echo 'nat on bridge101 from 10.100.0.0/16 to 10.200.X.0/24 -> (bridge101)' | sudo tee /etc/pf.anchors/wireguard-nat
32+
```
33+
34+
**2. Backup pf.conf:**
35+
36+
```bash
37+
sudo cp /etc/pf.conf /etc/pf.conf.backup
38+
```
39+
40+
**3. Add anchor to pf.conf:**
41+
42+
```bash
43+
sudo nano /etc/pf.conf
44+
```
45+
46+
Add these lines near the top (after existing `nat-anchor` lines):
47+
48+
```
49+
nat-anchor "wireguard-nat"
50+
load anchor "wireguard-nat" from "/etc/pf.anchors/wireguard-nat"
51+
```
52+
53+
**4. Load the config:**
54+
55+
```bash
56+
sudo pfctl -f /etc/pf.conf
57+
```
58+
59+
**5. Verify:**
60+
61+
```bash
62+
sudo pfctl -a wireguard-nat -s nat
63+
```
64+
65+
## BuildKit Setup
66+
67+
On macOS, BuildKit daemon (buildkitd) must run inside a Linux VM or container. The Homebrew formula only includes the client tools.
68+
69+
**Using OrbStack/Docker (recommended):**
70+
71+
```bash
72+
docker run -d --name buildkitd --privileged moby/buildkit:latest
73+
```
74+
75+
Then run the agent with the `BUILDKIT_HOST` env var. Use `sudo -E` to preserve environment variables:
76+
77+
```bash
78+
sudo BUILDKIT_HOST=docker-container://buildkitd ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
79+
```
80+
81+
Or with `-E`:
82+
83+
```bash
84+
BUILDKIT_HOST=docker-container://buildkitd sudo -E ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
85+
```
86+
87+
## Insecure Registry (HTTP)
88+
89+
If you see errors like:
90+
```
91+
Error response from daemon: Get "https://registry:5000/v2/": http: server gave HTTP response to HTTPS client
92+
```
93+
94+
Docker is trying to use HTTPS for a registry that only supports HTTP. Configure OrbStack to allow insecure registries:
95+
96+
1. Open OrbStack → Settings → Docker
97+
2. Add `registry:5000` (or your registry address) to "Insecure registries"
98+
3. Restart Docker from the OrbStack menu bar
99+
100+
Alternatively, edit `~/.orbstack/config/docker.json`:
101+
```json
102+
{
103+
"insecure-registries": ["registry:5000"]
104+
}
105+
```
106+
107+
## WireGuard Commands
108+
109+
```bash
110+
sudo wg show
111+
wg-quick down wg0 && wg-quick up wg0
112+
```
113+
114+
## Debugging Network Issues
115+
116+
Check if packets arrive on WireGuard interface:
117+
```bash
118+
sudo tcpdump -i utun5 icmp -n
119+
```
120+
121+
Check if packets reach Docker bridge:
122+
```bash
123+
sudo tcpdump -i bridge101 icmp -n
124+
```
125+
126+
Test connectivity:
127+
```bash
128+
# Ping from Mac to container
129+
ping -c 3 10.200.5.3
130+
131+
# Check IP forwarding is enabled
132+
sysctl net.inet.ip.forwarding
133+
134+
# Verify NAT rule
135+
sudo pfctl -a wireguard-nat -s nat
136+
```

‎agent/README.md‎

Lines changed: 3 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ sudo systemctl start techulus-agent
193193
| `--url` | (required) | Control plane URL |
194194
| `--token` | | Registration token (required for first run) |
195195
| `--data-dir` | `/var/lib/techulus-agent` | Data directory for agent state |
196-
| `--logs-endpoint` | | VictoriaLogs endpoint (e.g., `http://athena:9428`) |
196+
| `--logs-endpoint` | | VictoriaLogs endpoint |
197197
| `--proxy` | `false` | Run as proxy node (handles TLS and public traffic) |
198198

199199
## Troubleshooting
@@ -218,99 +218,6 @@ sudo journalctl -u techulus-agent -f
218218
podman ps -a --format "table {{.Names}}\t{{.State}}\t{{.Labels}}"
219219
```
220220

221-
## macOS Troubleshooting
221+
## macOS
222222

223-
On macOS, containers run inside OrbStack/Docker which has isolated networking. Additional setup is required for WireGuard traffic to reach containers.
224-
225-
### Enable IP Forwarding
226-
227-
```bash
228-
sudo sysctl -w net.inet.ip.forwarding=1
229-
```
230-
231-
To persist across reboots:
232-
```bash
233-
echo "net.inet.ip.forwarding=1" | sudo tee /etc/sysctl.conf
234-
```
235-
236-
### NAT Setup for Container Traffic
237-
238-
Containers only respond to IPs on their local subnet. Traffic from other servers via WireGuard needs NAT.
239-
240-
**1. Create NAT rule file:**
241-
242-
Replace `X` with your subnet ID (check your WireGuard IP - if it's 10.100.5.1, your subnet ID is 5):
243-
244-
```bash
245-
echo 'nat on bridge101 from 10.100.0.0/16 to 10.200.X.0/24 -> 10.200.X.0' | sudo tee /etc/pf.anchors/wireguard-nat
246-
```
247-
248-
**2. Backup pf.conf:**
249-
250-
```bash
251-
sudo cp /etc/pf.conf /etc/pf.conf.backup
252-
```
253-
254-
**3. Add anchor to pf.conf:**
255-
256-
```bash
257-
sudo nano /etc/pf.conf
258-
```
259-
260-
Add these lines near the top (after existing `nat-anchor` lines):
261-
262-
```
263-
nat-anchor "wireguard-nat"
264-
load anchor "wireguard-nat" from "/etc/pf.anchors/wireguard-nat"
265-
```
266-
267-
**4. Load the config:**
268-
269-
```bash
270-
sudo pfctl -f /etc/pf.conf
271-
```
272-
273-
**5. Verify:**
274-
275-
```bash
276-
sudo pfctl -a wireguard-nat -s nat
277-
```
278-
279-
### WireGuard Commands (macOS)
280-
281-
```bash
282-
sudo wg show
283-
wg-quick down wg0 && wg-quick up wg0
284-
```
285-
286-
### Insecure Registry (HTTP)
287-
288-
If you see errors like:
289-
```
290-
Error response from daemon: Get "https://athena:5000/v2/": http: server gave HTTP response to HTTPS client
291-
```
292-
293-
Docker is trying to use HTTPS for a registry that only supports HTTP. Configure OrbStack to allow insecure registries:
294-
295-
1. Open OrbStack → Settings → Docker
296-
2. Add `athena:5000` (or your registry address) to "Insecure registries"
297-
3. Restart Docker from the OrbStack menu bar
298-
299-
Alternatively, edit `~/.orbstack/config/docker.json`:
300-
```json
301-
{
302-
"insecure-registries": ["athena:5000"]
303-
}
304-
```
305-
306-
### Debugging Network Issues
307-
308-
Check if packets arrive on WireGuard interface:
309-
```bash
310-
sudo tcpdump -i utun9 icmp -n
311-
```
312-
313-
Check if packets reach Docker bridge:
314-
```bash
315-
sudo tcpdump -i bridge101 icmp -n
316-
```
223+
See [MACOS.md](./MACOS.md) for macOS-specific setup and troubleshooting.

0 commit comments

Comments
 (0)