Skip to content

Commit 21ddf1f

Browse files
author
Johannes Duesing
committed
Traefik is now deployed via setup script. Added documentation to readme
1 parent bd0f7d3 commit 21ddf1f

File tree

5 files changed

+65
-10
lines changed

5 files changed

+65
-10
lines changed

README.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ this repository is purely experimental!
1111

1212
## What is the registry component?
1313
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+
1415
* Retrieving a list of all instances of a certain type (Crawler, WebApi, WebApp, ElasticSearch)
1516
* Retrieving the whole network graph (all instances and links between instances)
1617
* Deploying new instances of a certain type to a docker host
@@ -37,18 +38,31 @@ For Linux users, checkout Delphi Registry repository and execute the command
3738
```
3839
sudo bash ./Delphi_install.sh
3940
```
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.
4142
The registry requires an initial instance of ElasticSearch to be running.
4243

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+
4357
## Adapt the configuration file
4458
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.
4559

4660
|Attribute | Type | Default Value |Explanation |
4761
| :---: | :---: | :---: | :--- |
4862
|```bindHost``` | ```String``` | ```"0.0.0.0"``` | Host address that the registry server should be bound to |
4963
|```bindPort``` | ```Int``` | ```8087``` | Port that the registry server should be reachable at |
50-
|```traefikBaseHost``` | ```String``` | ```"delphi.cs.upb.de"``` | The host part of the URL that traefik is configured to append to instance URLs. |
51-
|```traefikDockerNetwork``` | ```String``` | ```"web"``` | The Docker network Traefik is configured to use. |
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. |
5266
|```traefikUri``` | ```String``` | ```"http://172.17.0.1:80"``` | The URI that the Traefik reverse-proxy is hosted at.|
5367
|```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. |
5468
|```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. |

Delphi_install.sh renamed to Setup/Delphi_install.sh

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
22

3+
####SETTINGS####
4+
DELPHI_NETWORK_NAME=delphi
5+
36
####DELPHI INSTALLATION#####
47
#########################
58

@@ -10,7 +13,12 @@ sudo chown $SUDO_USER $LOGFILE
1013
echo " Starting installation of Delphi Application"
1114
echo " Logs can be found at: $LOGFILE"
1215

16+
echo " Setting up Traefik..."
17+
sudo -u $SUDO_USER bash -c "docker network create $DELPHI_NETWORK_NAME &>> $LOGFILE"
18+
sudo -u $SUDO_USER bash -c "docker-compose up -d &>> $LOGFILE"
19+
echo " **Setup of Traefik completed**"
1320

21+
echo " Cloning Delphi ..."
1422
sudo -u $SUDO_USER bash -c "git clone --progress https://github.com/delphi-hub/delphi.git --recurse-submodules>> $LOGFILE"
1523
echo " **Cloning of Delphi Repositories completed**"
1624

@@ -27,15 +35,15 @@ echo " **Cloning of Delphi Repositories completed**"
2735
## Installing Images and Creating Volumes
2836

2937
echo " Building Delphi Images. This step might take several minutes"
30-
sudo -u $SUDO_USER bash -c "sbt docker:publishLocal &>> $LOGFILE"
38+
##sudo -u $SUDO_USER bash -c "cd ..;sbt docker:publishLocal &>> $LOGFILE"
3139
echo " Delphi-Registry Image built"
32-
sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-webapi;sbt docker:publishLocal) &>> $LOGFILE"
40+
##sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-webapi;sbt docker:publishLocal) &>> $LOGFILE"
3341
echo " Delphi-WebApi Image built"
34-
sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-webapp;sbt docker:publishLocal) &>> $LOGFILE"
42+
##sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-webapp;sbt docker:publishLocal) &>> $LOGFILE"
3543
echo " Delphi-WebApp Image built"
36-
sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-crawler;sbt docker:publishLocal) &>> $LOGFILE"
44+
##sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-crawler;sbt docker:publishLocal) &>> $LOGFILE"
3745
echo " Delphi-Crawler Image built"
38-
sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-management;sbt docker:publishLocal) &>> $LOGFILE"
46+
##sudo -u $SUDO_USER bash -c "(cd ./delphi/delphi-management;sbt docker:publishLocal) &>> $LOGFILE"
3947
echo " Delphi-Management Image built"
4048
bash -c "docker images >> $LOGFILE"
4149

Setup/docker-compose.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3.5'
2+
3+
services:
4+
5+
traefik:
6+
restart: always
7+
image: traefik:1.6
8+
container_name: traefik
9+
ports:
10+
- "80:80"
11+
- "8080:8080"
12+
networks:
13+
- delphi
14+
volumes:
15+
- ./traefik.toml:/etc/traefik/traefik.toml
16+
- /var/run/docker.sock:/var/run/docker.sock:ro
17+
18+
networks:
19+
delphi:
20+
external: true
21+
22+

Setup/traefik.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[entryPoints]
2+
[entryPoints.http]
3+
address = ":80"
4+
5+
[api]
6+
7+
[docker]
8+
9+
domain = "delphi.de"
10+
11+

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Configuration( ) {
1010
val bindPort: Int = 8087
1111

1212
//Traefik data
13-
val traefikBaseHost: String = "delphi.cs.upb.de"
14-
val traefikDockerNetwork: String = "web"
13+
val traefikBaseHost: String = "delphi.de"
14+
val traefikDockerNetwork: String = "delphi"
1515
val traefikUri: String = "http://172.17.0.1:80"
1616

1717

0 commit comments

Comments
 (0)