Skip to content

Commit

Permalink
add SWAGGER doc about rest API
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Jun 22, 2018
1 parent 775fa9e commit 71c60ef
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ It’s tool for controlling processes like a supervisord but with some important
* Different strategies for processes
* Support template-based email notification
* Support HTTP notification
* REST API (see swagger.yaml)

## Installing

Expand Down
20 changes: 20 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,26 @@ http:

All flags can be set by environment variables with prefix `MONEXEC_`. For example flag `--label sample` can be set as `export MONEXEC_LABEL="sample"`

# How to enable REST API

Since `0.1.6` you can enable simple REST API by adding `rest` plugin.

Full version

```yaml
rest:
listen: "localhost:9900"
```


or minimal (default is `localhost:9900`)

```yaml
rest:
```

API documentation see in swagger.yaml file in repository

## Commands

### run
Expand Down
146 changes: 146 additions & 0 deletions swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
swagger: '2.0'
info:
description: >
API description for MonExec - light supervisor
version: 0.1.6
title: MonExec
contact:
email: [email protected]
license:
name: MIT
host: localhost:9900
basePath: /
schemes:
- http
paths:
/supervisors:
get:
summary: Get all names of all loaded executables configuration
description: ''
operationId: ListSupervisors
produces:
- application/json
responses:
'200':
description: Success
schema:
type: array
items:
type: string
/supervisors/{name}:
get:
summary: Get full config of service
description: ''
operationId: GetSupervisor
produces:
- application/json
parameters:
- in: path
required: true
type: string
name: name
description: Supervisor label
responses:
'200':
description: Success
schema:
$ref: '#/definitions/Executable'
post:
summary: Create instance of supervisor config and run it
description: ''
operationId: StartInstace
produces:
- application/json
parameters:
- in: path
required: true
type: string
name: name
description: Supervisor label
responses:
'200':
description: Success
schema:
$ref: '#/definitions/Instance'
/instances:
get:
summary: Get all names of all spawned services
description: ''
operationId: ListInstances
produces:
- application/json
responses:
'200':
description: Success
schema:
type: array
items:
type: string
/instance/{name}:
get:
summary: Get instance config and status
description: ''
operationId: GetInstance
produces:
- application/json
parameters:
- in: path
required: true
type: string
name: name
description: Instance label
responses:
'200':
description: Success
schema:
$ref: '#/definitions/Executable'
post:
summary: Stop instance by label
description: ''
operationId: StopInstace
produces:
- application/json
parameters:
- in: path
required: true
type: string
name: name
description: Instance label
responses:
'201':
description: Success
definitions:
Executable:
type: object
properties:
Name:
type: string
Command:
type: string
Args:
type: array
items:
type: string
Environment:
type: object
WorkDir:
type: string
StopTimeout:
type: string
RestartTimeout:
type: string
Restart:
type: integer
LogFiles:
type: string
Instance:
type: object
properties:
running:
type: boolean
config:
$ref: '#/definitions/Executable'


externalDocs:
url: 'https://github.com/reddec/monexec'

0 comments on commit 71c60ef

Please sign in to comment.