pai/rest-server
Qixiang Cheng f38d04c2ff Fix 2018-08-08 21:54:39 +08:00
..
src Fix 2018-08-08 21:54:39 +08:00
test Merge branch 'master' into xiongyf/rest-server-retry-policy 2018-07-24 20:11:17 +08:00
.dockerignore Initial aii 2017-11-21 14:45:44 +08:00
.eslintrc.js Fix file linebreak issue in rest-server folder. 2018-03-06 23:36:01 +08:00
.gitignore Add lowdb database for credentials storage 2017-12-06 21:02:33 +08:00
.npmrc Initial aii 2017-11-21 14:45:44 +08:00
API.md REST Server: Refine document (#1005) 2018-08-01 13:40:18 +08:00
README.md REST Server: Refine document (#1005) 2018-08-01 13:40:18 +08:00
index.js Setup lint for rest server 2018-02-14 15:49:20 +08:00
package.json REST Server: fix base directory of coveralls 2018-07-09 15:10:53 +08:00

README.md

REST Server

Goal

REST Server exposes a set of interface that allows you to manage jobs.

Architecture

REST Server is a Node.js API service for PAI that deliver client requests to different upstream services, including FrameworkLauncher, Apache Hadoop YARN, WebHDFS and etcd, with some request transformation.

Dependencies

To start a REST Server service, the following services should be ready and correctly configured.

Build

Run npm install to install dependencies.

Configuration

If REST Server is deployed by pai management tool, configuration is located in restserver block of service configuration file, including:

  • server-port: Integer. The network port to access the web portal. The default value is 9186.
  • jwt-secret: A random secret token for user authorization, keep it secret to users.
  • default-pai-admin-username: The username of default user. REST Server will auto generate it after the first start of service.
  • default-pai-admin-password: The password of default user.

If REST Server is deployed manually, the following fields should be configured as environment variables:

  • LAUNCHER_WEBSERVICE_URI: URI endpoint of Framework Launcher
  • HDFS_URI: URI endpoint of HDFS
  • WEBHDFS_URI: URI endpoint of WebHDFS
  • YARN_URI: URI endpoint of Apache Hadoop YARN
  • ETCD_URI: URI endpoints of ectd, could be multiple and separated by comma(,)
  • JWT_SECRET: A random secret token for user authorization, keep it secret to users.
  • DEFAULT_PAI_ADMIN_USERNAME: The username of default user. REST Server will auto generate it after the first start of service.
  • DEFAULT_PAI_ADMIN_PASSWORD: The password of default user.

And the following field could be configured optionally:

  • LOG_LEVEL: The log level of the service, default value is debug, could be
    • error
    • warn
    • info
    • debug
    • silly
  • SERVER_PORT: The network port to access the web portal. The default value is 9186.

Deployment

The deployment of REST Server goes with the bootstrapping process of the whole PAI cluster, which is described in detail in Tutorial: Booting up the cluster.


If REST Server is need to be deployed as a standalone service, follow these steps:

  1. Go into rest-server directory
  2. Run npm start

Upgrading

REST Server is a stateless service, so it could be upgraded without any extra operation.

Service Metrics

TBD

Service Monitoring

TBD

High Availability

REST Server is a stateless service, so it could be extends for high availability without any extra operation.

Runtime Requirements

To run REST Server on system, a Node.js 6+ runtime is required, with npm installed.

API document

Read API document for the details of REST API.

FAQ

Q: What is the default username and password?

A: Default username and password is configured in

  • DEFAULT_PAI_ADMIN_USERNAME and DEFAULT_PAI_ADMIN_PASSWORD environment variables if service is deployed manually.
  • restserver.default-pai-admin-username and restserver.default-pai-admin-password field in service configuration file if service is deployed by pai management tool.

Q: Why can't I login with default username and password?

A: If there is already a /users directory in etcd, REST Server will not auto generate the default user, even it is empty and without any users. To regenerate default user, try delete the whole /users directory and restart REST Server, a new default user will be generated.