-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add env vars for proxy configurations #1120
base: next
Are you sure you want to change the base?
Changes from 13 commits
f5e701e
1f373db
b2379f1
0d5a621
0d4ea4f
ecbf0f5
ba5bace
38befc7
c4fb6d2
795b212
e4fe076
d4ff777
9732563
3697ff7
b169aff
ba17e63
816bdfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
MPS_HOST="0.0.0.0" | ||
MPS_PORT="8082" | ||
MPS_WORKERS_UPDATE_PORT="8083" | ||
MPS_TIMEOUT_SECS="100" | ||
MPS_CONNECTION_TIMEOUT_SECS="10" | ||
MPS_MAX_QUEUE_ITEMS="10" | ||
MPS_MAX_RETRIES_PER_REQUEST="1" | ||
MPS_MAX_REQ_PER_SEC="5" | ||
MPS_AVAILABLE_WORKERS_POLLING_TIME_MS="20" | ||
MPS_HEALTH_CHECK_INTERVAL_SECS="1" | ||
MPS_PROMETHEUS_HOST="127.0.0.1" | ||
MPS_PROMETHEUS_PORT="6192" | ||
RUST_LOG="info" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,48 +28,25 @@ This will spawn a worker using the hosts and ports defined in the command option | |
|
||
## Proxy | ||
|
||
First, you need to create a configuration file for the proxy with: | ||
To start the proxy service, you will need to run: | ||
|
||
```bash | ||
miden-proving-service init | ||
``` | ||
|
||
This will create the `miden-proving-service.toml` file in your current directory. This file will hold the configuration for the proxy. You can modify the configuration by changing the host and ports of the services, the maximum size of the queue, among other options. An example configuration is: | ||
|
||
```toml | ||
# Host of the proxy server | ||
host = "0.0.0.0" | ||
# Port of the proxy server | ||
port = 8082 | ||
# Timeout for a new request to be completed | ||
timeout_secs = 100 | ||
# Timeout for establishing a connection to the worker | ||
connection_timeout_secs = 10 | ||
# Maximum amount of items that a queue can handle | ||
max_queue_items = 10 | ||
# Maximum amount of retries that a request can take | ||
max_retries_per_request = 1 | ||
# Maximum amount of requests that a given IP address can make per second | ||
max_req_per_sec = 5 | ||
# Time to wait before checking the availability of workers | ||
available_workers_polling_time_ms = 20 | ||
# Interval to check the health of the workers | ||
health_check_interval_secs = 1 | ||
# Host of the metrics server | ||
prometheus_host = "127.0.0.1" | ||
# Port of the metrics server | ||
prometheus_port = 6192 | ||
miden-proving-service start-proxy [worker1] [worker2] ... [workerN] | ||
``` | ||
|
||
Then, to start the proxy service, you will need to run: | ||
For example: | ||
|
||
```bash | ||
miden-proving-service start-proxy [worker1] [worker2] ... [workerN] | ||
miden-proving-service start-proxy 0.0.0.0:8084 0.0.0.0:8085 | ||
``` | ||
|
||
This command will start the proxy using the workers passed as arguments. The workers should be in the format `host:port`. If no workers are passed, the proxy will start without any workers and will not be able to handle any requests until one is added through the `miden-proving-service add-worker` command. | ||
|
||
At the moment, when a worker added to the proxy stops working and can not connect to it for a request, the connection is marked as retriable meaning that the proxy will try reaching another worker. The number of retries is configurable via the `max_retries_per_request` value in the configuration file. | ||
You can customize the proxy service by setting environment variables. Possible customizations can be found by running `miden-proving-service start-proxy --help`. | ||
|
||
An example `.env` file is provided in the crate's root directory. To use the variables from a file, in any `Unix-like` operating systems, you can run `source <your-file>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing period at the end of the paragraph. Also, I would probably remove backticks from around "Unix-like". The last sentence could read: "To use the variables from a file in any Unix-like operating system, you can run |
||
|
||
At the moment, when a worker added to the proxy stops working and can not connect to it for a request, the connection is marked as retriable meaning that the proxy will try reaching another worker. The number of retries is configurable via the `MPS_MAX_RETRIES_PER_REQUEST` environmental variable. | ||
|
||
## Updating workers on a running proxy | ||
|
||
|
@@ -120,7 +97,7 @@ If Docker is not an option, Jaeger can also be set up directly on your machine o | |
|
||
## Metrics | ||
|
||
The proxy includes a service that exposes metrics to be consumed by [Prometheus](https://prometheus.io/docs/introduction/overview/). This service is always enabled and uses the host and port defined in the `miden-proving-service.toml` file. | ||
The proxy includes a service that exposes metrics to be consumed by [Prometheus](https://prometheus.io/docs/introduction/overview/). This service is always enabled and uses the host and port defined in the `.env` file through the `MPS_PROMETHEUS_HOST` and `MPS_PROMETHEUS_PORT` variables. | ||
|
||
The metrics architecture works by having the proxy expose metrics at an endpoint (`/metrics`) in a format Prometheus can read. Prometheus periodically scrapes this endpoint, adds timestamps to the metrics, and stores them in its time-series database. Then, we can use tools like Grafana to query Prometheus and visualize these metrics in configurable dashboards. | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this might have to be
[BREAKING]