From f5d407d298ffc20755ad71a76ca77aa7138b25ab Mon Sep 17 00:00:00 2001 From: alexlapa <36732824+alexlapa@users.noreply.github.com> Date: Tue, 6 Aug 2019 13:28:03 +0300 Subject: [PATCH] Kubernetes and Helm integration for medea-demo app (#41, #34) - create 'medea-demo' Helm chart - configure 'medea-demo' deployment for Minikube and 'staging' Kubernetes clusters - extend Makefile with Helm and Minikube usage commands --- .gitignore | 2 + Makefile | 237 ++++++++++++++++-- dev/coturn/redis.conf | 2 + dev/coturn/turnserver.conf | 2 - jason/demo/.dockerignore | 8 + jason/demo/.gitignore | 2 + jason/demo/Dockerfile | 2 +- jason/demo/chart/.editorconfig | 10 + jason/demo/chart/medea-demo/.helmignore | 3 + jason/demo/chart/medea-demo/Chart.yaml | 4 + .../{ => chart/medea-demo}/conf/nginx.vh.conf | 6 +- jason/demo/chart/medea-demo/default/tls.crt | 20 ++ jason/demo/chart/medea-demo/default/tls.key | 28 +++ .../demo/chart/medea-demo/templates/NOTES.txt | 6 + .../chart/medea-demo/templates/_helpers.tpl | 29 +++ .../templates/configmap.server.yaml | 38 +++ .../templates/configmap.web-client.yaml | 23 ++ .../templates/deployment.server.yaml | 181 +++++++++++++ .../templates/deployment.web-client.yaml | 82 ++++++ .../chart/medea-demo/templates/ingress.yaml | 53 ++++ .../medea-demo/templates/secret.server.yaml | 21 ++ .../templates/secret.tls.default.yaml | 27 ++ .../medea-demo/templates/service.server.yaml | 25 ++ .../templates/service.web-client.yaml | 25 ++ jason/demo/chart/medea-demo/values.yaml | 166 ++++++++++++ jason/demo/docker-compose.yml | 13 +- jason/demo/index.html | 15 +- jason/demo/minikube.vals.yaml | 35 +++ jason/demo/staging.vals.yaml | 64 +++++ 29 files changed, 1090 insertions(+), 39 deletions(-) create mode 100644 jason/demo/.dockerignore create mode 100644 jason/demo/chart/.editorconfig create mode 100644 jason/demo/chart/medea-demo/.helmignore create mode 100644 jason/demo/chart/medea-demo/Chart.yaml rename jason/demo/{ => chart/medea-demo}/conf/nginx.vh.conf (73%) create mode 100644 jason/demo/chart/medea-demo/default/tls.crt create mode 100644 jason/demo/chart/medea-demo/default/tls.key create mode 100644 jason/demo/chart/medea-demo/templates/NOTES.txt create mode 100644 jason/demo/chart/medea-demo/templates/_helpers.tpl create mode 100644 jason/demo/chart/medea-demo/templates/configmap.server.yaml create mode 100644 jason/demo/chart/medea-demo/templates/configmap.web-client.yaml create mode 100644 jason/demo/chart/medea-demo/templates/deployment.server.yaml create mode 100644 jason/demo/chart/medea-demo/templates/deployment.web-client.yaml create mode 100644 jason/demo/chart/medea-demo/templates/ingress.yaml create mode 100644 jason/demo/chart/medea-demo/templates/secret.server.yaml create mode 100644 jason/demo/chart/medea-demo/templates/secret.tls.default.yaml create mode 100644 jason/demo/chart/medea-demo/templates/service.server.yaml create mode 100644 jason/demo/chart/medea-demo/templates/service.web-client.yaml create mode 100644 jason/demo/chart/medea-demo/values.yaml create mode 100644 jason/demo/minikube.vals.yaml create mode 100644 jason/demo/staging.vals.yaml diff --git a/.gitignore b/.gitignore index d971d4214..8f622b075 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,7 @@ /.cache/ +/charts/ + /target/ **/*.rs.bk diff --git a/Makefile b/Makefile index 06485683a..cf1d461b9 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ DEMO_IMAGE_NAME := instrumentisto/medea-demo RUST_VER := 1.36 +CURRENT_BRANCH := $(strip $(shell git branch | grep \* | cut -d ' ' -f2)) + @@ -48,6 +50,27 @@ lint: cargo.lint fmt: cargo.fmt +test: test.unit + + + + +#################### +# Running commands # +#################### + +down.demo: docker.down.demo + + +# Run Coturn STUN/TURN server. +# +# Usage: +# make up.coturn + +up.coturn: + docker-compose up + + up.demo: docker.up.demo @@ -60,7 +83,22 @@ up.dev: $(MAKE) -j3 up.coturn up.jason up.medea -test: test.unit +# Run Jason E2E demo in development mode. +# +# Usage: +# make up.jason + +up.jason: + npm run start --prefix=jason/e2e-demo + + +# Run Medea media server in development mode. +# +# Usage: +# make up.medea + +up.medea: + cargo run --bin medea @@ -198,22 +236,30 @@ release.jason: wasm-pack publish +release.helm: helm.package.release + + ################### # Docker commands # ################### +docker-env = $(strip $(if $(call eq,$(minikube),yes),\ + $(subst export,,$(shell minikube docker-env | cut -d '\#' -f1)),)) + # Build Docker image for demo application. # # Usage: # make docker.build.demo [TAG=(dev|)] +# [minikube=(no|yes)] docker-build-demo-image-name = $(DEMO_IMAGE_NAME) docker.build.demo: @make yarn proj=demo - docker build \ + $(docker-env) \ + docker build $(if $(call eq,$(minikube),yes),,--network=host) --force-rm \ -t $(docker-build-demo-image-name):$(if $(call eq,$(TAG),),dev,$(TAG)) \ jason/demo @@ -221,8 +267,9 @@ docker.build.demo: # Build medea project Docker image. # # Usage: -# make docker.build.medea [TAG=(dev|)] -# [debug=(yes|no)] [no-cache=(no|yes)] +# make docker.build.medea [TAG=(dev|)] [debug=(yes|no)] +# [no-cache=(no|yes)] +# [minikube=(no|yes)] docker-build-medea-image-name = $(MEDEA_IMAGE_NAME) @@ -237,7 +284,8 @@ ifneq ($(no-cache),yes) endif $(call docker.build.clean.ignore) @echo "!target/$(if $(call eq,$(debug),no),release,debug)/" >> .dockerignore - docker build --network=host --force-rm \ + $(docker-env) \ + docker build $(if $(call eq,$(minikube),yes),,--network=host) --force-rm \ $(if $(call eq,$(no-cache),yes),\ --no-cache --pull,) \ $(if $(call eq,$(IMAGE),),\ @@ -276,35 +324,178 @@ docker.up.demo: docker.down.demo -#################### -# Running commands # -#################### +############################## +# Helm and Minikube commands # +############################## -# Run Coturn STUN/TURN server. +helm-cluster = $(if $(call eq,$(cluster),),minikube,$(cluster)) +helm-namespace = $(if $(call eq,$(helm-cluster),minikube),kube,staging)-system +helm-cluster-args = $(strip \ + --kube-context=$(helm-cluster) --tiller-namespace=$(helm-namespace)) + +helm-chart = $(if $(call eq,$(chart),),medea-demo,$(chart)) +helm-chart-dir = jason/demo/chart/medea-demo +helm-chart-vals-dir = jason/demo + +helm-release = $(if $(call eq,$(release),),,$(release)-)$(helm-chart) +helm-release-namespace = $(strip \ + $(if $(call eq,$(helm-cluster),staging),staging,default)) + +# Run Helm command in context of concrete Kubernetes cluster. # # Usage: -# make up.coturn +# make helm [cmd=(--help|'')] +# [cluster=(minikube|staging)] -up.coturn: - docker-compose up +helm: + helm $(helm-cluster-args) $(if $(call eq,$(cmd),),--help,$(cmd)) -# Run Jason E2E demo in development mode. +# Remove Helm release of project Helm chart from Kubernetes cluster. # # Usage: -# make up.jason +# make helm.down [chart=medea-demo] [release=] +# [cluster=(minikube|staging)] -up.jason: - npm run start --prefix=jason/e2e-demo +helm.down: + $(if $(shell helm ls $(helm-cluster-args) | grep '$(helm-release)'),\ + helm del --purge $(helm-cluster-args) $(helm-release) ,\ + @echo "--> No '$(helm-release)' release found in $(helm-cluster) cluster") -# Run Medea media server in development mode. +# Upgrade (or initialize) Tiller (server side of Helm) of Minikube. # # Usage: -# make up.medea +# make helm.init [client-only=no [upgrade=(yes|no)]] +# [client-only=yes] -up.medea: - cargo run --bin medea +helm.init: + helm init --wait \ + $(if $(call eq,$(client-only),yes),\ + --client-only,\ + --kube-context=minikube --tiller-namespace=kube-system \ + $(if $(call eq,$(upgrade),no),,--upgrade)) + + +# Lint project Helm chart. +# +# Usage: +# make helm.lint [chart=medea-demo] + +helm.lint: + helm lint $(helm-chart-dir)/ + + +# List all Helm releases in Kubernetes cluster. +# +# Usage: +# make helm.list [cluster=(minikube|staging)] + +helm.list: + helm ls $(helm-cluster-args) + + +# Build Helm package from project Helm chart. +# +# Usage: +# make helm.package [chart=medea-demo] + +helm-package-dir = .cache/helm/packages + +helm.package: + @rm -rf $(helm-package-dir) + @mkdir -p $(helm-package-dir)/ + helm package --destination=$(helm-package-dir)/ $(helm-chart-dir)/ + + +# Build and publish project Helm package to GitHub Pages. +# +# Usage: +# make helm.package.release [chart=medea-demo] [build=(yes|no)] + +helm.package.release: +ifneq ($(build),no) + @make helm.package chart=$(helm-chart) +endif + git fetch origin gh-pages:gh-pages + git checkout gh-pages + git reset --hard + @mkdir -p charts/ + cp -rf $(helm-package-dir)/* charts/ + if [ -n "$$(git add -v charts/)" ]; then \ + helm repo index charts/ \ + --url=https://instrumentisto.github.io/medea/charts ; \ + git add -v charts/ ; \ + git commit -m "Release '$(helm-chart)' Helm chart" ; \ + fi + git checkout $(CURRENT_BRANCH) + git push origin gh-pages + + +# Run project Helm chart in Kubernetes cluster as Helm release. +# +# Usage: +# make helm.up [chart=medea-demo] [release=] +# [cluster=minikube [rebuild=(no|yes) [no-cache=(no|yes)]]] +# [cluster=staging] +# [wait=(yes|no)] + +helm.up: +ifeq ($(wildcard $(helm-chart-vals-dir)/my.$(helm-cluster).vals.yaml),) + touch $(helm-chart-vals-dir)/my.$(helm-cluster).vals.yaml +endif +ifeq ($(helm-cluster),minikube) +ifeq ($(helm-chart),medea-demo) +ifeq ($(rebuild),yes) + @make docker.build.demo minikube=yes TAG=dev + @make docker.build.medea no-cache=$(no-cache) minikube=yes TAG=dev +endif +endif +endif + helm upgrade --install --force $(helm-cluster-args) \ + $(helm-release) $(helm-chart-dir)/ \ + --namespace=$(helm-release-namespace) \ + --values=$(helm-chart-vals-dir)/$(helm-cluster).vals.yaml \ + --values=$(helm-chart-vals-dir)/my.$(helm-cluster).vals.yaml \ + --set server.deployment.revision=$(shell date +%s) \ + --set web-client.deployment.revision=$(shell date +%s) \ + $(if $(call eq,$(wait),no),,\ + --wait ) + + +# Bootstrap Minikube cluster (local Kubernetes) for development environment. +# +# The bootsrap script is updated automatically to the latest version every day. +# For manual update use 'update=yes' command option. +# +# Usage: +# make minikube.boot [update=(no|yes)] +# [driver=(virtualbox|hyperkit|hyperv)] +# [k8s-version=] + +minikube.boot: +ifeq ($(update),yes) + $(call minikube.boot.download) +else +ifeq ($(wildcard $(HOME)/.minikube/bootstrap.sh),) + $(call minikube.boot.download) +else +ifneq ($(shell find $(HOME)/.minikube/bootstrap.sh -mmin +1440),) + $(call minikube.boot.download) +endif +endif +endif + @$(if $(cal eq,$(driver),),,MINIKUBE_VM_DRIVER=$(driver)) \ + $(if $(cal eq,$(k8s-version),),,MINIKUBE_K8S_VER=$(k8s-version)) \ + $(HOME)/.minikube/bootstrap.sh +define minikube.boot.download + $() + @mkdir -p $(HOME)/.minikube/ + @rm -f $(HOME)/.minikube/bootstrap.sh + curl -fL -o $(HOME)/.minikube/bootstrap.sh \ + https://raw.githubusercontent.com/instrumentisto/toolchain/master/minikube/bootstrap.sh + @chmod +x $(HOME)/.minikube/bootstrap.sh +endef @@ -317,7 +508,11 @@ up.medea: cargo cargo.fmt cargo.lint \ docker.build.demo docker.build.medea docker.down.demo docker.up.demo \ docs docs.rust \ - release.jason \ + down.demo \ + helm helm.down helm.init helm.lint helm.list \ + helm.package helm.package.release helm.up \ + minikube.boot \ + release.jason release.helm \ test test.unit \ up up.coturn up.demo up.dev up.jason up.medea \ yarn diff --git a/dev/coturn/redis.conf b/dev/coturn/redis.conf index 66796f0a8..3085f09a8 100644 --- a/dev/coturn/redis.conf +++ b/dev/coturn/redis.conf @@ -1,3 +1,5 @@ requirepass turn timeout 0 tcp-keepalive 60 +maxmemory 16mb +maxmemory-policy allkeys-lfu diff --git a/dev/coturn/turnserver.conf b/dev/coturn/turnserver.conf index 71a5b85eb..699ac5315 100644 --- a/dev/coturn/turnserver.conf +++ b/dev/coturn/turnserver.conf @@ -3,8 +3,6 @@ fingerprint no-cli no-tls no-dtls -min-port=49160 -max-port=49200 realm=medea redis-userdb="ip=127.0.0.1 port=6379 dbname=0 password=turn" user=USER:PASS diff --git a/jason/demo/.dockerignore b/jason/demo/.dockerignore new file mode 100644 index 000000000..ded5604d8 --- /dev/null +++ b/jason/demo/.dockerignore @@ -0,0 +1,8 @@ +.DS_Store + +chart/ +!chart/medea-demo/conf/nginx.vh.conf + +*.vals.yaml + +yarn-error.log diff --git a/jason/demo/.gitignore b/jason/demo/.gitignore index daff7b8dc..0b8de3d09 100644 --- a/jason/demo/.gitignore +++ b/jason/demo/.gitignore @@ -1,3 +1,5 @@ /node_modules/ +/my.*.vals.yaml + /yarn-error.log diff --git a/jason/demo/Dockerfile b/jason/demo/Dockerfile index ea3e119c4..53929124e 100644 --- a/jason/demo/Dockerfile +++ b/jason/demo/Dockerfile @@ -20,7 +20,7 @@ RUN cd /npm/ \ # https://hub.docker.com/_/nginx FROM nginx:stable-alpine AS runtime -COPY conf/nginx.vh.conf /etc/nginx/conf.d/default.conf +COPY chart/medea-demo/conf/nginx.vh.conf /etc/nginx/conf.d/default.conf COPY index.html /app/ COPY --from=dist /npm/node_modules/jason-alexlapa/ /app/js/ diff --git a/jason/demo/chart/.editorconfig b/jason/demo/chart/.editorconfig new file mode 100644 index 000000000..e415686bc --- /dev/null +++ b/jason/demo/chart/.editorconfig @@ -0,0 +1,10 @@ +[*.tpl] +indent_style = space +indent_size = 2 +max_line_length = off + +[*.txt] +max_line_length = off + +[*.yaml] +max_line_length = off diff --git a/jason/demo/chart/medea-demo/.helmignore b/jason/demo/chart/medea-demo/.helmignore new file mode 100644 index 000000000..b670f1919 --- /dev/null +++ b/jason/demo/chart/medea-demo/.helmignore @@ -0,0 +1,3 @@ +.DS_Store + +.gitignore diff --git a/jason/demo/chart/medea-demo/Chart.yaml b/jason/demo/chart/medea-demo/Chart.yaml new file mode 100644 index 000000000..5b3d7a7fc --- /dev/null +++ b/jason/demo/chart/medea-demo/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +name: medea-demo +version: 0.1.0 +appVersion: 0.1.0 diff --git a/jason/demo/conf/nginx.vh.conf b/jason/demo/chart/medea-demo/conf/nginx.vh.conf similarity index 73% rename from jason/demo/conf/nginx.vh.conf rename to jason/demo/chart/medea-demo/conf/nginx.vh.conf index 609fc100f..9d5cef011 100644 --- a/jason/demo/conf/nginx.vh.conf +++ b/jason/demo/chart/medea-demo/conf/nginx.vh.conf @@ -7,7 +7,11 @@ server { charset utf-8; location = /js/jason_alexlapa_bg.wasm { - types { } default_type "application/wasm"; + types { } default_type "application/wasm"; + } + + location ^~ /ws/ { + proxy_pass http://127.0.0.1:8080/; } # Disable unnecessary access logs. diff --git a/jason/demo/chart/medea-demo/default/tls.crt b/jason/demo/chart/medea-demo/default/tls.crt new file mode 100644 index 000000000..9b1e86a31 --- /dev/null +++ b/jason/demo/chart/medea-demo/default/tls.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDSTCCAjGgAwIBAgIUBk1VIG8FY4BvOKLE9OZQ6iafqTUwDQYJKoZIhvcNAQEL +BQAwNDEYMBYGA1UEAwwPbWVkZWEtZGVtby50ZXN0MRgwFgYDVQQKDA9tZWRlYS1k +ZW1vLnRlc3QwHhcNMTkwNzMwMTA1NjM3WhcNMjAwNzI5MTA1NjM3WjA0MRgwFgYD +VQQDDA9tZWRlYS1kZW1vLnRlc3QxGDAWBgNVBAoMD21lZGVhLWRlbW8udGVzdDCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJozX4Zh6duPwxe0OxYKvJJj +Wr6Xpx2fjllydlp6RkVlsovGOqKpno7FKtlKRZAHySoxB+EOq8TqPXhbSwuH6HHb +/zIpYfpmTu4Ea2rjL/7YEbqHa8Qt0zhAbAt2qW4Xx+T39Ms7UBRSoTx3qblCyXZo +7IsRUPciJe0cW6URv/13MJQrHH3LdpRqlHaX9DPPmCIZaPsGqGTKUXbxMYwJyWPV +/mub2BRyY7TGMeXtvxxFpeDjIkJlECWs/p00+5bnKlUjhQSaWTjSuU40OYRolgTG +WiNNSjO0RIRzQqR/smN6EYnSMWDRl+3UGN/nHF4wx8HKFVA/IBmQ6WS8qQPvEJUC +AwEAAaNTMFEwHQYDVR0OBBYEFF/TRH05CCMlcXGbhtJ6Tx05UsfWMB8GA1UdIwQY +MBaAFF/TRH05CCMlcXGbhtJ6Tx05UsfWMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI +hvcNAQELBQADggEBAB6LPycWOLH+SXjbdh3I3T68jYL/z8QJQFqzvmyaNA0dTvNo +0tcDVZq9drikRxI9Hy1esGcd6nmZGZOXSVyu44iDqW926uwcdXf/R0Lqek0cgz6p +ELlX2V9sy2eZrg8iKjhNqVS21dlGC11Jo9xRgn+3XU29P9Uf/cgHoXL8Gk0tU3u6 +hDN3Cv1aGaDbkbqFpDbjSvwr3C+6YVjWAWrNDjgpMEAWSkCGtfmRzmA5xKejjwrV +sRbl/x6a/3pwi8CLYEy8QW90ec+0op8dQa4Qvn81BH+sUnuNfMcKppiRBoDBgh2O ++R6oZyramGTFKz08ZZdW340G8GWJ5ZuHwWD0MdY= +-----END CERTIFICATE----- diff --git a/jason/demo/chart/medea-demo/default/tls.key b/jason/demo/chart/medea-demo/default/tls.key new file mode 100644 index 000000000..2ca470cb9 --- /dev/null +++ b/jason/demo/chart/medea-demo/default/tls.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCaM1+GYenbj8MX +tDsWCrySY1q+l6cdn45ZcnZaekZFZbKLxjqiqZ6OxSrZSkWQB8kqMQfhDqvE6j14 +W0sLh+hx2/8yKWH6Zk7uBGtq4y/+2BG6h2vELdM4QGwLdqluF8fk9/TLO1AUUqE8 +d6m5Qsl2aOyLEVD3IiXtHFulEb/9dzCUKxx9y3aUapR2l/Qzz5giGWj7BqhkylF2 +8TGMCclj1f5rm9gUcmO0xjHl7b8cRaXg4yJCZRAlrP6dNPuW5ypVI4UEmlk40rlO +NDmEaJYExlojTUoztESEc0Kkf7JjehGJ0jFg0Zft1Bjf5xxeMMfByhVQPyAZkOlk +vKkD7xCVAgMBAAECggEAFyGTt83iTcxgAKNJpcHQjckXqLWJHRl9Og/Aj0v+VJSv +1uXSj+oP3ezXw6avjq6MT6bxPqJ7w9s7g112gXFOvh25R2YLy4sjVfMVxf/0iC8T +Yb7EvLX/FFYdnw6a1ef9VWyYrQ/lsFbA1xhAPok1PWz55tafJaNauxng6X8jJLtL +01kiMbLzI4G/vl6y0uwhUBUiZtjBpEgUNzXErmQC5EaR7IkeIAveH4AhEBZGJi7k +HE0mL/+YMRQEBZUt+m4YlvoQK/Z0Wc0Q3dnIqhVZ+lyFnZXPvha+xrohejgs49r7 +us8orvW4SVRNEpWqMTLfsPgzt36sgjT4G8DylzwedQKBgQDHCdu99PDd1uHguZ5y +KO+WKJJHOC6Q5DDPntbvD+U40EjJSsZ89z+8kuzQ1bPjL2+APrJ/yjQjhu4ZgYN3 +E19CkyWqPEfDWBzQ4vtrsdN0l9sGwDCD/HRQBj1TcCDVgWCdMWk9GIn4SnA6UJI+ +aLGEk35cRANPxEbB0KWRb+thmwKBgQDGVJB7PDArJt54um/u5l43xJpPkOvRRXGg +fF0iKkE6PvzIuH1gFVwoBWF52RB5qf2XDyKIw5vdrn6ZcjgoAOlzb1LLIbpY1UtO +94JGkuoFBfGaG/W0pDBVouCl1y6iPXo0RCCuIJWOHKtkGKx4vqet8wFcTQmHwzfr +GDdSHIzRjwKBgQCAbiwMdnC1tGIrz5odr6xpB+Tbb7UcaSHV1nh56ZfPARb2S/mn +ySKnW2bTmhFpFsKrzckADEl4Yyhf7OIXg7iEDM7Q+fSUZ9awMsZox2XaZeI+iOTF +RbEHsf8AR+nn2oOs6qUtdxgPznh8KGE1Q/jHwyRWBMzeO5gsl6U+IymO4QKBgD+q +ec71nUjc62G6B6CbFve0Bw0vqmO9dSJdidAj3FiES8VrY+PqN3EpeQcSZTWJGjzZ +wO5CTNC26TD894Xv9QD3ZY6LvzQxFEG/NnTNSI5gQBSGkTNx2YpEBPV3xCKUtZv9 +mrgLAbdjAKnbOdJw8YbnkTI+EKciRdsUJP4Y6COFAoGAEyZPEX+aO2VyUTIdzxK0 +dujGGTMDidyY4HdyUyxko7fG5SP5cGXCBJBHqzw8IyPbKZW6Asz/wENGbJCfvM66 +7XDNHyYuHnvRaCikB/94PKozi1ESmkqF9+Z2c+n7Mk0K153NhT3hCNKPVeVziQ3c +9m/hx6m1SSWEYqqHbSTAAIc= +-----END PRIVATE KEY----- diff --git a/jason/demo/chart/medea-demo/templates/NOTES.txt b/jason/demo/chart/medea-demo/templates/NOTES.txt new file mode 100644 index 000000000..a986939ec --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/NOTES.txt @@ -0,0 +1,6 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls.enabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- end }} diff --git a/jason/demo/chart/medea-demo/templates/_helpers.tpl b/jason/demo/chart/medea-demo/templates/_helpers.tpl new file mode 100644 index 000000000..8744ba695 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/_helpers.tpl @@ -0,0 +1,29 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "medea-demo.name" -}} +{{- .Chart.Name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited +to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "medea-demo.fullname" -}} +{{- $name := include "medea-demo.name" . -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "medea-demo.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/jason/demo/chart/medea-demo/templates/configmap.server.yaml b/jason/demo/chart/medea-demo/templates/configmap.server.yaml new file mode 100644 index 000000000..a7b9a45bd --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/configmap.server.yaml @@ -0,0 +1,38 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ template "medea-demo.fullname" . }}.server.conf + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +data: + medea.toml: | + {{- $medeaConf := .Values.server.conf | toJson | fromJson }} + {{- $_ := unset $medeaConf.turn "pass" }} + {{- $_ := unset $medeaConf.turn.db.redis "pass" }} + {{- toToml $medeaConf | nindent 4 }} + + turnserver.conf: | + {{- $coturnConf := .Values.server.coturn.conf }} + lt-cred-mech + fingerprint + no-cli + no-tls + no-dtls + realm=medea + listening-port={{ $coturnConf.listening_port }} + + redis.conf: | + {{- $redisConf := index .Values "server" "coturn-db" "conf" | toJson | fromJson }} + {{- $_ := unset $redisConf "requirepass" }} + {{- range $name, $val := $redisConf }} + {{ $name }} {{ $val }} + {{- end }} diff --git a/jason/demo/chart/medea-demo/templates/configmap.web-client.yaml b/jason/demo/chart/medea-demo/templates/configmap.web-client.yaml new file mode 100644 index 000000000..09d57ad02 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/configmap.web-client.yaml @@ -0,0 +1,23 @@ +{{- $webClient := index .Values "web-client" -}} +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ template "medea-demo.fullname" . }}.web-client.conf + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: web-client + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +data: + nginx.vh.conf: | + {{- if $webClient.conf.nginx }} + {{- $webClient.conf.nginx | nindent 4 }} + {{- else }} + {{- tpl (.Files.Get "conf/nginx.vh.conf") . | nindent 4 }} + {{- end }} diff --git a/jason/demo/chart/medea-demo/templates/deployment.server.yaml b/jason/demo/chart/medea-demo/templates/deployment.server.yaml new file mode 100644 index 000000000..651f97923 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/deployment.server.yaml @@ -0,0 +1,181 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ template "medea-demo.fullname" . }}-server + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: 1 + revisionHistoryLimit: {{ .Values.server.deployment.revisionHistoryLimit }} + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/component: server + template: + metadata: + labels: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + {{- with .Values.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/conf: {{ pick (include (print $.Template.BasePath "/configmap.server.yaml") . | fromYaml) "data" | toYaml | sha256sum }} + checksum/cred: {{ pick (include (print $.Template.BasePath "/secret.server.yaml") . | fromYaml) "data" | toYaml | sha256sum }} + {{- with .Values.server.deployment.revision }} + revision: {{ . | quote }} + {{- end }} + {{- with .Values.server.deployment.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + {{- with .Values.server.deployment.affinity }} + affinity: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.server.deployment.tolerations }} + tolerations: {{- toYaml . | nindent 8 }} + {{- end }} + containers: + {{- $coturnDb := index .Values "server" "coturn-db" }} + {{- $coturn := .Values.server.coturn }} + - name: medea + image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}" + imagePullPolicy: {{ .Values.server.image.pullPolicy }} + env: + - name: MEDEA_CONF + value: /etc/medea.toml + - name: MEDEA_TURN.PORT + value: {{ $coturn.conf.listening_port | quote }} + - name: MEDEA_TURN.DB.REDIS.PORT + value: {{ $coturnDb.conf.port | quote }} + envFrom: + - secretRef: + name: {{ template "medea-demo.fullname" . }}.server.cred + ports: + - name: http + containerPort: {{ .Values.server.conf.server.bind_port }} + volumeMounts: + - name: conf + subPath: medea.toml + mountPath: /etc/medea.toml + readOnly: true + {{- with .Values.server.deployment.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + tcpSocket: + port: {{ .Values.server.conf.server.bind_port }} + initialDelaySeconds: 3 + readinessProbe: + tcpSocket: + port: {{ .Values.server.conf.server.bind_port }} + initialDelaySeconds: 5 + - name: coturn + image: "{{ $coturn.image.repository }}:{{ $coturn.image.tag }}" + imagePullPolicy: {{ $coturn.image.pullPolicy }} + command: ["turnserver"] + args: + - --log-file=stdout + - --external-ip=$(EXTERNAL_IP) + - --listening-ip=$(EXTERNAL_IP) + - --relay-ip=$(EXTERNAL_IP) + - --redis-userdb=ip=127.0.0.1 port={{ $coturnDb.conf.port }} dbname={{ .Values.server.conf.turn.db.redis.db_number }} password=$(MEDEA_TURN.DB.REDIS.PASS) + - --user={{ .Values.server.conf.turn.user }}:$(MEDEA_TURN.PASS) + {{- with $coturn.extraArgs }} + {{- toYaml . | nindent 12 }} + {{- end }} + env: + - name: EXTERNAL_IP + {{- if $coturn.conf.external_ip }} + value: {{ $coturn.conf.external_ip | quote }} + {{- else }} + valueFrom: + fieldRef: + fieldPath: status.hostIP + {{- end }} + - name: MEDEA_TURN.PASS + valueFrom: + secretKeyRef: + name: {{ template "medea-demo.fullname" . }}.server.cred + key: MEDEA_TURN.PASS + - name: MEDEA_TURN.DB.REDIS.PASS + valueFrom: + secretKeyRef: + name: {{ template "medea-demo.fullname" . }}.server.cred + key: MEDEA_TURN.DB.REDIS.PASS + ports: + - name: turn + containerPort: {{ $coturn.conf.listening_port }} + protocol: TCP + - name: turn-udp + containerPort: {{ $coturn.conf.listening_port }} + protocol: UDP + volumeMounts: + - name: conf + subPath: turnserver.conf + mountPath: /etc/coturn/turnserver.conf + readOnly: true + - name: coturn-data + mountPath: /var/lib/coturn + {{- with $coturn.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + tcpSocket: + port: {{ $coturn.conf.listening_port }} + initialDelaySeconds: 3 + readinessProbe: + tcpSocket: + port: {{ $coturn.conf.listening_port }} + initialDelaySeconds: 5 + - name: coturn-db + image: "{{ $coturnDb.image.repository }}:{{ $coturnDb.image.tag }}" + imagePullPolicy: {{ $coturnDb.image.pullPolicy }} + args: + - redis-server + - /etc/redis.conf + - --requirepass $(MEDEA_TURN.DB.REDIS.PASS) + env: + - name: MEDEA_TURN.DB.REDIS.PASS + valueFrom: + secretKeyRef: + name: {{ template "medea-demo.fullname" . }}.server.cred + key: MEDEA_TURN.DB.REDIS.PASS + volumeMounts: + - name: conf + subPath: redis.conf + mountPath: /etc/redis.conf + readOnly: true + {{- with $coturnDb.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + exec: + command: ['redis-cli', 'ping'] + initialDelaySeconds: 3 + readinessProbe: + exec: + command: ['redis-cli', 'ping'] + initialDelaySeconds: 5 + volumes: + - name: conf + configMap: + name: {{ template "medea-demo.fullname" . }}.server.conf + - name: coturn-data + emptyDir: {} diff --git a/jason/demo/chart/medea-demo/templates/deployment.web-client.yaml b/jason/demo/chart/medea-demo/templates/deployment.web-client.yaml new file mode 100644 index 000000000..c04860fd0 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/deployment.web-client.yaml @@ -0,0 +1,82 @@ +{{- $webClient := index .Values "web-client" -}} +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ template "medea-demo.fullname" . }}-web-client + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: web-client + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ $webClient.deployment.replicas }} + revisionHistoryLimit: {{ $webClient.deployment.revisionHistoryLimit }} +{{- if gt (int $webClient.deployment.replicas) 1 }} + strategy: + rollingUpdate: + maxSurge: 100% + maxUnavailable: 0 +{{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/component: web-client + template: + metadata: + labels: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: web-client + {{- with .Values.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/conf: {{ pick (include (print $.Template.BasePath "/configmap.web-client.yaml") . | fromYaml) "data" | toYaml | sha256sum }} + {{- with $webClient.deployment.revision }} + revision: {{ . | quote }} + {{- end }} + {{- with $webClient.deployment.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with $webClient.deployment.affinity }} + affinity: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $webClient.deployment.tolerations }} + tolerations: {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: demo + image: "{{ $webClient.image.repository }}:{{ $webClient.image.tag }}" + imagePullPolicy: {{ $webClient.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + volumeMounts: + - name: conf + subPath: nginx.vh.conf + mountPath: /etc/nginx/conf.d/default.conf + readOnly: true + {{- with $webClient.deployment.resources }} + resources: {{- toYaml . | nindent 12 }} + {{- end }} + livenessProbe: + tcpSocket: + port: 80 + readinessProbe: + tcpSocket: + port: 80 + initialDelaySeconds: 5 + volumes: + - name: conf + configMap: + name: {{ template "medea-demo.fullname" . }}.web-client.conf diff --git a/jason/demo/chart/medea-demo/templates/ingress.yaml b/jason/demo/chart/medea-demo/templates/ingress.yaml new file mode 100644 index 000000000..14429f5a7 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/ingress.yaml @@ -0,0 +1,53 @@ +{{- if .Values.ingress.enabled -}} +{{- range $i, $host := .Values.ingress.hosts }} +--- +kind: Ingress +apiVersion: networking.k8s.io/v1beta1 +metadata: + name: {{ template "medea-demo.fullname" $ }}.{{ $host }} + namespace: {{ $.Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" $ }} + app.kubernetes.io/name: {{ template "medea-demo.name" $ }} + app.kubernetes.io/instance: {{ $.Release.Name | quote }} + app.kubernetes.io/managed-by: {{ $.Release.Service | quote }} + app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }} + app.kubernetes.io/component: ingress + {{- with $.Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + annotations: + {{- if and $.Values.ingress.tls.enabled $.Values.ingress.tls.auto }} + kubernetes.io/tls-acme: "true" + {{- end }} + {{- if not $.Values.ingress.tls.enabled }} + nginx.ingress.kubernetes.io/ssl-redirect: "false" + {{- end }} + {{- with $.Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - host: {{ $host | quote }} + http: + paths: + - path: /ws + backend: + serviceName: {{ template "medea-demo.fullname" $ }}-server + servicePort: http + - path: / + backend: + serviceName: {{ template "medea-demo.fullname" $ }}-web-client + servicePort: http +{{- if $.Values.ingress.tls.enabled }} + tls: + - secretName: {{ if $.Values.ingress.tls.auto -}} + {{ printf "%s.tls" ($host | trunc 48) | quote }} + {{- else -}} + {{ required (print `TLS Secret name must be specified for host ` $host ` !`) (index $.Values.ingress.tls.secretName $host) | quote }} + {{- end }} + hosts: + - {{ $host | quote }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/jason/demo/chart/medea-demo/templates/secret.server.yaml b/jason/demo/chart/medea-demo/templates/secret.server.yaml new file mode 100644 index 000000000..1d11e69f2 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/secret.server.yaml @@ -0,0 +1,21 @@ +kind: Secret +apiVersion: v1 +metadata: + name: {{ template "medea-demo.fullname" . }}.server.cred + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +type: Opaque +data: + {{- $medeaConf := .Values.server.conf }} + {{- $coturnDbConf := index .Values "server" "coturn-db" "conf" }} + MEDEA_TURN.PASS: {{ $medeaConf.turn.pass | b64enc | quote }} + MEDEA_TURN.DB.REDIS.PASS: {{ $coturnDbConf.requirepass | b64enc | quote }} diff --git a/jason/demo/chart/medea-demo/templates/secret.tls.default.yaml b/jason/demo/chart/medea-demo/templates/secret.tls.default.yaml new file mode 100644 index 000000000..4d758c7cc --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/secret.tls.default.yaml @@ -0,0 +1,27 @@ +{{- if .Values.ingress.tls.enabled -}} +{{- if not .Values.ingress.tls.auto -}} +{{- if hasKey .Values.ingress.tls.secretName "medea-demo.test" -}} +{{- if eq (index .Values.ingress.tls.secretName "medea-demo.test") "medea-demo.test.tls" -}} +kind: Secret +apiVersion: v1 +metadata: + name: medea-demo.test.tls + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" $ }} + app.kubernetes.io/name: {{ template "medea-demo.name" $ }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: ingress + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +type: kubernetes.io/tls +data: + tls.crt: {{ .Files.Get "default/tls.crt" | b64enc | quote }} + tls.key: {{ .Files.Get "default/tls.key" | b64enc | quote }} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/jason/demo/chart/medea-demo/templates/service.server.yaml b/jason/demo/chart/medea-demo/templates/service.server.yaml new file mode 100644 index 000000000..424346717 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/service.server.yaml @@ -0,0 +1,25 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ template "medea-demo.fullname" . }}-server + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/component: server + ports: + - name: http + port: 80 + targetPort: {{ .Values.server.conf.server.bind_port }} + protocol: TCP diff --git a/jason/demo/chart/medea-demo/templates/service.web-client.yaml b/jason/demo/chart/medea-demo/templates/service.web-client.yaml new file mode 100644 index 000000000..5f53f58e1 --- /dev/null +++ b/jason/demo/chart/medea-demo/templates/service.web-client.yaml @@ -0,0 +1,25 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ template "medea-demo.fullname" . }}-web-client + namespace: {{ .Release.Namespace | quote }} + labels: + helm.sh/chart: {{ template "medea-demo.chart" . }} + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: web-client + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + app.kubernetes.io/name: {{ template "medea-demo.name" . }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/component: web-client + ports: + - name: http + port: 80 + targetPort: 80 + protocol: TCP diff --git a/jason/demo/chart/medea-demo/values.yaml b/jason/demo/chart/medea-demo/values.yaml new file mode 100644 index 000000000..ce1628bc2 --- /dev/null +++ b/jason/demo/chart/medea-demo/values.yaml @@ -0,0 +1,166 @@ +# Additional labels to apply to all Kubernetes resources created by this chart. +labels: {} + # app.kubernetes.io/part-of: frontend + + +server: + image: + repository: instrumentisto/medea + tag: latest + pullPolicy: IfNotPresent + + # Medea media server configuration: + # https://github.com/instrumentisto/medea/blob/master/config.toml + # NOTE: Options declared by 'coturn' and 'coturn-db' services below (like + # ports and passwords) are auto-wired and specifying them in this + # configuration will have no effect. + conf: + server: + bind_port: 8080 + turn: + user: USER + pass: PASS + db: + redis: + db_number: 0 + + deployment: + revisionHistoryLimit: 0 + + # Optional revision number that may used for fine-grained Deployment rollouts. + revision: "" + + annotations: {} + # kubernetes.io/change-cause=kubectl set ... + + affinity: {} + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: node-label-key + # operator: In + # values: ["node-label-value"] + + tolerations: [] + # - key: "node.alpha.kubernetes.io/unreachable" + # operator: "Exists" + # effect: "NoExecute" + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + coturn: + image: + repository: instrumentisto/coturn + tag: 4.5 + pullPolicy: IfNotPresent + + # Coturn TURN server configuration. + conf: + listening_port: 3478 + # IP adress to be used by Coturn as `external-ip`. + # If empty then `status.hostIP` of Pod will be used. + external_ip: "" + + extraArgs: [] + # - --verbose + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + coturn-db: + image: + repository: redis + tag: alpine + pullPolicy: IfNotPresent + + # Redis server configuration: + # http://download.redis.io/redis-stable/redis.conf + conf: + port: 6379 + requirepass: turn + timeout: 0 + tcp-keepalive: 60 + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + +web-client: + image: + repository: instrumentisto/medea-demo + tag: latest + pullPolicy: IfNotPresent + + conf: + # Optional custom Nginx vhost configuration. + nginx: "" + # nginx: | + # server { + # listen 80 default_server; + # ... + + deployment: + replicas: 1 + revisionHistoryLimit: 0 + + # Optional revision number that may used for fine-grained Deployment rollouts. + revision: "" + + annotations: {} + # kubernetes.io/change-cause=kubectl set ... + + affinity: {} + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: node-label-key + # operator: In + # values: ["node-label-value"] + + tolerations: [] + # - key: "node.alpha.kubernetes.io/unreachable" + # operator: "Exists" + # effect: "NoExecute" + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + +ingress: + enabled: yes + + hosts: + - medea-demo.test + + tls: + enabled: yes + auto: no + # Not required when "auto" is enabled. + secretName: + medea-demo.test: medea-demo.test.tls + + annotations: + kubernetes.io/ingress.class: nginx diff --git a/jason/demo/docker-compose.yml b/jason/demo/docker-compose.yml index ba13fabf5..b35e87d11 100644 --- a/jason/demo/docker-compose.yml +++ b/jason/demo/docker-compose.yml @@ -1,28 +1,29 @@ version: "2" services: - webclient: - container_name: demo-webclient + web-client: + container_name: demo-web-client image: instrumentisto/medea-demo:dev ports: - - "80:80" + - "80:80" # web-client http - "6379:6379" # coturn redis - "8080:8080" # medea ws volumes: - - ./conf/nginx.vh.conf:/etc/nginx/conf.d/default.conf + - ./chart/medea-demo/conf/nginx.vh.conf:/etc/nginx/conf.d/default.conf medea: container_name: demo-medea image: instrumentisto/medea:dev depends_on: ["coturn-db"] environment: MEDEA_LOG.LEVEL: "DEBUG" - network_mode: service:webclient + network_mode: service:web-client coturn: container_name: demo-coturn image: instrumentisto/coturn:4.5 depends_on: ["coturn-db"] command: - --log-file=stdout + #- --verbose volumes: - ../../dev/coturn/turnserver.conf:/etc/coturn/turnserver.conf:ro - ../../.cache/coturn/data:/var/lib/coturn @@ -33,4 +34,4 @@ services: command: ["redis-server", "/etc/redis.conf"] volumes: - ../../dev/coturn/redis.conf:/etc/redis.conf:ro - network_mode: service:webclient + network_mode: service:web-client diff --git a/jason/demo/index.html b/jason/demo/index.html index 868641d39..a03e00274 100644 --- a/jason/demo/index.html +++ b/jason/demo/index.html @@ -49,9 +49,8 @@