Skip to content

Commit 2330369

Browse files
authored
Merge pull request #136 from delphi-hub/develop
Release version 1.0.0
2 parents 8d1b3db + 68fc14b commit 2330369

File tree

14 files changed

+572
-120
lines changed

14 files changed

+572
-120
lines changed

OpenAPISpecification.yaml

+81-7
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,32 @@ paths:
7474
required: true
7575
responses:
7676
'200':
77-
description: 'Supplied data is valid, a JWT is returned'
77+
description: 'Supplied data is valid, a Token object is returned'
7878
schema:
79-
type: string
80-
example: >-
81-
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
79+
$ref: '#/definitions/Token'
8280
'401':
8381
description: 'Unauthorized, invalid username / password supplied.'
82+
/users/refreshToken:
83+
post:
84+
tags:
85+
- User Management
86+
summary: Generate a new token with refresh token
87+
description: >-
88+
This endpoints returns a new token and refresh token with the provide refresh token. It ensures that the user do not need to login frequently if the token got expired, system can generate new token with the refresh token. Refresh token will be valid for more time then normal token.
89+
operationId: refreshToken
90+
parameters:
91+
- in: header
92+
name: Authorization
93+
description: Valid JWT refresh token.
94+
type: string
95+
required: true
96+
responses:
97+
'200':
98+
description: 'Supplied data is valid, a Token object is returned'
99+
schema:
100+
$ref: '#/definitions/Token'
101+
'401':
102+
description: 'The supplied authentication is invalid'
84103
/users/add:
85104
post:
86105
tags:
@@ -217,7 +236,7 @@ paths:
217236
summary: Get all instances of the specified type
218237
description: >-
219238
This command retrieves a list of all instances that are registered at
220-
the registry and that have the specified type. If no type is specified,
239+
the registry and that have the specified type. If no type is specified,
221240
all instances are being returned.
222241
operationId: instanceOfType
223242
parameters:
@@ -423,6 +442,21 @@ paths:
423442
required: true
424443
type: integer
425444
format: int64
445+
- name: StartPage
446+
in: query
447+
description: Page number
448+
type: integer
449+
format: int64
450+
- name: PageItems
451+
in: query
452+
description: Number of items in a page
453+
type: integer
454+
format: int64
455+
- name: LimitItems
456+
in: query
457+
description: Number of item need to provide
458+
type: integer
459+
format: int64
426460
responses:
427461
'200':
428462
description: List of events for the specified instance
@@ -530,6 +564,37 @@ paths:
530564
description: 'Bad request, your label exceeded the character limit'
531565
'404':
532566
description: 'Not found, the id you specified could not be found'
567+
568+
'/instances/{Id}/label/{Label}/delete':
569+
post:
570+
tags:
571+
- Basic Operations
572+
consumes:
573+
- application/json
574+
summary: Removes a label from the instance with the specified id
575+
description: >-
576+
This command will remove the specified label from the instance with the
577+
specified id.
578+
operationId: removeLabel
579+
parameters:
580+
- name: Id
581+
in: path
582+
description: Id of the instance
583+
required: true
584+
type: integer
585+
format: int64
586+
- name: Label
587+
in: path
588+
description: Label that need to be deleted
589+
required: true
590+
type: string
591+
responses:
592+
'200':
593+
description: Label successfully deleted
594+
'400':
595+
description: 'Bad request, your label exceeded the character limit'
596+
'404':
597+
description: 'Not found, the id you specified could not be found'
533598
'/instances/{Id}/logs':
534599
get:
535600
tags:
@@ -676,7 +741,7 @@ paths:
676741
This command informs the registry about an instance that was stopped
677742
manually, meaning not via calling /stop on the instance registry. This
678743
is only applicable to instances running inside a docker container, as
679-
non-container instances would deregister themselves when stopped.
744+
non-container instances would deregister themselves when stopped.
680745
operationId: reportStop
681746
parameters:
682747
- name: Id
@@ -875,7 +940,7 @@ paths:
875940
description: >-
876941
This command assignes a new dependency to the instance with the
877942
specified id. Internally, this will stop the instance, assign the new
878-
dependency and start the instance again. This is why this is only
943+
dependency and start the instance again. This is why this is only
879944
applicable to docker instances.
880945
operationId: assignInstance
881946
parameters:
@@ -964,6 +1029,15 @@ definitions:
9641029
enum:
9651030
- User
9661031
- Admin
1032+
Token:
1033+
type: object
1034+
properties:
1035+
token:
1036+
type: string
1037+
example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NTEzODY2MzYsIm5iZiI6MTU1MTM4NDgzNiwiaWF0IjoxNTUxMzg0ODM2LCJ1c2VyX2lkIjowLCJ1c2VyX3R5cGUiOiJBZG1pbiJ9.McqRRbGbRzzAhMlhlCtBVHopsIOb_flTrJu7LBVi4J8'
1038+
refreshToken:
1039+
type: string
1040+
example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NTEzODQ4OTYsIm5iZiI6MTU1MTM4NDgzNiwiaWF0IjoxNTUxMzg0ODM2LCJ1c2VyX2lkIjowfQ.Z0CNbJzZBaC65_qADLuyDpXLK7GDI0jYTIjO_QSNNag'
9671041
InstanceLink:
9681042
type: object
9691043
required:

