From a0eaf9ec3aae62a2bd9cfc7ea45fc2fde4dff428 Mon Sep 17 00:00:00 2001 From: Shizun Ge Date: Thu, 28 Oct 2021 02:11:13 -0700 Subject: [PATCH] reword and format. bind ports to only localhost --- examples/README.md | 18 +++++++++--------- examples/docker-compose.yml | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/README.md b/examples/README.md index 6a98b8d..0850dd3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,23 +2,23 @@ ## docker compose -This is an example how to setup endlessh-go, Prometheus, and Grafana using [docker compose](https://docs.docker.com/compose/). The reference of the compose file can be find [here](https://docs.docker.com/compose/compose-file/). +This is an example how to setup endlessh-go, Prometheus, and Grafana using [docker compose](https://docs.docker.com/compose/). The reference of the compose file can be found [here](https://docs.docker.com/compose/compose-file/). -You also need `prometheus.yml` as a Prometheus configuration. [Here](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) is more about Prometheus configuration. +*prometheus.yml* is used as a [Prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/). -Although Grafana data source can be setup manually, to ease the setup, we provision a data source `grafana-datasource.yml` for Grafana. +*grafana-datasource.yml* is used to provision a data source for Grafana to ease the setup, though Grafana data source can also be setup manually. -To start the stack, in the `examples` folder, run: +To start the stack, in the *examples* folder, run: ``` sudo docker-compose up -d ``` -This example exposes the following ports. +This example exposes the following ports. Except the SSH port, you should not expose other ports to public without protections (not included in this example) in production. -* **2222**: The SSH port. You may test endlessh-go by run `ssh -p 2222 localhost`. Your SSH client should hang. You can view the log of endlessh-go by run `sudo docker logs endlessh`. -* **2112**: The Prometheus metrics exported by endlessh-go. You can open the your web browser and go to [http://localhost:2112/metrics](http://localhost:2112/metrics) to view the metrics. +* **2222**: The SSH port. You may test endlessh-go by running `ssh -p 2222 localhost`. Your SSH client should hang. View the log of endlessh-go by running `sudo docker logs endlessh`. +* **2112**: The Prometheus metrics exported by endlessh-go. Go to [http://localhost:2112/metrics](http://localhost:2112/metrics) in your web browser to view the metrics. * **9090**: Prometheus web interface. Go to [http://localhost:9090](http://localhost:9090) in your web browser for Prometheus. You can check whether the target of endlessh-go is up (Click Status, then Targets). -* **3000**: Grafana. Go to [http://localhost:3000](http://localhost:3000) for Grafana. Use username `examples` and password `examples` to login. +* **3000**: Grafana. Go to [http://localhost:3000](http://localhost:3000) in your web browser for Grafana. Use username *examples* and password *examples* to login. -In this example, we do not [provision a dashboard](https://grafana.com/tutorials/provision-dashboards-and-data-sources/) for Grafana. You need to manually load the endlessh-go dashboard, by either importing it from the Grafana.com using ID [15156](https://grafana.com/grafana/dashboards/15156), or pasting the dashboard JSON text to the text area. See the [Grafana documentation](https://grafana.com/docs/grafana/latest/dashboards/export-import/). Then select *Prometheus* as the data source. +In this example, we do not provision a dashboard for Grafana. You need to manually load the endlessh-go dashboard, by either importing it from the Grafana.com using ID [15156](https://grafana.com/grafana/dashboards/15156), or pasting the dashboard JSON text to the text area. See the [Grafana documentation](https://grafana.com/docs/grafana/latest/dashboards/export-import/) about import. Then select *Prometheus* as the data source. diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 5ce80cb..3d0185a 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -16,7 +16,7 @@ services: # SSH port - 2222:2222 # Prometheus metrics port - - 2112:2112 + - 127.0.0.1:2112:2112 prometheus: image: prom/prometheus:latest @@ -32,7 +32,7 @@ services: networks: - example_network ports: - - 9090:9090 + - 127.0.0.1:9090:9090 volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml - prometheus:/prometheus @@ -44,7 +44,7 @@ services: networks: - example_network ports: - - 3000:3000 + - 127.0.0.1:3000:3000 environment: - GF_SECURITY_ADMIN_USER=examples - GF_SECURITY_ADMIN_PASSWORD=examples @@ -57,4 +57,4 @@ networks: volumes: prometheus: - grafana_var: \ No newline at end of file + grafana_var: