Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vendor stack #850

Merged
merged 10 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,19 @@
## Related PR/s

## Checklist

- [ ] I tested and it works

YuryHrytsuk marked this conversation as resolved.
Show resolved Hide resolved
<!-- Extra checks based on use case -->

<!-- New Stack Introduction
- [ ] The Stack has been included in CI Workflow
-->

<!-- New Service Introduction
- [ ] Service has resource limits and reservations
- [ ] Service has placement constraints or is global
- [ ] Service is restartable
- [ ] The restart is zero-downtime
- [ ] Service can migrate to another Node without manual intervention
- [ ] Relevant OPS E2E Test for this stack were added
-->
6 changes: 5 additions & 1 deletion services/traefik/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ services:
- traefik.http.middlewares.ops_ratelimit.ratelimit.average=${TRAEFIK_RATELIMIT_AVG}
- traefik.http.middlewares.ops_ratelimit.ratelimit.burst=${TRAEFIK_RATELIMIT_BURST}
- traefik.http.middlewares.ops_ratelimit.ratelimit.sourcecriterion.ipstrategy.depth=1

# Platform user auth: Use this middleware to enforce only authenticated users
# https://doc.traefik.io/traefik/middlewares/http/forwardauth
- traefik.http.middlewares.authenticated_platform_user.forwardauth.address=http://${WEBSERVER_HOST}:${WEBSERVER_PORT}/v0/auth:check
- traefik.http.middlewares.authenticated_platform_user.forwardauth.trustForwardHeader=true
- traefik.http.middlewares.authenticated_platform_user.forwardauth.authResponseHeaders=Set-Cookie,osparc-sc2
networks:
public: null
monitored: null
Expand Down
3 changes: 3 additions & 0 deletions services/traefik/template.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ OPS_TRAEFIK_LOGLEVEL=${OPS_TRAEFIK_LOGLEVEL}

PUBLIC_NETWORK=${PUBLIC_NETWORK}
MONITORED_NETWORK=${MONITORED_NETWORK}

WEBSERVER_HOST=${WEBSERVER_HOST}
WEBSERVER_PORT=${WEBSERVER_PORT}
35 changes: 35 additions & 0 deletions services/vendors/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.DEFAULT_GOAL := help

# Internal VARIABLES ------------------------------------------------
# STACK_NAME defaults to name of the current directory. Should not to be changed if you follow GitOps operating procedures.
STACK_NAME = $(notdir $(shell pwd))
TEMP_COMPOSE=.stack.${STACK_NAME}.yaml
REPO_BASE_DIR := $(shell git rev-parse --show-toplevel)

# TARGETS --------------------------------------------------
include ${REPO_BASE_DIR}/scripts/common.Makefile

.PHONY: up ## Deploys registry stack
up: ${TEMP_COMPOSE} .init .env
docker stack deploy --with-registry-auth --prune --compose-file $< ${STACK_NAME}
YuryHrytsuk marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: up-dalco ## Deploys registry stack for Dalco Cluster
up-dalco: up

.PHONY: up-aws
up-aws: up

.PHONY: up-master ## Deploys registry on master cluster
up-master: up

.PHONY: up-public ## Deploys registry on public cluster
up-public: up

.PHONY: up-local ## Deploys registry on local deployment
up-local: up

# Helpers -------------------------------------------------

.PHONY: ${TEMP_COMPOSE}
${TEMP_COMPOSE}: docker-compose.yml .env
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
39 changes: 39 additions & 0 deletions services/vendors/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3.7"

services:
manual:
image: ${VENDOR_MANUAL_IMAGE}
init: true
hostname: "{{.Node.Hostname}}-{{.Task.Slot}}"
deploy:
replicas: ${VENDOR_MANUAL_REPLICAS}
placement:
constraints:
- node.labels.simcore==true
resources:
limits:
cpus: "1"
memory: 2G
reservations:
cpus: "0.5"
memory: 1G
update_config:
parallelism: 1
order: start-first
failure_action: continue
delay: 10s
labels:
- traefik.enable=true
- traefik.docker.network=${PUBLIC_NETWORK}
- traefik.http.services.vendor_manual.loadbalancer.server.port=${VENDOR_MANUAL_PORT}
- traefik.http.routers.vendor_manual.entrypoints=https
- traefik.http.routers.vendor_manual.tls=true
- traefik.http.routers.vendor_manual.rule=Host(`${VENDOR_MANUAL_DOMAIN}`)
- traefik.http.routers.vendor_manual.middlewares=ops_gzip@swarm, authenticated_platform_user@swarm
networks:
- public

networks:
public:
external: true
name: ${PUBLIC_NETWORK}
5 changes: 5 additions & 0 deletions services/vendors/template.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VENDOR_MANUAL_IMAGE=${VENDOR_MANUAL_IMAGE}
VENDOR_MANUAL_REPLICAS=${VENDOR_MANUAL_REPLICAS}
VENDOR_MANUAL_DOMAIN=${VENDOR_MANUAL_DOMAIN}
VENDOR_MANUAL_PORT=${VENDOR_MANUAL_PORT}
PUBLIC_NETWORK=${PUBLIC_NETWORK}
Loading