Skip to content

Commit 2d690e0

Browse files
authored
Add vendor stack (#850)
* Add vendor stack * Updates * Add missing tls configuration * Updates * Add port env * Add placement and resource constraints * update_config: start-first * Fixes
1 parent 8defced commit 2d690e0

File tree

6 files changed

+102
-2
lines changed

6 files changed

+102
-2
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,19 @@
55
## Related PR/s
66

77
## Checklist
8-
98
- [ ] I tested and it works
9+
10+
<!-- Extra checks based on use case -->
11+
12+
<!-- New Stack Introduction
13+
- [ ] The Stack has been included in CI Workflow
14+
-->
15+
16+
<!-- New Service Introduction
17+
- [ ] Service has resource limits and reservations
18+
- [ ] Service has placement constraints or is global
19+
- [ ] Service is restartable
20+
- [ ] The restart is zero-downtime
21+
- [ ] Service is not bound to one specific node (e.g. via files or volumes)
22+
- [ ] Relevant OPS E2E Test for this stack were added
23+
-->

services/traefik/docker-compose.yml.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ services:
132132
- traefik.http.middlewares.ops_ratelimit.ratelimit.average=${TRAEFIK_RATELIMIT_AVG}
133133
- traefik.http.middlewares.ops_ratelimit.ratelimit.burst=${TRAEFIK_RATELIMIT_BURST}
134134
- traefik.http.middlewares.ops_ratelimit.ratelimit.sourcecriterion.ipstrategy.depth=1
135-
135+
# Platform user auth: Use this middleware to enforce only authenticated users
136+
# https://doc.traefik.io/traefik/middlewares/http/forwardauth
137+
- traefik.http.middlewares.authenticated_platform_user.forwardauth.address=http://${WEBSERVER_HOST}:${WEBSERVER_PORT}/v0/auth:check
138+
- traefik.http.middlewares.authenticated_platform_user.forwardauth.trustForwardHeader=true
139+
- traefik.http.middlewares.authenticated_platform_user.forwardauth.authResponseHeaders=Set-Cookie,osparc-sc2
136140
networks:
137141
public: null
138142
monitored: null

services/traefik/template.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ OPS_TRAEFIK_LOGLEVEL=${OPS_TRAEFIK_LOGLEVEL}
3434

3535
PUBLIC_NETWORK=${PUBLIC_NETWORK}
3636
MONITORED_NETWORK=${MONITORED_NETWORK}
37+
38+
WEBSERVER_HOST=${WEBSERVER_HOST}
39+
WEBSERVER_PORT=${WEBSERVER_PORT}

services/vendors/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.DEFAULT_GOAL := help
2+
3+
# Internal VARIABLES ------------------------------------------------
4+
# STACK_NAME defaults to name of the current directory. Should not to be changed if you follow GitOps operating procedures.
5+
STACK_NAME = $(notdir $(shell pwd))
6+
TEMP_COMPOSE=.stack.${STACK_NAME}.yaml
7+
REPO_BASE_DIR := $(shell git rev-parse --show-toplevel)
8+
9+
# TARGETS --------------------------------------------------
10+
include ${REPO_BASE_DIR}/scripts/common.Makefile
11+
12+
.PHONY: up ## Deploys stack
13+
up: ${TEMP_COMPOSE} .init .env
14+
docker stack deploy --with-registry-auth --prune --compose-file $< ${STACK_NAME}
15+
16+
.PHONY: up-dalco ## Deploys stack for Dalco Cluster
17+
up-dalco: up
18+
19+
.PHONY: up-aws
20+
up-aws: up
21+
22+
.PHONY: up-master ## Deploys stack on master cluster
23+
up-master: up
24+
25+
.PHONY: up-public ## Deploys stack on public cluster
26+
up-public: up
27+
28+
.PHONY: up-local ## Deploys stack on local deployment
29+
up-local: up
30+
31+
# Helpers -------------------------------------------------
32+
33+
.PHONY: ${TEMP_COMPOSE}
34+
${TEMP_COMPOSE}: docker-compose.yml .env
35+
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: "3.7"
2+
3+
services:
4+
manual:
5+
image: ${VENDOR_MANUAL_IMAGE}
6+
init: true
7+
hostname: "{{.Node.Hostname}}-{{.Task.Slot}}"
8+
deploy:
9+
replicas: ${VENDOR_MANUAL_REPLICAS}
10+
placement:
11+
constraints:
12+
- node.labels.simcore==true
13+
resources:
14+
limits:
15+
cpus: "1"
16+
memory: 2G
17+
reservations:
18+
cpus: "0.5"
19+
memory: 1G
20+
update_config:
21+
parallelism: 1
22+
order: start-first
23+
failure_action: continue
24+
delay: 10s
25+
labels:
26+
- traefik.enable=true
27+
- traefik.docker.network=${PUBLIC_NETWORK}
28+
- traefik.http.services.vendor_manual.loadbalancer.server.port=${VENDOR_MANUAL_PORT}
29+
- traefik.http.routers.vendor_manual.entrypoints=https
30+
- traefik.http.routers.vendor_manual.tls=true
31+
- traefik.http.routers.vendor_manual.rule=Host(`${VENDOR_MANUAL_DOMAIN}`)
32+
- traefik.http.routers.vendor_manual.middlewares=ops_gzip@swarm, authenticated_platform_user@swarm
33+
networks:
34+
- public
35+
36+
networks:
37+
public:
38+
external: true
39+
name: ${PUBLIC_NETWORK}

services/vendors/template.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
VENDOR_MANUAL_IMAGE=${VENDOR_MANUAL_IMAGE}
2+
VENDOR_MANUAL_REPLICAS=${VENDOR_MANUAL_REPLICAS}
3+
VENDOR_MANUAL_DOMAIN=${VENDOR_MANUAL_DOMAIN}
4+
VENDOR_MANUAL_PORT=${VENDOR_MANUAL_PORT}
5+
PUBLIC_NETWORK=${PUBLIC_NETWORK}

0 commit comments

Comments
 (0)