Add info about logs

This commit is contained in:
Alex 2022-01-13 12:34:24 +01:00
parent f8d21c8b37
commit de4bc8abc4
No known key found for this signature in database
GPG Key ID: EDABF9711E244EB1
1 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
## Tricot
# Tricot
Tricot is a reverse-proxy for exposing your services via TLS that integrates well with Consul and Nomad.
@ -13,7 +13,7 @@ Tricot does the following things:
- Load-balance incoming requests among different available backends, or redirect all requests to the best-available matching backend, depending on desired configuration
- Optionnally, compress data comming from the backend before forwarding it to the client
### Configuring Tricot
## Configuring Tricot
Tricot uses the following environment variables for its configuration (they can also be passed as command line arguments, see `--help`):
@ -29,7 +29,7 @@ Tricot uses the following environment variables for its configuration (they can
[Here is an example of how to run Tricot as a Nomad service](https://git.deuxfleurs.fr/Deuxfleurs/nixcfg/src/branch/main/app/frontend/deploy/frontend-tricot.hcl) (in this example it also integrates with [Diplonat](https://git.deuxfleurs.fr/Deuxfleurs/diplonat)).
### Adding and priorizing backends
## Adding and priorizing backends
Backends are configured by adding tags of the following form to the services in Consul:
@ -49,7 +49,7 @@ Any number of such rules can be combined freely.
[some](https://git.deuxfleurs.fr/Deuxfleurs/nixcfg/src/branch/main/app/im/deploy/im.hcl)
[examples](https://git.deuxfleurs.fr/Deuxfleurs/infrastructure/src/branch/main/app/jitsi/deploy/jitsi.hcl).
### How Tricot matches backends
## How Tricot matches backends
Tricot priorizes backend nodes in the following order:
@ -58,3 +58,12 @@ Tricot priorizes backend nodes in the following order:
3. Select rule that redirects request to the same node Tricot is running on, except `tricot-site-lb` or `tricot-global-lb` is used
4. Select rule that redirects request to a node that is running in the same site (geographical region, datacenter, whatever) than the node Tricot is running on, based on the metadata key `site` in Consul's node information, if such information is available, except if `tricot-global-lb` is used
5. Round-robin selection of backend nodes
## Knowing what Tricot is doing
Logs are the privileged place to get information about what Tricot is doing. You can set the log level by changing the `RUST_LOG` environment variable. The following log levels are avaialble:
- `RUST_LOG=tricot=warn`: Tricot will only show warning and errors, it should be quite quiet
- `RUST_LOG=tricot=info`: Tricot will dump the proxy configuration (the set of rules it uses to match backends) each time it changes, and will show a line for each incoming request (but it won't indicate which backend the request was routed to). You will also get information about certificate obtention and renewal using Let's Encrypt.
- `RUST_LOG=tricot=debug`: Tricot will show for each request the backend to which it is routed. It will also show all of its interactions with Consul
- `RUST_LOG=tricot=trace`: Tricot will show details such as the request's headers for all request at all stages of proxying.