diff --git a/example/README.md b/example/README.md index cdaaa9c..c322b50 100644 --- a/example/README.md +++ b/example/README.md @@ -9,8 +9,8 @@ The example has the following containers | container | task | | --- | --- | | **atom** | the atom-generator that based on the given configuration generates atom feed xml files | -| **proxy** | a web service that proxies the ```lighttpd``` and ```style``` web services so they are presented as a single service. In k8s this will be done by the ingress, [traefik](https://docs.traefik.io/) for example | -| **lighttpd** | a web service that host the atom files and proxies the ```minio``` object storage containing the dummy data files| +| **traefik** | a proxy that routes the request to the corresponding backend: ```lighttpd```, ```style``` or ```minio``` | +| **lighttpd** | a web service that host the atom files and proxies the ```minio``` object storage containing the dummy data files | | **style** | a (optional) web service that host the styling for the atom service | | **minio** | a object store that host the dummy data files for this example | diff --git a/example/docker-compose.yaml b/example/docker-compose.yaml index a728ee8..c514cc8 100644 --- a/example/docker-compose.yaml +++ b/example/docker-compose.yaml @@ -10,21 +10,7 @@ services: - ./inspire:/inspire - demo:/output/ networks: - atom-network: - proxy: - image: pdok/lighttpd - restart: unless-stopped - command: ["bash", "-c","lighttpd -D -f /srv/lighttpd/lighttpd.conf"] - ports: - - 80:80 - labels: - nl.pdok.application.group: "proxy" - SERVICE_CHECK_HTTP: "/" - SERVICE_NAME: atom-style - volumes: - - ./proxy:/srv/lighttpd - networks: - atom-network: + atom-network: style: image: pdok/atom-style restart: unless-stopped @@ -49,6 +35,30 @@ services: - demo:/output/download/ networks: atom-network: + traefik: + image: "traefik:v2.3" + container_name: "traefik" + command: + - "--log.level=DEBUG" + - "--api.insecure=true" + - "--api=true" + - "--api.dashboard=true" + - "--ping=true" + - "--entrypoints.web.address=:80" + - "--entrypoints.traefik.address=:8080" + - "--providers.file.directory=/config/" + ports: + - 80:80 + - 8080:8080 + labels: + # Dashboard + - "traefik.http.routers.traefik.rule=Host(`traefik.docker.localhost`)" + - "traefik.http.routers.traefik.service=api@internal" + - "traefik.http.routers.traefik.entrypoints=web" + volumes: + - ./traefik/:/config/ + networks: + atom-network: minio: image: minio/minio:RELEASE.2020-09-10T22-02-45Z volumes: @@ -63,7 +73,7 @@ services: timeout: 20s retries: 3 networks: - atom-network: + atom-network: volumes: demo: networks: diff --git a/example/images/diagram.drawio b/example/images/diagram.drawio index cf0f846..3e3e989 100644 --- a/example/images/diagram.drawio +++ b/example/images/diagram.drawio @@ -1 +1,93 @@ -7Vrbcps6FP0aP9bDTTJ+bJ1Lp02mTT2dpo8CZEwjIyrLsX2+/kggrsIOSWzjZOrMZNAGgVhr7YW0YWBPFptrhpL5LQ0wGVhGsBnYFwPLGju2+C8D2yxgmqaVRUIWBSpWBqbRf1gFDRVdRQFe1g7klBIeJfWgT+MY+7wWQ4zRdf2wGSX1qyYoxFpg6iOiR39FAZ9nUdcalfHPOArn+ZVNOM72LFB+sLqT5RwFdF0J2ZcDe8Io5dnWYjPBRIKX45L1u9qxtxgYwzHv0uHhLry6/vnj+s6x2aN3ZzEUf/1guWpwfJvfMQ4EAKpJGZ/TkMaIXJbRT4yu4gDL0xqiVR5zQ2kigqYI/sGcbxWbaMWpCM35gqi9YsRsey8bQ8OAeeC3POEQgLx9sVFXyFrbaus7ZtECc8xUMLsLOfSd6KjQkq6Yj/dAohTLEQsx3wcdLEgU6sdUDIdtRUeGCeLRY30gSMkwLI4rmRIbiqxnEKdG+YjISl0Jcbr4EOIYM7HFNFrrpK3nEcfTBKVIrEXq1gma0ZjnGijaGZumK9sRIRNKKEvPbc9cH/u+iC85ow+4ssdzgQNKgh4x43iznyIdUdUBGCqTlJfA3CPWZWKaebbNK0kJjSORYI56zR6jkTlPJM4Bc8TpmCO9pojZj7dtIn5f2a5wI1olNbJRs7S3wSjok1FHM72E0c32tF43w7Dd64LR2DMO5HUmrHud7fTudeN/2dQ5m0DHbBr1mU1WL4weGuVXoKe6fqeRuHKRek5jmgGaKZWxqno1OCiG8XJagGZyRKY3T4IT+9zM2uFz0IMAHsbnCl9TYDtW3z5XqO+tZgXs6D1un94DNZFneL9/hVuj3hVuaDC/syf5sUsEo44pZtp95thIy7FFFEf0pDkWAOwGTluOuZZnwwPlWLMy0P9TxDQ18DXcQwF8svPuVUETefnhxrNRMRvOA3RUxmMdlAKpg6PiPg3Kco4SuRlTjp9Wo4f8hzDV77cVJ1GcqzJA7OGb6BXx1BKGBugqtD1s6kBXgHRb1GUaxwJy/M6AzE9TF2xLfe+0MOcDqOEM0UKCF3vLJMXCaAkNJ9OpCBMuoWViK+Tpjk5976c3L+77ZXpKISCxMolFk+AZP6ouxnUj610XVld3bz4wj+f2sFExKpaxvbm9qb+jOKU4m7N9IP/aZiIw/SmqKvHs9zpdW2f24DD1Euo/Ts77GaTXgy5+3t7+7sPnfYGsXE8dkMd96wnnqDyf2TPF6uCWx14x2ECurauwAAh6fopY/TrWy/Vn7Vj896cw3UneNpJn6tiWXtwspurprP7+9kZeIY+F5dy5LzvfY8Kjo1J3ZiZsd5jY58TMCN58lF+YpQXHQG1e+AQtl5HfKH7GQf71mAOGVhZRCLtDB8rKWX7TtjF0G5wYHQptCLuz1mI29F3szaT2kIfJp0Io+SExlWrpXB7da2igha089srXcqCe5faooYGsaKu9ldPOYzpPnOjIr/ds/XnG8N8VXnJNaSLbeF1HdXIVc1UlqJCW4TJ3Ix+Rj2rHIgoCsstX6gXhHbIRyrpKfy2Ttm5r3mesbRuU2bpPOC3Ke8GcRDTLLzIzysvvWu3L/wE= \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/images/diagram.svg b/example/images/diagram.svg index 61b5d1c..610eebd 100644 --- a/example/images/diagram.svg +++ b/example/images/diagram.svg @@ -1,3 +1 @@ - - -
atom-generator
atom-generator
proxy
proxy
lighttpd
lighttpd
style
style
minio
minio
    .CSS
    .XSL
    .JS
.CSS...
DUMMY
DUMMY
<XML/>
<XML/>
request
request
Viewer does not support full SVG 1.1
\ No newline at end of file +
atom-generator
atom-generator
traefik
traefik
lighttpd
lighttpd
style
style
minio
minio
    .CSS
    .XSL
    .JS
.CSS...
DUMMY
DUMMY
<XML/>
<XML/>
request
request
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/example/lighttpd/lighttpd.conf b/example/lighttpd/lighttpd.conf index ca9e7e5..99fa477 100644 --- a/example/lighttpd/lighttpd.conf +++ b/example/lighttpd/lighttpd.conf @@ -7,8 +7,6 @@ server.modules += ( "mod_accesslog" ) server.modules += ( "mod_rewrite" ) server.modules += ( "mod_proxy" ) -server.stream-response-body = 2 - server.errorlog = "/dev/stderr" accesslog.filename = "/dev/stderr" @@ -34,21 +32,3 @@ mimetype.assign = ( ".gml" => "application/gml+xml", ".gpkg" => "application/geopackage+sqlite3" ) - -$HTTP["url"] =~ "(^/data/)" { - proxy.server = ( "" => ( "" => ( "host" => "127.0.0.1", "port" => 81 ))) -} - -# Part for proxy listening on port 81 -$SERVER["socket"] == ":81" { - url.rewrite-once = ( "^/data/(.*)$" => "/$1" ) - proxy.server = ( "" => - ( - "webapp:81" => # name - ( - "host" => "minio", - "port" => 9000 - ) - ) - ) -} \ No newline at end of file diff --git a/example/proxy/lighttpd.conf b/example/proxy/lighttpd.conf deleted file mode 100644 index 9bb9e46..0000000 --- a/example/proxy/lighttpd.conf +++ /dev/null @@ -1,51 +0,0 @@ -server.document-root = "/" -server.port = 80 - -server.modules += ( "mod_setenv" ) -server.modules += ( "mod_status" ) -server.modules += ( "mod_accesslog" ) -server.modules += ( "mod_rewrite" ) -server.modules += ( "mod_proxy" ) - -server.stream-response-body = 2 - -server.errorlog = "/dev/stderr" -accesslog.filename = "/dev/stderr" - -$HTTP["url"] =~ "(^/atom/)" { - proxy.server = ( "" => ( "" => ( "host" => "127.0.0.1", "port" => 82 ))) -} - -$HTTP["url"] =~ "(^/download/)" { - proxy.server = ( "" => ( "" => ( "host" => "127.0.0.1", "port" => 81 ))) -} - -$HTTP["url"] =~ "(^/data/)" { - proxy.server = ( "" => ( "" => ( "host" => "127.0.0.1", "port" => 81 ))) -} - -# Part for proxy listening on port 81 -$SERVER["socket"] == ":81" { - proxy.server = ( "" => - ( - "webapp:81" => # name - ( - "host" => "lighttpd", - "port" => 80 - ) - ) - ) -} - -# Part for proxy listening on port 82 -$SERVER["socket"] == ":82" { - proxy.server = ( "" => - ( - "webapp:82" => # name - ( - "host" => "style", - "port" => 80 - ) - ) - ) -} \ No newline at end of file diff --git a/example/traefik/traefik.toml b/example/traefik/traefik.toml new file mode 100644 index 0000000..599e485 --- /dev/null +++ b/example/traefik/traefik.toml @@ -0,0 +1,36 @@ +[http] + # Add the router + [http.routers] + [http.routers.atom] + entryPoints = ["web"] + service = "service-atom" + rule = "PathPrefix(`/atom`)" + [http.routers.download] + entryPoints = ["web"] + service = "service-download" + rule = "PathPrefix(`/download`)" + [http.routers.data] + entryPoints = ["web"] + middlewares = ["data-stripprefix"] + service = "service-data" + rule = "PathPrefix(`/data`)" + + # Add the middleware + [http.middlewares] + [http.middlewares.data-stripprefix.stripPrefix] + prefixes = ["/data"] + + # Add the service + [http.services] + [http.services.service-atom] + [http.services.service-atom.loadBalancer] + [[http.services.service-atom.loadBalancer.servers]] + url = "http://style/" + [http.services.service-download] + [http.services.service-download.loadBalancer] + [[http.services.service-download.loadBalancer.servers]] + url = "http://lighttpd/" + [http.services.service-data] + [http.services.service-data.loadBalancer] + [[http.services.service-data.loadBalancer.servers]] + url = "http://minio:9000/" \ No newline at end of file