Update readme file. Refine the code for Grafana.

This commit is contained in:
Hao Wu 2018-02-26 14:47:02 +08:00
Родитель 10269c440e
Коммит 99236b7072
4 изменённых файлов: 41 добавлений и 32 удалений

1
pylon/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
.env*

Просмотреть файл

@ -2,62 +2,66 @@
Pylon is a service that enables users to access PAI functionalities through a single integrated entry point. This service is necessary particularly in a common situation: the cluster is shielded behind a gateway in which only a few jump machines are exposed. In this situation, none of the system services can be accessed directly because only the jump machines have public IPs. The only way to use the system is to setup Pylon on these jump machines as a proxy between the internal services and the outside world.
## PAI Web Portal
PAI's webportal can be accessed via Pylon:
```
http://<pylon_server>
```
## Built-In Redirected APIs
APIs of various system components can also be accessed via Pylon. Usage:
```
http://<pylon_server>/<service>/api/...
http://<pylon_server>/<service>/api/<version>/...
```
Available services:
- `rest-server`: PAI's REST server.
- `kubernetes`: Kubernetes API server.
- `prometheus`: Prometheus API server.
- `webhdfs`: Web HDFS API server.
- PAI's REST server: `http://<pylon_server>/rest-server/api/v1/...`
- Kubernetes API server: `http://<pylon_server>/kubernetes/api/v1/...`
- WebHDFS API server: `http://<pylon_server>/webhdfs/api/v1/...`
- Prometheus API server: `http://<pylon_server>/prometheus/api/v1/...`
For example:
- Rest-server api: http://10.0.3.9/restserver/api/v1/jobs
- Kubernetes api: http://10.0.3.9/kubernetes/api/v1/nodes
- Prometheus api: http://10.0.3.9/prometheus/api/v1/query?query=up
- Webhdfs api: http://10.0.3.9/webhdfs/api/v1/?op=LISTSTATUS
- Rest-server API: http://10.0.3.9/rest-server/api/v1/jobs
- Kubernetes API: http://10.0.3.9/kubernetes/api/v1/nodes
- WebHDFS API: http://10.0.3.9/webhdfs/api/v1/?op=LISTSTATUS
- Prometheus API: http://10.0.3.9/prometheus/api/v1/query?query=up
## General-Purpose Reverse Proxy
## Web Portals
Pylon also has a general-purpose reverse proxy:
The following web portals can be accessed via Pylon:
```
http://<pylon_server>/r/http/<api_server_ip>/<api_server_port>...
```
- K8s dashboard: `http://<pylon_server>/kubernetes/dashboard/`
- WebHDFS dashboard: `http://<pylon_server>/webhdfs/dashboard/`
- Grafana: `http://<pylon_server>/grafana/`
- PAI web portal: `http://<pylon_server>/`
For example:
## Developer's Guide
- Rest-server api: http://10.0.3.9/r/http/10.0.3.9/9186/api/v1/jobs
- Kubernetes api: http://10.0.3.9/r/http/10.0.3.9/8080/api/v1/nodes
- Prometheus api: http://10.0.3.9/r/http/10.0.1.9/9090/api/v1/query?query=up
- Webhdfs api: http://10.0.3.9/r/http/10.0.3.9/50070/webhdfs/v1/?op=LISTSTATUS
### Local Debugging
Steps:
- (In Windows command line) Run the following .bat file:
```
set REST_SERVER_URI=...
set K8S_API_SERVER_URI=...
set WEBHDFS_URI=...
set PROMETHEUS_URI=...
set K8S_DASHBOARD_URI=...
set GRAFANA_URI=...
set WEBPORTAL_URI=...
```
- Run: `python render.py`
- Copy the generated `nginx.conf` to the nginx configuration folder.
## Deployment
### Deploy to a PAI Cluster
The [readme](../service-deployment/README.md) in service deployment introduces the overall installation process.
The following parameter in the [clusterconfig.yaml](../service-deployment/clusterconfig-example.yaml) are of interest:
The following parameters in the [clusterconfig.yaml](../service-deployment/clusterconfig-example.yaml) should be correctly configured:
- `rest_server_uri`: String. The root url of the REST server.
- `k8s_api_server_uri`: String. The root url of Kubernetes's API server.
- `prometheus_uri`: String. The root url of Prometheus's API server.
- `webhdfs_uri`: String. The root url of WebHDFS's API server.
- `prometheus_uri`: String. The root url of Prometheus's API server.
- `k8s_dashboard_uri`: String. The root url of the Kubernetes dashboard.
- `grafana_uri`: String. The root url of Grafana.
- `webportal_uri`: String. The root url of the web portal.
- `port`: Integer. The port number to access the Pylon service.

Просмотреть файл

@ -120,6 +120,7 @@ http {
}
location ~ ^/grafana(.*)$$ {
proxy_pass {{GRAFANA_URI}}$1$is_args$args;
sub_filter_types *;
sub_filter_once off;
sub_filter
'<base href="/" />'
@ -127,6 +128,9 @@ http {
sub_filter
'{{PROMETHEUS_URI}}'
'$scheme://$http_host/prometheus';
sub_filter
'{{GRAFANA_URI}}'
'$scheme://$http_host/grafana';
}
# PAI web portal

Просмотреть файл

@ -642,7 +642,7 @@
"decimals": 0,
"link": true,
"linkTooltip": "Click to view usage of each GPU",
"linkUrl": "/dashboard/script/gpu.js?orgId=1&host=$__cell_2&rows=$__cell_4",
"linkUrl": "{{ clusterinfo['grafanainfo']['grafana_url'] }}:{{ clusterinfo['grafanainfo']['grafana_port'] }}/dashboard/script/gpu.js?orgId=1&host=$__cell_2&rows=$__cell_4",
"pattern": "instance",
"preserveFormat": false,
"sanitize": false,