Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

elektra-web HTTP API #912

Merged
merged 26 commits into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1791d2a
create initial version of the elektra web proposal
omnidan Aug 31, 2016
4a86b16
temporarily link to images from fork repo
omnidan Aug 31, 2016
a85a0be
update webui API
omnidan Sep 1, 2016
72e8f4c
point links to the official repo
omnidan Sep 1, 2016
1e4e3ca
use PUT, standardize /instances and /clusters API
omnidan Sep 5, 2016
5fc13ee
add DELETE API
omnidan Sep 5, 2016
4767fdf
similar to -> same as
omnidan Sep 5, 2016
d4dce2a
add info about response codes
omnidan Sep 5, 2016
a7c8375
re-write API in apiblueprint syntax
omnidan Sep 16, 2016
a6dc717
small text fixes, PUT /kdb instead of POST
omnidan Sep 16, 2016
f975a45
use apiblueprint attributes and data structures
omnidan Sep 16, 2016
8c0ef28
remove overriding attributes in example
omnidan Sep 16, 2016
0954388
add `/clusters` endpoint
omnidan Sep 22, 2016
cc83975
split and move api blueprints
omnidan Sep 25, 2016
a6c183a
return ls/value/meta when accessing kdb paths via GET
omnidan Sep 25, 2016
ba4ee87
document all HTTP status codes/responses
omnidan Sep 25, 2016
5f5acaa
elektrad.apib: add APIKEY_MISSING responses
omnidan Sep 25, 2016
7bc8a82
use http status code 201 for POST responses
omnidan Sep 25, 2016
d4b4b87
fix i18n value
omnidan Sep 25, 2016
b053755
docuemnt de/assigning instances to clusters
omnidan Oct 3, 2016
c72956c
remove obsolete descriptions
omnidan Oct 5, 2016
0203fee
standardize /version API
omnidan Oct 5, 2016
e1319be
return id of deleted objects
omnidan Oct 8, 2016
b12eebb
specify behaviour of key get/set/delete
omnidan Nov 16, 2016
1dfdd8e
add string type to i18n fields
omnidan Dec 26, 2016
91b01aa
describe `host` attribute
omnidan Dec 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions doc/webui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# elektra web

_a web user interface (Web UI) to remotely manage multiple elektra instances_


## Overview

Elektra web consists of multiple components:

* (multiple) servers running an elektra daemon (`elektrad`)
* a single cluster management server to communicate with the elektra daemons (`clusterd`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its better to remove the architecture parts from here and put them into an extra document as discussed. This document should only be about the HTTP API.

Copy link
Contributor

@Namoshek Namoshek Sep 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, because he references the architecture within his API description, so it should be known what he is talking about. The component description in this document isn't really extensive, so I don't see a problem at all. He could still write a lot more about it in another document, that is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it would make sense to have a separate document that goes into details of the architecture. Here I'm just giving a small overview to make it easier to understand the API.

* a client (web browser) that accesses the Web UI on the cluster management server

![https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/network_structure.png](https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/network_structure.png)


## GUI

The Web UI allows the user to add new instances to the network, as well as
combine multiple instances into a cluster. If the configuration of a cluster is
edited, the changes are pushed to all instances in the cluster. Furthermore,
single instances can be configured independently.

The configuration view of elektra web is similar to the tree view of the
[qt-gui](https://github.com/ElektraInitiative/libelektra/tree/master/src/tools/qt-gui).

![https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/ui_structure.png](https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/ui_structure.png)


## API

![https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/daemon_structure.png](https://cdn.rawgit.com/ElektraInitiative/libelektra/http-api-proposal/doc/webui/daemon_structure.png)

To access single instances, each elektra daemon (`elektrad`) provides a RESTful
HTTP API:

* **GET /version** - get `elektrad` version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which format? I would only return Elektra's and HTTP API's version, and not invent one for the tool.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He didn't specify what the version is used for, so I didn't comment it so far. But you are right, version management could get easily a huge task that isn't really in scope of his work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make all responses in JSON by default. Later, we can allow adding a suffix, e.g. .xml to get XML output. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use something like ?format=<pluginname>. With a suffix you never know if the key is named this way or if its a request to a different syntax.

* **GET /kdb/:path** - get `path` configuration (similar to `kdb get path`)
* **POST /kdb/:path** - edit `path` configuration (similar to `kdb set path`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is similar, what are the differences, can you give examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, it actually just calls kdb get and kdb set, so it's exactly the same. I changed the text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but we should discuss (and describe) how it should be, not like an implementation currently does.


The cluster management server (`clusterd`) also provides a RESTful HTTP API.
Single instances can be configured as follows:

* **GET /instances** - get a list of all instances
* **POST /instances** - create a new instance
* **GET /instances/:id** - get information about a single instance
* **POST /instances/:id** - edit a single instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For updating/patching you should use PUT or PATCH.
You will also need a method for deleting instances, I guess. Use DELETE for this task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both PUT or PATCH make sense, but we cannot use json merge patch because in Elektra null and absent is something different.

With put we might not need DELETE, if everything missing in PUT is deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to PUT and added DELETE. I'll still keep POST for the /kdb/:path commands, because the same method will be used for creating and editing keys (could additionally add PUT which doesn't allow setting keys that don't exist, not sure if there's a use case for that, though)

* **GET /instances/:id/kdb** - get full configuration of an instance
* **GET /instances/:id/kdb/:path** - get `path` configuration of an instance (similar to `kdb get path`)
* **POST /instances/:id/kdb/:path** - edit `path` configuration of an instance (similar to `kdb set path`)
* **GET /instances/:id/version** - get `elektrad` version of an instance

It is also possible to create and manage groups of multiple elektra instances (clusters):

* **GET /version** - get `clusterd` version
* **GET /clusters** - get a list of all clusters
* **POST /clusters** - create a new cluster
* **GET /clusters/:id** - get information about a single cluster
* **POST /clusters/:id** - edit a single cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for the instance interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we generalize the API such that we do not need different API descriptions for instances and clusters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I removed the redundant API and added a note.

* **GET /clusters/:id/kdb** - get full configuration of a cluster
* **GET /clusters/:id/kdb/:path** - get `path` configuration of a cluster (similar to `kdb get path`)
* **POST /clusters/:id/kdb/:path** - edit `path` configuration of a cluster (similar to `kdb set path`)
* **GET /clusters/:id/version** - get list of `elektrad` versions of all instances in the cluster

Cluster configuration is stored on the cluster management server and persisted
to all instances.
Binary file added doc/webui/daemon_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/webui/network_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/webui/ui_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.