docs: simpler hackin' example
This commit is contained in:
parent
48abf9ed05
commit
98536f1359
31
README.md
31
README.md
@ -52,37 +52,40 @@ Create this Caddyfile in the root of the project repository.
|
|||||||
http_port 6565
|
http_port 6565
|
||||||
}
|
}
|
||||||
|
|
||||||
http://foo.localhost,
|
http://foo.localhost {
|
||||||
http://bar.localhost {
|
|
||||||
reverse_proxy {
|
reverse_proxy {
|
||||||
dynamic incus
|
dynamic incus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run commands based on this example.
|
Then create a new instance and assign the relevant config.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
incus launch images:alpine/3.20 foo
|
incus launch images:alpine/3.20 foo
|
||||||
incus config set foo user.caddyserver.http.enable=true
|
incus config set foo user.caddyserver.http.enable=true
|
||||||
incus config set foo user.caddyserver.http.matchers.host=foo.localhost
|
incus config set foo user.caddyserver.http.matchers.host=foo.localhost
|
||||||
incus config set foo user.caddyserver.http.upstream.port=80
|
incus config set foo user.caddyserver.http.upstream.port=80
|
||||||
|
```
|
||||||
|
|
||||||
incus launch images:alpine/3.20 bar
|
Serve something from your instance.
|
||||||
incus config set bar user.caddyserver.http.enable=true
|
|
||||||
incus config set bar user.caddyserver.http.matchers.host=bar.localhost
|
|
||||||
incus config set bar user.caddyserver.http.upstream.port=80
|
|
||||||
|
|
||||||
# wire up a simple web server on your 2 instances
|
```
|
||||||
# $ incus shell foo / bar
|
incus shell foo
|
||||||
# $ apk add python3
|
apk add python3
|
||||||
# $ python3 -m http.server 80
|
python3 -m http.server 80
|
||||||
|
```
|
||||||
|
|
||||||
|
Run Caddy with the plugin baked in.
|
||||||
|
|
||||||
|
```
|
||||||
xcaddy run
|
xcaddy run
|
||||||
|
```
|
||||||
|
|
||||||
# fire a request via caddy to your instances
|
And finally, route a request to the instance via Caddy.
|
||||||
# curl -X GET http://foo.localhost:6565
|
|
||||||
# curl -X GET http://bar.localhost:6565
|
```
|
||||||
|
curl -X GET http://foo.localhost:6565
|
||||||
```
|
```
|
||||||
|
|
||||||
🧨
|
🧨
|
||||||
|
Loading…
x
Reference in New Issue
Block a user