README.md

+27-8
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,28 @@ The Delphi registry is a server that provides access to all information and oper
1818
* Starting / Stopping / Pausing / Resuming / Deleting instances deployed on the docker host
1919
* Re-Assigning dependencies to instances (e.g. assigning a certain ElasticSearch instance to a Crawler)
2020

21-
## Quick Setup (Linux)
21+
# Easy Installation Guide
22+
* [Quick Setup (Linux)](#quick-setup-linux)
23+
* [Docker Host Setup](#docker-host-setup)
24+
* [Registry Host Setup](#registry-host-setup)
25+
* [Requirements](#requirements)
26+
* [Windows](#windows)
27+
* [Linux](#linux)
28+
* [Configuration of Traefik](#configuration-of-traefik)
29+
* [Adapt the configuration file](#adapt-the-configuration-file)
30+
* [Docker Configuration](#docker-configuration)
31+
* [Docker configuration for Linux](#docker-configuration-for-linux)
32+
* [Docker configuration for OSX](#docker-configuration-for-osx)
33+
* [Running Registry application](#running-registry-application)
34+
* [Run the registry directly](#run-the-registry-directly)
35+
* [Run the registry in Docker](#run-the-registry-in-docker)
36+
* [Authorization](#authorization)
37+
38+
# Quick Setup (Linux)
39+
2240
Potentially there two different machines involved in the registry setup, the Docker host machine (*Docker Host*) and the machine the registry is hosted at (*Registry Host*). However, you can also use the same machine for hosting both applications.
2341

42+
## Docker Host Setup
2443
On the *Docker Host*, execute the following steps:
2544

2645
1) Clone this repository to your machine
@@ -32,7 +51,7 @@ On the *Docker Host*, execute the following steps:
3251
* Save your changes and execute ```systemctl daemon-reload``` and ```sudo service docker restart```
3352
5) Note down the IP address of your machine in the LAN ( execute ```ifconfig``` )
3453

35-
54+
## Registry Host Setup
3655
On the *Registry Host*, execute the following steps:
3756

3857
1) Clone this repository to your local machine
@@ -54,22 +73,22 @@ The Delphi registry requires a docker host to deploy containers. The following i
5473
* The Delphi Crawler ( ```delphi-crawler:1.0.0-SNAPSHOT``` )
5574
* The Delphi WebApi ( ```delphi-webapi:1.0.0-SNAPSHOT``` )
5675
* The Delphi WebApp ( ```delphi-webapp:1.0.0-SNAPSHOT``` )
57-
76+
### Windows
5877
For Windows users, to obtain these images, checkout the respective repositories ([here](https://github.com/delphi-hub/delphi-crawler), [here](https://github.com/delphi-hub/delphi-webapi) and [here](https://github.com/delphi-hub/delphi-webapp)) and execute the command
5978

6079
```
6180
sbt docker:publishLocal
6281
```
6382
inside their root directory. This will build the docker images and register them directly at the local docker registry. <br />
64-
83+
### Linux
6584
For Linux users, checkout Delphi Registry repository and execute the command
6685

6786
```
6887
sudo bash ./Delphi_install.sh
6988
```
7089
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.
7190
The registry requires an initial instance of ElasticSearch to be running.
72-
91+
### Configuration of Traefik
7392
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.
7493
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.
7594

@@ -127,7 +146,7 @@ Before you can start the application, you have to make sure your configuration f
127146
## Docker configuration
128147
By default, Docker is expected to be reachable at ```http://localhost:9095``` (see configuration attribute ```defaultDockerUri``` above), but you can override this setting by specifying the docker host URI in the environment variable *DELPHI_DOCKER_HOST*. You can also change the port that your Docker HTTP service is hosted on by executing the steps below on the Docker host machine.
129148

130-
### Linux
149+
### Docker configuration for Linux
131150
To change the port to 9095, go to the docker service file:
132151

133152
```
@@ -147,14 +166,14 @@ systemctl daemon-reload
147166
sudo service docker restart
148167
```
149168

150-
### OSX
169+
### Docker configuration for OSX
151170
Docker does not expose it's HTTP api on OSX for security reasons (as described [here](https://github.com/docker/for-mac/issues/770#issuecomment-252560286)), but you can run a docker container to redirect the API calls. To accept calls on your local machine's port 9095, execute:
152171

153172
```
154173
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:9095:1234 bobrik/socat TCP-LISTEN:1234,fork UNIX-CONNECT:/var/run/docker.sock
155174
```
156175

157-
## Run the application
176+
## Running Registry application
158177
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.
159178

160179
**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```.

build.sbt

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ scalaVersion := "2.12.4"
77

88

99
val akkaVersion = "2.5.14"
10-
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.0.11"
10+
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.0.14"
1111
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % akkaVersion
12-
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.1"
12+
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.5"
1313

1414
libraryDependencies += "io.spray" %% "spray-json" % "1.3.3"
1515

@@ -34,10 +34,10 @@ libraryDependencies ++= List(
3434
"com.typesafe.slick" %% "slick" % "3.2.3",
3535
"com.typesafe.slick" %% "slick-hikaricp" % "3.2.3",
3636
"com.typesafe.slick" %% "slick-codegen" % "3.2.3",
37-
"mysql" % "mysql-connector-java" % "5.1.34",
37+
"mysql" % "mysql-connector-java" % "5.1.47",
3838
"org.slf4j" % "slf4j-nop" % "1.6.4"
3939
)
4040

41-
libraryDependencies += "com.h2database" % "h2" % "1.4.197"
41+
libraryDependencies += "com.h2database" % "h2" % "1.4.199"
4242

4343
trapExit := false

src/main/scala/de/upb/cs/swt/delphi/instanceregistry/Configuration.scala

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class Configuration( ) {
5151

5252
val maxLabelLength: Int = 50
5353

54+
//default page limit
55+
val pageLimit: Int = 100
56+
5457
val dockerOperationTimeout: Timeout = Timeout(20 seconds)
5558
val dockerUri: String = sys.env.getOrElse("DELPHI_DOCKER_HOST", "http://localhost:9095")
5659

@@ -75,6 +78,9 @@ class Configuration( ) {
7578
//Authentication valid for the time
7679
val authenticationValidFor = 30 //minutes
7780

81+
//Refresh token is valid for the time
82+
val refreshTokenValidFor = 1440 //minutes
83+
7884
//Request Limiter
7985
val maxTotalNoRequest: Int = 2000
8086
val maxIndividualIpReq: Int = 200

0 commit comments

Comments
 (0)