|
|
@@ -13,70 +13,6 @@ const logger = loggerFactory('growi:routes:apiv3:healthcheck');
|
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
-/**
|
|
|
- * @swagger
|
|
|
- *
|
|
|
- * components:
|
|
|
- * schemas:
|
|
|
- * HealthcheckInfo:
|
|
|
- * description: Information of middlewares
|
|
|
- * type: object
|
|
|
- * properties:
|
|
|
- * mongo:
|
|
|
- * type: string
|
|
|
- * description: 'OK'
|
|
|
- * example: 'OK'
|
|
|
- * searchInfo:
|
|
|
- * type: object
|
|
|
- * properties:
|
|
|
- * cluster_name:
|
|
|
- * type: string
|
|
|
- * example: elasticsearch
|
|
|
- * status:
|
|
|
- * type: string
|
|
|
- * enum: [green, yellow, red]
|
|
|
- * example: yellow
|
|
|
- * timed_out:
|
|
|
- * type: boolean
|
|
|
- * example: false
|
|
|
- * number_of_nodes:
|
|
|
- * type: integer
|
|
|
- * example: 1
|
|
|
- * number_of_data_nodes:
|
|
|
- * type: integer
|
|
|
- * example: 1
|
|
|
- * active_primary_shards:
|
|
|
- * type: integer
|
|
|
- * example: 2
|
|
|
- * active_shards:
|
|
|
- * type: integer
|
|
|
- * example: 2
|
|
|
- * relocating_shards:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * initializing_shards:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * unassigned_shards:
|
|
|
- * type: integer
|
|
|
- * example: 1
|
|
|
- * delayed_unassigned_shards:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * number_of_pending_tasks:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * number_of_in_flight_fetch:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * task_max_waiting_in_queue_millis:
|
|
|
- * type: integer
|
|
|
- * example: 0
|
|
|
- * active_shards_percent_as_number:
|
|
|
- * type: number
|
|
|
- * format: float
|
|
|
- * example: 66.66666666666666
|
|
|
- */
|
|
|
/** @param {import('~/server/crowi').default} crowi Crowi instance */
|
|
|
module.exports = (crowi) => {
|
|
|
|
|
|
@@ -104,68 +40,6 @@ module.exports = (crowi) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @swagger
|
|
|
- *
|
|
|
- * /healthcheck:
|
|
|
- * get:
|
|
|
- * tags: [Healthcheck]
|
|
|
- * security: []
|
|
|
- * operationId: getHealthcheck
|
|
|
- * summary: /healthcheck
|
|
|
- * description: Check whether the server is healthy or not
|
|
|
- * parameters:
|
|
|
- * - name: checkServices
|
|
|
- * in: query
|
|
|
- * description: The list of services to check health
|
|
|
- * schema:
|
|
|
- * type: array
|
|
|
- * items:
|
|
|
- * type: string
|
|
|
- * enum:
|
|
|
- * - mongo
|
|
|
- * - search
|
|
|
- * - name: strictly
|
|
|
- * in: query
|
|
|
- * description: Check services and responds 503 if either of these is unhealthy
|
|
|
- * schema:
|
|
|
- * type: boolean
|
|
|
- * responses:
|
|
|
- * 200:
|
|
|
- * description: Healthy
|
|
|
- * content:
|
|
|
- * application/json:
|
|
|
- * schema:
|
|
|
- * oneOf:
|
|
|
- * - type: object
|
|
|
- * description: "Don't select checkServices"
|
|
|
- * properties:
|
|
|
- * status:
|
|
|
- * type: string
|
|
|
- * - type: object
|
|
|
- * description: "Select checkServices"
|
|
|
- * properties:
|
|
|
- * info:
|
|
|
- * $ref: '#/components/schemas/HealthcheckInfo'
|
|
|
- * 503:
|
|
|
- * description: "errors occurs when using checkServicesStrictly"
|
|
|
- * content:
|
|
|
- * application/json:
|
|
|
- * schema:
|
|
|
- * properties:
|
|
|
- * errors:
|
|
|
- * type: array
|
|
|
- * description: Errors
|
|
|
- * items:
|
|
|
- * type: object
|
|
|
- * properties:
|
|
|
- * message:
|
|
|
- * type: string
|
|
|
- * code:
|
|
|
- * type: string
|
|
|
- * info:
|
|
|
- * $ref: '#/components/schemas/HealthcheckInfo'
|
|
|
- */
|
|
|
router.get('/', nocache(), async(req, res: ApiV3Response) => {
|
|
|
let checkServices = (() => {
|
|
|
if (req.query.checkServices == null) return [];
|