Skip to content

Commit 9a1c951

Browse files
committed
remove trin-cli move create-dashboard to trin update to clap from structopt
1 parent 2e63390 commit 9a1c951

File tree

14 files changed

+165
-341
lines changed

14 files changed

+165
-341
lines changed

Cargo.lock

Lines changed: 2 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ members = [
5757
"light-client",
5858
"rpc",
5959
"trin-beacon",
60-
"trin-cli",
6160
"trin-history",
6261
"trin-state",
6362
"trin-types",

book/src/users/monitoring.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ htop
3939
```
4040

4141
## Metrics
42+
[Metrics setup no docker](#metrics-setup-no-docker)
4243

44+
[Metrics setup with docker](#metrics-setup-with-docker)
45+
46+
## Metrics setup no docker
4347
Prometheus maintains a database of metrics (trin & system). Grafana converts metrics into graphs. Node exporter provides system information.
4448
```mermaid
4549
graph TD;
@@ -234,7 +238,7 @@ This will serve metrics over port 3000.
234238

235239
Generate a grafana dashboard. From trin root directory:
236240
```sh
237-
cargo run -p trin-cli -- create-dashboard
241+
cargo run -p trin -- create-dashboard http://localhost:3000 admin admin http://127.0.0.1:9090
238242
```
239243
This will create a new monitoring database for trin. This will
240244
be visible in the grafana GUI, or directly at a URL similar to:
@@ -279,3 +283,31 @@ ssh -N -L 3000:127.0.0.1:3000 username@mycomputer
279283
Then navigate to [http://127.0.0.1:3000](http://127.0.0.1:3000)` in a browser and login
280284
with username: admin, password: admin. Then navigate to the trin-app-metrics dashboard.
281285

286+
## Metrics setup with docker
287+
1. Install Docker.
288+
2. Run Prometheus, note that you MUST manually set the absolute path to your copy of Trin's `docs/metrics_config/`:
289+
```sh
290+
docker run -p 9090:9090 -v /**absolute/path/to/trin/docs/metrics_config**:/etc/prometheus --add-host=host.docker.internal:host-gateway prom/prometheus
291+
```
292+
3. Run Grafana:
293+
```sh
294+
docker run -p 3000:3000 --add-host=host.docker.internal:host-gateway grafana/grafana:latest
295+
```
296+
4. Start your Trin process with:
297+
```sh
298+
cargo run -p trin -- --enable-metrics-with-url 0.0.0.0:9100 --web3-http-address http://0.0.0.0:8545 --web3-transport http
299+
```
300+
- The addresses must be bound to 0.0.0.0, because 127.0.0.1 only allows internal requests to
301+
complete, and requests from docker instances are considered external.
302+
- The `--enable-metrics-with-url` parameter is the address that Trin exports metrics to, and should be equal to the port to which your Prometheus server is targeting at the bottom of `metrics_config/prometheus.yml`
303+
- The `--web-transport http` will allow Grafana to request routing table information from Trin via JSON-RPC over HTTP
304+
5. From the root of the Trin repo, run `cargo run -p trin -- create-dashboard`. If you used different ports than detailed in the above steps, or you are not using docker, then this command's defaults will not work. Run the command with the `-h` flag to see how to provide non-default addresses or credentials.
305+
6. Upon successful dashboard creation, navigate to the dashboard URL that the `create-dashboard` outputs. Use `admin`/`admin` to login.
306+
307+
## Gotchas
308+
309+
- If `create-dashboard` fails with an error, the most likely reason is that it has already been run. From within the Grafana UI, delete the "json-rpc" and "prometheus" datasources and the "trin" dashboard and re-run the command.
310+
311+
- There is a limit on concurrent connections given by the threadpool. At last
312+
doc update, that number was 2, but will surely change. If you leave
313+
connections open, then new connections will block.

docker/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,21 @@ COPY ./rpc ./rpc
2323
COPY ./src ./src
2424
COPY ./trin-beacon ./trin-beacon
2525
COPY ./trin-bridge ./trin-bridge
26-
COPY ./trin-cli ./trin-cli
27-
COPY ./trin-history ./trin-history
26+
COPY ./trin-history ./trin-history
2827
COPY ./trin-state ./trin-state
2928
COPY ./trin-types ./trin-types
3029
COPY ./trin-utils ./trin-utils
3130
COPY ./trin-validation ./trin-validation
3231
COPY ./utp-testing ./utp-testing
3332

3433
# build for release
35-
RUN cargo build -p trin -p trin-cli --release
34+
RUN cargo build -p trin --release
3635

3736
# final base
3837
FROM ubuntu:22.04
3938

4039
# copy build artifacts from build stage
4140
COPY --from=builder /trin/target/release/trin /usr/bin/
42-
COPY --from=builder /trin/target/release/trin-cli /usr/bin/
4341
COPY --from=builder /trin/target/release/purge_db /usr/bin/
4442

4543
ENV RUST_LOG=debug

docker/Dockerfile.bridge

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ COPY ./light-client ./light-client
2020
COPY ./src ./src
2121
COPY ./trin-beacon ./trin-beacon
2222
COPY ./trin-bridge ./trin-bridge
23-
COPY ./trin-cli ./trin-cli
24-
COPY ./trin-history ./trin-history
23+
COPY ./trin-history ./trin-history
2524
COPY ./trin-state ./trin-state
2625
COPY ./trin-types ./trin-types
2726
COPY ./trin-utils ./trin-utils

trin-cli/Cargo.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

trin-cli/README.md

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)