You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a new user that is passed in the requests entity. The id of the user
88
+
will be returned.
89
+
operationId: addUser
90
+
parameters:
91
+
- in: body
92
+
name: DelphiUser
93
+
description: The user to add
94
+
required: true
95
+
schema:
96
+
type: object
97
+
required:
98
+
- userName
99
+
- secret
100
+
- userType
101
+
properties:
102
+
userName:
103
+
type: string
104
+
example: MyUser
105
+
secret:
106
+
type: string
107
+
example: 123Pass
108
+
userType:
109
+
type: string
110
+
enum:
111
+
- Admin
112
+
- User
113
+
- Component
114
+
responses:
115
+
'200':
116
+
description: OK, user has been added, id is returned
117
+
schema:
118
+
type: integer
119
+
format: int64
120
+
example: 42
121
+
'400':
122
+
description: Bad request, name already exists
27
123
/instances/register:
28
124
post:
29
125
tags:
@@ -374,12 +470,15 @@ paths:
374
470
description: 'Bad request, your label exceeded the character limit'
375
471
'404':
376
472
description: 'Not found, the id you specified could not be found'
377
-
/instances/{Id}/logs:
473
+
'/instances/{Id}/logs':
378
474
get:
379
475
tags:
380
476
- Basic Operations
381
477
summary: Retrieve the logging output of the specified instance
382
-
description: This command retrieves the docker container logging output for the specified instance, if the instance is in fact running inside a docker container.
478
+
description: >-
479
+
This command retrieves the docker container logging output for the
480
+
specified instance, if the instance is in fact running inside a docker
481
+
container.
383
482
operationId: retreiveLogs
384
483
parameters:
385
484
- name: Id
@@ -395,22 +494,28 @@ paths:
395
494
type: boolean
396
495
responses:
397
496
'200':
398
-
description: Success, log string is being returned
497
+
description: 'Success, log string is being returned'
399
498
schema:
400
499
type: string
401
-
example: "I am logging output .."
500
+
example: I am logging output ..
402
501
'400':
403
502
description: Selected instance not running inside docker container
404
503
'404':
405
504
description: Id not found on the server
406
505
'500':
407
506
description: Internal Server Error
408
-
/instances/{Id}/attach:
507
+
'/instances/{Id}/attach':
409
508
get:
410
509
tags:
411
510
- Basic Operations
412
511
summary: Stream logging output from instance
413
-
description: 'This command streams the docker container logging output for the specified instance. NOTE: This is a websocket endpoint, so only valid websocket requests will be processed. Swagger does not provide sufficient support for websockets, so this documentation might be confusing as it defines a HTTP method, etc. The names of parameters and response-codes are valid though.'
512
+
description: >-
513
+
This command streams the docker container logging output for the
514
+
specified instance. NOTE: This is a websocket endpoint, so only valid
515
+
websocket requests will be processed. Swagger does not provide
516
+
sufficient support for websockets, so this documentation might be
517
+
confusing as it defines a HTTP method, etc. The names of parameters and
518
+
response-codes are valid though.
414
519
operationId: streamLogs
415
520
parameters:
416
521
- name: Id
@@ -426,7 +531,7 @@ paths:
426
531
type: boolean
427
532
responses:
428
533
'200':
429
-
description: Success, logs are being streamed via websocket connection.
534
+
description: 'Success, logs are being streamed via websocket connection.'
430
535
'400':
431
536
description: Selected instance not running inside docker container
432
537
'404':
@@ -747,13 +852,12 @@ paths:
747
852
description: One of the ids was not found on the server
748
853
'500':
749
854
description: Internal server error
750
-
/instances/{Id}/command:
855
+
'/instances/{Id}/command':
751
856
post:
752
857
tags:
753
858
- Docker Operations
754
859
summary: Runs a command into a docker container
755
-
description: >-
756
-
This command runs a specified command inside a docker container.
860
+
description: This command runs a specified command inside a docker container.
757
861
operationId: command
758
862
parameters:
759
863
- in: path
@@ -773,23 +877,21 @@ paths:
773
877
properties:
774
878
Command:
775
879
type: string
776
-
example: "rm -rf *"
880
+
example: rm -rf *
777
881
Privileged:
778
882
type: boolean
779
883
User:
780
884
type: string
781
885
example: root
782
886
responses:
783
887
'200':
784
-
description: 'OK'
888
+
description: OK
785
889
'400':
786
-
description: >-
787
-
Cannot run command, ID is no docker container.
890
+
description: 'Cannot run command, ID is no docker container.'
788
891
'404':
789
-
description: Cannot run command, ID not found.
892
+
description: 'Cannot run command, ID not found.'
790
893
'500':
791
-
description: Internal server error, unknown operation result DESCRIPTION
792
-
894
+
description: 'Internal server error, unknown operation result DESCRIPTION'
Copy file name to clipboardExpand all lines: README.md
+34-10Lines changed: 34 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ this repository is purely experimental!
11
11
12
12
## What is the registry component?
13
13
The Delphi registry is a server that provides access to all information and operations needed to set up, run and manage the Delphi system. By default, the REST interface is exposed at *0.0.0.0:8087*, and contains endpoints for:
14
+
14
15
* Retrieving a list of all instances of a certain type (Crawler, WebApi, WebApp, ElasticSearch)
15
16
* Retrieving the whole network graph (all instances and links between instances)
16
17
* Deploying new instances of a certain type to a docker host
@@ -37,16 +38,32 @@ For Linux users, checkout Delphi Registry repository and execute the command
37
38
```
38
39
sudo bash ./Delphi_install.sh
39
40
```
40
-
inside the registry's root directory. This installation script will create the required repositories, build the docker images, and register them directly at the local docker registry.
41
+
inside the ```/Setup```directory. This installation script will create the required repositories, build the docker images, and register them directly at the local docker registry.
41
42
The registry requires an initial instance of ElasticSearch to be running.
42
43
44
+
To allow access to Delphi components deployed via Docker, the registry supports the reverse-proxy [Traefik](https://traefik.io/). While it is running, it will automatically detected containers deployed by the registry, and provide access to them using the host specified in each instances' ```Host``` attribute.
45
+
Windows users can install Traefik (using Docker) based on [this tutorial](https://docs.traefik.io/#the-traefik-quickstart-using-docker). For Linux users, Traefik will be installed and started by the installation script mentioned above.
46
+
47
+
**Note:** Traefik must be running inside the same Docker network as the containers it is associated with. By default the name for this network is expected to be ```delphi```. Windows users have to manually create it using ```docker network create delphi``` before starting Traefik. If you want to change this network name, please follow these steps:
48
+
49
+
1. Go to ```docker-compose.yml``` file (for Windows: Create during tutorial; for Linux found in ```/Setup```)
50
+
51
+
2. Change the item *services->traefik->networks* to your new network name
52
+
53
+
3. Change the item *networks->delphi->external:true* to *networks->your-network-name->external:true*. Save and close the file
54
+
55
+
4. Change the ````traefikDockerNetwork`` setting in the configuration file to your new network name (see section below for details)
56
+
43
57
## Adapt the configuration file
44
58
Before you can start the application, you have to make sure your configuration file contains valid data. The file can be found at *src/main/scala/de/upb/cs/swt/delphi/instanceregistry/Configuration.scala*, and most of its attributes are string or integer values. The following table describes the attributes in more detail.
45
59
46
60
|Attribute | Type | Default Value |Explanation |
47
61
| :---: | :---: | :---: | :--- |
48
62
|```bindHost```|```String```|```"0.0.0.0"```| Host address that the registry server should be bound to |
49
63
|```bindPort```|```Int```|```8087```| Port that the registry server should be reachable at |
64
+
|```traefikBaseHost```|```String```|```"delphi.de"```| The host part of the URL that traefik is configured to append to instance URLs. |
65
+
|```traefikDockerNetwork```|```String```|```"delphi"```| The Docker network Traefik is configured to use. |
66
+
|```traefikUri```|```String```|```"http://172.17.0.1:80"```| The URI that the Traefik reverse-proxy is hosted at.|
50
67
|```defaultCrawlerPort```|```Int```|```8882```| Port that Delphi Crawlers are reachable at. This may only be adapted if you manually changed the default port of crawlers before registering the respective image. |
51
68
|```defaultWebApiPort```|```Int```|```8080```| Port that Delphi WebAPIs are reachable at. This may only be adapted if you manually changed the default port of WebAPIs before registering the respective image. |
52
69
|```defaultWebAppPort```|```Int```|```8085```| Port that Delphi WebApps are reachable at. This may only be adapted if you manually changed the default port of WebApps before registering the respective image. |
@@ -58,14 +75,21 @@ Before you can start the application, you have to make sure your configuration f
58
75
|```uriInLocalNetwork```|```String```|```"http://172.17.0.1:8087"```| URI that the registry is reachable at for all docker containers. In most of the use-cases this is going to be the gateway of the default docker bridge.<br>**Note:** For OSX you have to set this value to the DNS name of the docker host, which is ```http://host.docker.internal:8087``` (If the registry is running on the host).|
59
76
|```maxLabelLength```|```Int```|```50```| Maximum number of characters for instance labels. Longer labels will be rejected.|
60
77
|```dockerOperationTimeout```|```Timeout```|```Timeout(20 seconds)```| Default timeout for docker operations. If any of the async Docker operations (deploy, stop, pause, ..) takes longer than this, it will be aborted.|
61
-
|```defaultDockerUri```|```String```|```http://localhost:9095```| Default uri to connect to docker. It will be used if the environment variable ```DELPHI_DOCKER_HOST``` is not specified.|
78
+
|```dockerUri```|```String```|```http://localhost:9095```| Default uri to connect to docker. It will be used if the environment variable ```DELPHI_DOCKER_HOST``` is not specified.|
62
79
|```jwtSecretKey```|```String```|```changeme```| Secret key to use for JWT signature (HS256). This setting can be overridden by specifying the ```JWT_SECRET``` environment variable.|
63
-
|```useInMemoryDB```|```Boolean```|```true```| If set to true, all instance data will be kept in memory instead of using a MySQL database.|
64
-
|```databaseHost```|```String```|```"jdbc:mysql://localhost/"```| Host that the MySQL database is reachable at (only necessary if *useInMemoryDB* is false).|
65
-
|```databaseName```|```String```|```""```| Name of the MySQL database to use (only necessary if *useInMemoryDB* is false).|
66
-
|```databaseDriver```|```String```|```"com.mysql.jdbc.Driver"```| Driver to use for the MySQL connection (only necessary if *useInMemoryDB* is false).|
67
-
|```databaseUsername```|```String```|```""```| Username to use for the MySQL connection (only necessary if *useInMemoryDB* is false).|
68
-
|```databasePassword```|```String```|```""```| Password to use for the MySQL connection (only necessary if *useInMemoryDB* is false).|
80
+
|```useInMemoryInstanceDB```|```Boolean```|```true```| If set to true, all instance data will be kept in memory instead of using a MySQL database.|
81
+
|```instanceDatabaseHost```|```String```|```"jdbc:mysql://localhost/"```| Host that the MySQL instance database is reachable at (only necessary if *useInMemoryInstanceDB* is false).|
82
+
|```instanceDatabaseName```|```String```|```""```| Name of the MySQL instance database to use (only necessary if *useInMemoryInstanceDB* is false).|
83
+
|```instanceDatabaseDriver```|```String```|```"com.mysql.jdbc.Driver"```| Driver to use for the MySQL connection (only necessary if *useInMemoryInstanceDB* is false).|
84
+
|```instanceDatabaseUsername```|```String```|```""```| Username to use for the MySQL instance DB connection (only necessary if *useInMemoryInstanceDB* is false).|
85
+
|```instanceDatabasePassword```|```String```|```""```| Password to use for the MySQL instance DB connection (only necessary if *useInMemoryInstanceDB* is false).|
86
+
|```useInMemoryAuthDB```|```Boolean```|```true```| If set to true, all user data will be kept in memory instead of using a MySQL database.|
87
+
|```authDatabaseHost```|```String```|```"jdbc:mysql://localhost/"```| Host that the MySQL users database is reachable at (only necessary if *useInMemoryAuthDB* is false).|
88
+
|```authDatabaseName```|```String```|```""```| Name of the MySQL user database to use (only necessary if *useInMemoryAuthDB* is false).|
89
+
|```authDatabaseDriver```|```String```|```"com.mysql.jdbc.Driver"```| Driver to use for the MySQL users DB connection (only necessary if *useInMemoryAuthDB* is false).|
90
+
|```authDatabaseUsername```|```String```|```""```| Username to use for the MySQL users DB connection (only necessary if *useInMemoryAuthDB* is false).|
91
+
|```authDatabasePassword```|```String```|```""```| Password to use for the MySQL users DB connection (only necessary if *useInMemoryAuthDB* is false).|
92
+
|```authenticationValidFor```|```Int```|```30```| Default duration that user tokens are valid for (in minutes).|
69
93
|```maxTotalNoRequest```|```Int```|```2000```| Maximum number of requests that are allowed to be executed during the current refresh period regardless of their origin.|
70
94
|```maxIndividualIpReq```|```Int```|```200```| Maximum number of requests that are allowed to be executed during the current refresh period for one specific origin ip.|
71
95
|```ipLogRefreshRate```|```FiniteDuration```|```2.minutes```| Duration of the log refresh period.|
There are two ways of running the registry application. You can either run the application directly, or build a docker image defined by the *build.sbt* file, and run a container based on this image. Either way, you have to set the correct configuration values before starting the application (see section **Adapt the configuration file** above for more information). Make sure the Docker images of all Delphi components are present at the host's registry, as described in the **Requirements** section.
106
130
107
-
**Note:** For OSX you have to set Java's ```prefereIPv4Stack``` option to ```true``` before executing any of the steps below. In order to do so, execute ```export JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"``` in the terminal before calling ```sbt```.
131
+
**Note:** For OSX you have to set Java's ```prefereIPv4Stack``` option to ```true``` before executing any of the steps below. In order to do so, execute ```export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"``` in the terminal before calling ```sbt```.
108
132
109
133
### Run the registry directly
110
134
If you want to execute the registry directly on your local machine, simply go to the root folder of the repository and execute ```sbt run```. The application will stream all logging output to the terminal. You can terminate any time by pressing *RETURN*.
0 commit comments