diff --git a/safe-helm-chart/.helmignore b/safe-helm-chart/.helmignore new file mode 100644 index 0000000..08fdeca --- /dev/null +++ b/safe-helm-chart/.helmignore @@ -0,0 +1,2 @@ +safe-wallet-web +README.md \ No newline at end of file diff --git a/safe-helm-chart/Chart.yaml b/safe-helm-chart/Chart.yaml new file mode 100644 index 0000000..9f2bf63 --- /dev/null +++ b/safe-helm-chart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gnosis-safe +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.0.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.0.0" diff --git a/safe-helm-chart/README.md b/safe-helm-chart/README.md new file mode 100644 index 0000000..dec5bd0 --- /dev/null +++ b/safe-helm-chart/README.md @@ -0,0 +1,20 @@ +This is a first attempt in deploying the Safe infrastructure in Kubernetes [specifically EKS] using Helm. + +### Notes + +- The k8s resources are set up in two groups basically. The common ones and the chain-specific ones. +The common ones are the common for all chains. +The chain-specific, are gathered in the `templates/chain-specific` folder. In order to set up the chains that you wanna use, go to +the `values.yaml` file. + + +- The custom storage class has been created in order to give the choice to preserve the volumes created by specific components. You can enable/disable it on demand in the `values.yaml` file. + + +- You can deploy the hem chart using +```commandline +helm upgrade --install mysafe ./safe-helm-chart --values values_for_alb_ingress.yaml +``` + + +- This is an early under heavy development version! Be kind :] \ No newline at end of file diff --git a/safe-helm-chart/nginx.conf b/safe-helm-chart/nginx.conf new file mode 100644 index 0000000..0d1aebc --- /dev/null +++ b/safe-helm-chart/nginx.conf @@ -0,0 +1,128 @@ +# https://github.com/KyleAMathews/docker-nginx/blob/master/nginx.conf +# https://linode.com/docs/web-servers/nginx/configure-nginx-for-optimized-performance/ +# https://docs.gunicorn.org/en/stable/deploy.html + +worker_processes 1; + +events { + worker_connections 2000; # increase if you have lots of clients + accept_mutex off; # set to 'on' if nginx worker_processes > 1 + use epoll; # Enable epoll for Linux 2.6+ + # 'use kqueue;' to enable for FreeBSD, OSX +} + +http { + include mime.types; + # fallback in case we can't determine a type + default_type application/octet-stream; + sendfile on; + + ## Transaction Service + upstream txs_app_server { + # ip_hash; # For load-balancing + # + # fail_timeout=0 means we always retry an upstream even if it failed + # to return a good HTTP response + server unix:/nginx-txs/gunicorn.socket fail_timeout=0; + + # for a TCP configuration + # server web:8000 fail_timeout=0; + keepalive 32; + } + + ## Config service + upstream cfg_app_server { + ip_hash; # For load-balancing + # server cfg-web:8001 fail_timeout=0; + server unix:/nginx-cfg/gunicorn.socket fail_timeout=0; + # + # fail_timeout=0 means we always retry an upstream even if it failed + # to return a good HTTP response + keepalive 32; + } + + ## Client gateway + upstream cgw_app_server { + ip_hash; # For load-balancing + server {{ include "safe.fullname" . }}-cgw-web:3000 fail_timeout=0; + # + # fail_timeout=0 means we always retry an upstream even if it failed + # to return a good HTTP response + keepalive 32; + } + + server { + access_log off; + listen 8000 deferred; + charset utf-8; + keepalive_timeout 75s; + + # https://thoughts.t37.net/nginx-optimization-understanding-sendfile-tcp-nodelay-and-tcp-nopush-c55cdd276765 + # tcp_nopush on; + # tcp_nodelay on; + + gzip on; + gzip_min_length 1000; + gzip_comp_level 2; + # text/html is always included by default + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml; + gzip_disable "MSIE [1-6]\."; + + ## Transaction service mounting point + location /txs/static { + alias /nginx-txs/staticfiles; + expires 365d; + } + + location /txs/ { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + # we don't want nginx trying to do something clever with + # redirects, we set the Host: header above already. + proxy_redirect off; + proxy_pass http://txs_app_server/; + + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Real-IP $remote_addr; + add_header Front-End-Https on; + } + + ## Config service mounting point + location /cfg/static { + alias /nginx-cfg/staticfiles; + expires 365d; + } + + location /cfg/ { + proxy_pass http://cfg_app_server/; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto; + add_header Front-End-Https on; + # we don't want nginx trying to do something clever with + # redirects, we set the Host: header above already. + proxy_redirect off; + # They default to 60s. Increase to avoid WORKER TIMEOUT in web container + proxy_connect_timeout 60s; + proxy_read_timeout 60s; + } + + ## Client gateway mounting point + location /cgw/ { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + # we don't want nginx trying to do something clever with + # redirects, we set the Host: header above already. + proxy_redirect off; + proxy_pass http://cgw_app_server/; + + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Real-IP $remote_addr; + add_header Front-End-Https on; + } + } +} diff --git a/safe-helm-chart/templates/_helpers.tpl b/safe-helm-chart/templates/_helpers.tpl new file mode 100644 index 0000000..1c28813 --- /dev/null +++ b/safe-helm-chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "safe.name" -}} +{{- default .Chart.Name .Values.nameOverride | 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 "safe.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "safe.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "safe.labels" -}} +helm.sh/chart: {{ include "safe.chart" . }} +{{ include "safe.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "safe.selectorLabels" -}} +app.kubernetes.io/name: {{ include "safe.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "safe.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "safe.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/safe-helm-chart/templates/chain-specific/cm-txs-env.yaml b/safe-helm-chart/templates/chain-specific/cm-txs-env.yaml new file mode 100644 index 0000000..d40ecd2 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/cm-txs-env.yaml @@ -0,0 +1,42 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} + +{{ $pg_password := $chainValues.txs_db_pg_password }} +{{ $pg_user := $chainValues.txs_db_pg_user }} +{{ $txs_external_pg_endpoint := $chainValues.txs_db_pg_endpoint }} +{{ $pg_dbname := $chainValues.txs_db_pg_dbname }} +{{ $pg_db_port := $chainValues.txs_db_pg_db_port }} + +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +data: + PYTHONPATH: /app/ + DJANGO_SETTINGS_MODULE: config.settings.production + DJANGO_SECRET_KEY: 'Very-secure-secret-string' + DEBUG: '0' + ETH_L2_NETWORK: '1' + + {{ if $txs_external_pg_endpoint }} + DATABASE_URL: psql://{{ $pg_user }}:{{ $pg_password }}@{{ $txs_external_pg_endpoint }}:{{ $pg_db_port }}/{{ $pg_dbname }} + {{ else }} + DATABASE_URL: psql://{{ $pg_user }}:{{ $pg_password }}@{{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db:{{ $pg_db_port }}/{{ $pg_dbname }} + {{ end }} + + REDIS_URL: redis://{{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis:6379/0 + CELERY_BROKER_URL: amqp://guest:guest@{{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq/ + DJANGO_ALLOWED_HOSTS: "*" + FORCE_SCRIPT_NAME: /txs/ + CSRF_TRUSTED_ORIGINS: "http://localhost:8000" + EVENTS_QUEUE_URL: amqp://{{ $releaseName }}-general-rabbitmq:5672 + EVENTS_QUEUE_ASYNC_CONNECTION: 'True' + EVENTS_QUEUE_EXCHANGE_NAME: "safe-transaction-service-events" + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-flower.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-flower.yaml new file mode 100644 index 0000000..6dfe41e --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-flower.yaml @@ -0,0 +1,45 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + # A flower is a web-based tool for monitoring and administrating Celery clusters. + # ref: https://medium.com/featurepreneur/flower-celery-monitoring-tool-50fba1c8f623 + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-flower + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-flower + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-flower + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-flower + image: safeglobal/safe-transaction-service:latest + command: ["docker/web/celery/flower/run.sh"] + ports: + - name: flower + containerPort: 5555 + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + - name: RUN_MIGRATIONS + value: "1" + - name: WORKER_QUEUES + value: default,indexing + #- name: ETHEREUM_TRACING_NODE_URL + # value: http://tracing-node-url + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +{{- end }} # if +{{- end }} # range diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-pgdb.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-pgdb.yaml new file mode 100644 index 0000000..6b738c8 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-pgdb.yaml @@ -0,0 +1,48 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} + +{{ $pg_password := $chainValues.txs_db_pg_password }} +{{ $pg_user := $chainValues.txs_db_pg_user }} +{{ $txs_external_pg_endpoint := $chainValues.txs_db_pg_endpoint }} +# if the chain is activated AND there is no external db endpoint set, then create the db pod +{{ if and $chainValues.enabled (ne $txs_external_pg_endpoint false) }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-db + image: postgres:14-alpine + # + env: + - name: POSTGRES_PASSWORD + value: {{ $pg_password }} + - name: POSTGRES_USER + value: {{ $pg_user }} + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + # + volumeMounts: + - name: txs-db-claim0 + mountPath: /var/lib/postgresql/data + subPath: txs-db-data + volumes: + - name: txs-db-claim0 + persistentVolumeClaim: + claimName: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db-claim0 +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-rabbitmq.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-rabbitmq.yaml new file mode 100644 index 0000000..ae37d78 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-rabbitmq.yaml @@ -0,0 +1,35 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-rabbitmq + image: rabbitmq:3.11.26-management + env: + - name: RABBITMQ_DEFAULT_USER + value: guest # Notice: change it if you'd like + - name: RABBITMQ_DEFAULT_PASS + value: guest # Notice: change it if you'd like + ports: + - name: rabbit-ui + containerPort: 15672 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-redis.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-redis.yaml new file mode 100644 index 0000000..d8ba7e7 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-redis.yaml @@ -0,0 +1,36 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-redis + image: redis:alpine + # +# livenessProbe: +# exec: +# command: +# - redis-cli +# - ping +# failureThreshold: 3 +# periodSeconds: 30 +# timeoutSeconds: 30 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-scheduler.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-scheduler.yaml new file mode 100644 index 0000000..a43d79b --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-scheduler.yaml @@ -0,0 +1,38 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-scheduler + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-scheduler + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-scheduler + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-scheduler + image: safeglobal/safe-transaction-service:latest + command: ["docker/web/celery/worker/run.sh"] + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + - name: RUN_MIGRATIONS + value: "1" + - name: WORKER_QUEUES + value: default,indexing + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-web.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-web.yaml new file mode 100644 index 0000000..2de2c8b --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-web.yaml @@ -0,0 +1,45 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-web + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-web + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-web + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-web + image: safeglobal/safe-transaction-service:latest + command: [ "docker/web/run_web.sh" ] + ports: + - name: txs-web-ui + containerPort: 8888 + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + workingDir: /app + volumeMounts: + - name: nginx-shared-txs + mountPath: /nginx-txs + volumes: + - name: nginx-shared-txs + persistentVolumeClaim: + claimName: {{ $releaseName }}-nginx-shared-txs + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-worker-contracts-tokens.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-contracts-tokens.yaml new file mode 100644 index 0000000..71c3eaa --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-contracts-tokens.yaml @@ -0,0 +1,36 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-contracts-tokens + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-contracts-tokens + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-contracts-tokens + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-worker-contracts-tokens + image: safeglobal/safe-transaction-service:latest + command: ["docker/web/celery/worker/run.sh"] + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + - name: WORKER_QUEUES + value: contracts,tokens + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-worker-indexer.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-indexer.yaml new file mode 100644 index 0000000..cff9368 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-indexer.yaml @@ -0,0 +1,38 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-indexer + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-indexer + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-indexer + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-worker-indexer + image: safeglobal/safe-transaction-service:latest + command: ["docker/web/celery/worker/run.sh"] + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + - name: RUN_MIGRATIONS + value: "1" + - name: WORKER_QUEUES + value: default,indexing + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/deploy-txs-worker-notifications-webhooks.yaml b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-notifications-webhooks.yaml new file mode 100644 index 0000000..9e71113 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/deploy-txs-worker-notifications-webhooks.yaml @@ -0,0 +1,36 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-notifications-webhooks + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-notifications-webhooks + template: + metadata: + labels: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-worker-notifications-webhooks + spec: + containers: + - name: {{ $chainValues.network_name | lower }}-txs-worker-notifications-webhooks + image: safeglobal/safe-transaction-service:latest + command: ["docker/web/celery/worker/run.sh"] + env: + - name: ETHEREUM_NODE_URL + value: {{ $chainValues.node_url }} + - name: WORKER_QUEUES + value: notifications,webhooks + envFrom: + - configMapRef: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-env + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/pvc-txs-pgdb-claim0.yaml b/safe-helm-chart/templates/chain-specific/pvc-txs-pgdb-claim0.yaml new file mode 100644 index 0000000..3274788 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/pvc-txs-pgdb-claim0.yaml @@ -0,0 +1,23 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ $txs_external_pg_endpoint := $chainValues.txs_db_pg_endpoint }} +# if the chain is activated AND there is no external db endpoint set, then create the svc +{{ if and $chainValues.enabled (ne $txs_external_pg_endpoint false) }} +--- +apiVersion: v1 + +kind: PersistentVolumeClaim + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db-claim0 + +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-flower.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-flower.yaml new file mode 100644 index 0000000..d2d0f7a --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-flower.yaml @@ -0,0 +1,22 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-flower + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-flower + ports: + - name: flower + protocol: TCP + port: 5555 + targetPort: 5555 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-pgdb.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-pgdb.yaml new file mode 100644 index 0000000..9113a1b --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-pgdb.yaml @@ -0,0 +1,24 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ $txs_external_pg_endpoint := $chainValues.txs_db_pg_endpoint }} +# if the chain is activated AND there is no external db endpoint set, then create the svc +{{ if and $chainValues.enabled (ne $txs_external_pg_endpoint false) }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-db + ports: + - name: postgres + protocol: TCP + port: 5432 + targetPort: 5432 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-rabbit-ui.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-rabbit-ui.yaml new file mode 100644 index 0000000..0797074 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-rabbit-ui.yaml @@ -0,0 +1,22 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbit-ui + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbit-ui + ports: + - name: rabbit-ui + protocol: TCP + port: 15672 + targetPort: 15672 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-rabbitmq.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-rabbitmq.yaml new file mode 100644 index 0000000..e914f6f --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-rabbitmq.yaml @@ -0,0 +1,22 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-rabbitmq + ports: + - name: rabbitmq + protocol: TCP + port: 5672 + targetPort: 5672 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-redis.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-redis.yaml new file mode 100644 index 0000000..3298086 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-redis.yaml @@ -0,0 +1,22 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-redis + ports: + - name: redis + protocol: TCP + port: 6379 + targetPort: 6379 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/chain-specific/svc-txs-web-ui.yaml b/safe-helm-chart/templates/chain-specific/svc-txs-web-ui.yaml new file mode 100644 index 0000000..db50586 --- /dev/null +++ b/safe-helm-chart/templates/chain-specific/svc-txs-web-ui.yaml @@ -0,0 +1,22 @@ +{{- $releaseName := .Release.Name }} # define the local var here + +{{- range $chain, $chainValues := .Values.chains }} +{{ if $chainValues.enabled }} +--- +apiVersion: v1 +kind: Service + +metadata: + name: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-web-ui + +spec: + selector: + app: {{ $releaseName }}-{{ $chainValues.network_name | lower }}-txs-web-ui + ports: + - name: txs-web-ui + protocol: TCP + port: 8888 + targetPort: 8888 + +{{- end }} # if +{{- end }} # range \ No newline at end of file diff --git a/safe-helm-chart/templates/cm-cfg-env.yaml b/safe-helm-chart/templates/cm-cfg-env.yaml new file mode 100644 index 0000000..e0a5be7 --- /dev/null +++ b/safe-helm-chart/templates/cm-cfg-env.yaml @@ -0,0 +1,41 @@ +--- +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ include "safe.fullname" . }}-cfg-env + +data: + PYTHONDONTWRITEBYTECODE: "true" + SECRET_KEY: "insecure_key_for_dev" + DEBUG: "true" + ROOT_LOG_LEVEL: "DEBUG" + # + # NGINX_HOST_PORT: 8080 + NGINX_ENVSUBST_OUTPUT_DIR: "/etc/nginx/" + DOCKER_NGINX_VOLUME_ROOT: "/nginx" + # + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_NAME: postgres + POSTGRES_HOST: {{ include "safe.fullname" . }}-cfg-db + POSTGRES_PORT: "5432" + DOCKER_WEB_VOLUME: ".:/app" + # + GUNICORN_WEB_RELOAD: "false" + GUNICORN_BIND_PORT: "8001" + GUNICORN_BIND_SOCKET: "unix:/nginx/gunicorn.socket" + # + DJANGO_SUPERUSER_PASSWORD: admin + DJANGO_SUPERUSER_USERNAME: root + DJANGO_SUPERUSER_EMAIL: test@example.com + DJANGO_OTP_ADMIN: "false" + DJANGO_ALLOWED_HOSTS: "*" + # + DEFAULT_FILE_STORAGE: django.core.files.storage.FileSystemStorage + FORCE_SCRIPT_NAME: "/cfg/" + CSRF_TRUSTED_ORIGINS: "http://localhost:8000" + MEDIA_URL: "http://localhost:8000/cfg/media/" + # + CGW_URL: http://{{ include "safe.fullname" . }}-nginx:8000/cgw + CGW_FLUSH_TOKEN: {{ .Values.tokens.common_token_1 }} \ No newline at end of file diff --git a/safe-helm-chart/templates/cm-cgw-env.yaml b/safe-helm-chart/templates/cm-cgw-env.yaml new file mode 100644 index 0000000..1cb398d --- /dev/null +++ b/safe-helm-chart/templates/cm-cgw-env.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ include "safe.fullname" . }}-cgw-env + +data: + # HTTP + HTTP_CLIENT_REQUEST_TIMEOUT_MILLISECONDS: "60000" + # Config Service + # The base url for the Safe Config Service + SAFE_CONFIG_BASE_URI: http://{{ include "safe.fullname" . }}-nginx:8000/cfg + # Exchange Rates + # The base Exchange Rate API to be used. + EXCHANGE_API_BASE_URI: "http://api.exchangeratesapi.io/v1" + EXCHANGE_API_KEY: "your_exchange_rate_api_token" + # Redis + # The host name of where the Redis instance is running + REDIS_HOST: {{ include "safe.fullname" . }}-cgw-redis + # The default port of where the Redis instance is running (default=6379) + #REDIS_PORT: 6379 + + # Cache Expiration Times + # The default cache expiration time in seconds if none is set (default=60) + # EXPIRATION_TIME_DEFAULT_SECONDS: + # DEFAULT_NOT_FOUND_EXPIRE_TIME_SECONDS: + # CONTRACT_NOT_FOUND_EXPIRE_TIME_SECONDS: + # TOKEN_NOT_FOUND_EXPIRE_TIME_SECONDS: + + # Privileged endpoint's authorization token + # The AUTH_TOKEN should always be set + AUTH_TOKEN: {{ .Values.tokens.common_token_1 }} + + # Log level + LOG_LEVEL: "info" + # LOG_SILENT: "true" + + # + ALERTS_PROVIDER_SIGNING_KEY: "ALERTS_PROVIDER_SIGNING_KEY_something" + ALERTS_PROVIDER_API_KEY: "ALERTS_PROVIDER_API_KEY_something" + ALERTS_PROVIDER_ACCOUNT: "ALERTS_PROVIDER_ACCOUNT_something" + ALERTS_PROVIDER_PROJECT: "ALERTS_PROVIDER_PROJECT_something" + + # + EMAIL_API_APPLICATION_CODE: "EMAIL_API_APPLICATION_CODE_something" + EMAIL_API_FROM_EMAIL: "some@email.com" + EMAIL_API_KEY: "EMAIL_API_KEY_something" + EMAIL_TEMPLATE_UNKNOWN_RECOVERY_TX: "EMAIL_TEMPLATE_UNKNOWN_RECOVERY_TX_something" \ No newline at end of file diff --git a/safe-helm-chart/templates/cm-events-env.yaml b/safe-helm-chart/templates/cm-events-env.yaml new file mode 100644 index 0000000..5c87750 --- /dev/null +++ b/safe-helm-chart/templates/cm-events-env.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ include "safe.fullname" . }}-events-env + +data: + DATABASE_URL: psql://postgres:postgres@{{ include "safe.fullname" . }}-events-db:5432/postgres + AMQP_URL: amqp://{{ include "safe.fullname" . }}-general-rabbitmq:5672 + AMQP_EXCHANGE: "safe-transaction-service-events" + AMQP_QUEUE: "safe-events-service" + ADMIN_EMAIL: "admin@safe" + ADMIN_PASSWORD: "password" + WEBHOOKS_CACHE_TTL: "300000" + NODE_ENV: "production" + URL_BASE_PATH: "/events" \ No newline at end of file diff --git a/safe-helm-chart/templates/cm-nginx-conf.yaml b/safe-helm-chart/templates/cm-nginx-conf.yaml new file mode 100644 index 0000000..e4df176 --- /dev/null +++ b/safe-helm-chart/templates/cm-nginx-conf.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ include "safe.fullname" . }}-nginx-conf + +data: + nginx.conf: |- +{{ tpl (.Files.Get "nginx.conf") $ | indent 4 }} diff --git a/safe-helm-chart/templates/cm-ui-env.yaml b/safe-helm-chart/templates/cm-ui-env.yaml new file mode 100644 index 0000000..5eee898 --- /dev/null +++ b/safe-helm-chart/templates/cm-ui-env.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: ConfigMap + +metadata: + name: {{ include "safe.fullname" . }}-ui-env + +data: + ### Required variables ### + NEXT_PUBLIC_INFURA_TOKEN: "" + NEXT_PUBLIC_GATEWAY_URL_PRODUCTION: http://localhost:8000/cgw + + # infura token used by Safe Apps + NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN: "" + + # Transaction simulation + NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL: "" + NEXT_PUBLIC_TENDERLY_PROJECT_NAME: "" + NEXT_PUBLIC_TENDERLY_ORG_NAME: "" + + # Flag to switch to the production environment (redirect urls, gateway url, etc) + NEXT_PUBLIC_IS_PRODUCTION: "true" + + ### Optional variables ### + # These variables are required only if you require a certain feature in the interface (e.g. Portis wallet) + # Or overwrite the fallback values (set a different WalletConnect bridge) + + # Latest supported safe version, used for upgrade prompts + NEXT_PUBLIC_SAFE_VERSION: "1.3.0" + + # Access keys + NEXT_PUBLIC_SENTRY_DSN: "" + NEXT_PUBLIC_BEAMER_ID: "" + + # Wallet specific variables + NEXT_PUBLIC_WC_PROJECT_ID: {{ .Values.wallets.wallet_connect_project_id }} + NEXT_PUBLIC_WC_BRIDGE: {{ .Values.wallets.wallet_connect_bridge }} + NEXT_PUBLIC_FORTMATIC_KEY: "" + NEXT_PUBLIC_PORTIS_KEY: "" + NEXT_PUBLIC_CYPRESS_MNEMONIC: "" + + NEXT_PUBLIC_GATEWAY_URL_STAGING: "" + + # sets the listener only for localhost + REVERSE_PROXY_UI_PORT: '8080' diff --git a/safe-helm-chart/templates/deploy-cfg-pgdb.yaml b/safe-helm-chart/templates/deploy-cfg-pgdb.yaml new file mode 100644 index 0000000..8b249b5 --- /dev/null +++ b/safe-helm-chart/templates/deploy-cfg-pgdb.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-cfg-db + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-cfg-db + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-cfg-db + spec: + containers: + - name: cfg-db + image: postgres:14-alpine + # +# livenessProbe: +# exec: +# command: +# - pg_isready -U postgres +# failureThreshold: 3 +# periodSeconds: 30 +# timeoutSeconds: 30 + # + env: + - name: POSTGRES_PASSWORD + value: {{ .Values.postgres.cfg_db.pg_password }} + - name: POSTGRES_USER + value: {{ .Values.postgres.cfg_db.pg_user }} + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + # + volumeMounts: + - name: cfg-db-claim0 + mountPath: /var/lib/postgresql/data + subPath: cfg-db-data + volumes: + - name: cfg-db-claim0 + persistentVolumeClaim: + claimName: {{ .Release.Name }}-cfg-db-claim0 \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-cfg-web.yaml b/safe-helm-chart/templates/deploy-cfg-web.yaml new file mode 100644 index 0000000..ffbee88 --- /dev/null +++ b/safe-helm-chart/templates/deploy-cfg-web.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-cfg-web + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-cfg-web + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-cfg-web + spec: + containers: + - name: cfg-web + tty: true + image: safeglobal/safe-config-service:latest + envFrom: + - configMapRef: + name: {{ include "safe.fullname" . }}-cfg-env + volumeMounts: + - name: nginx-conf-file-volume + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf # The name of the file to be placed + readOnly: true + volumes: + - name: nginx-conf-file-volume + configMap: + name: {{ include "safe.fullname" . }}-nginx-conf + items: + - key : nginx.conf # Name of the item inside the ConfigMap (under data:) + path: nginx.conf # Name of the file to be placed inside the pod \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-cgw-redis.yaml b/safe-helm-chart/templates/deploy-cgw-redis.yaml new file mode 100644 index 0000000..d89f977 --- /dev/null +++ b/safe-helm-chart/templates/deploy-cgw-redis.yaml @@ -0,0 +1,28 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-cgw-redis + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-cgw-redis + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-cgw-redis + spec: + containers: + - name: cgw-redis + image: redis:alpine +# livenessProbe: +# exec: +# command: +# - redis-cli +# - ping +# failureThreshold: 3 +# periodSeconds: 30 +# timeoutSeconds: 30 \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-cgw-web.yaml b/safe-helm-chart/templates/deploy-cgw-web.yaml new file mode 100644 index 0000000..42d5472 --- /dev/null +++ b/safe-helm-chart/templates/deploy-cgw-web.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-cgw-web + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-cgw-web + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-cgw-web + spec: + containers: + - name: cgw-web + image: safeglobal/safe-client-gateway-nest:latest + envFrom: + - configMapRef: + name: {{ include "safe.fullname" . }}-cgw-env \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-events-pgdb.yaml b/safe-helm-chart/templates/deploy-events-pgdb.yaml new file mode 100644 index 0000000..ae9b5ef --- /dev/null +++ b/safe-helm-chart/templates/deploy-events-pgdb.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-events-db + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-events-db + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-events-db + spec: + containers: + - name: events-db + image: postgres:14-alpine + # +# livenessProbe: +# exec: +# command: +# - pg_isready -U postgres +# failureThreshold: 3 +# periodSeconds: 30 +# timeoutSeconds: 30 + # + env: + - name: POSTGRES_PASSWORD + value: {{ .Values.postgres.events_db.pg_password }} + - name: POSTGRES_USER + value: {{ .Values.postgres.events_db.pg_user }} + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + # + volumeMounts: + - name: events-db-claim0 + mountPath: /var/lib/postgresql/data + subPath: events-db-data + volumes: + - name: events-db-claim0 + persistentVolumeClaim: + claimName: {{ .Release.Name }}-events-db-claim0 \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-events-web.yaml b/safe-helm-chart/templates/deploy-events-web.yaml new file mode 100644 index 0000000..fa31ee9 --- /dev/null +++ b/safe-helm-chart/templates/deploy-events-web.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-events-web + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-events-web + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-events-web + spec: + containers: + - name: events-web + image: safeglobal/safe-events-service:latest + envFrom: + - configMapRef: + name: {{ include "safe.fullname" . }}-events-env diff --git a/safe-helm-chart/templates/deploy-general-rabbitmq.yaml b/safe-helm-chart/templates/deploy-general-rabbitmq.yaml new file mode 100644 index 0000000..4061f89 --- /dev/null +++ b/safe-helm-chart/templates/deploy-general-rabbitmq.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-general-rabbitmq + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-general-rabbitmq + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-general-rabbitmq + spec: + containers: + - name: general-rabbitmq + image: rabbitmq:3.11.26-management + env: + - name: RABBITMQ_DEFAULT_USER + value: guest # Notice: change it if you'd like + - name: RABBITMQ_DEFAULT_PASS + value: guest # Notice: change it if you'd like + ports: + - name: rabbit-ui + containerPort: 15672 +# livenessProbe: +# exec: +# command: +# - rabbitmq-diagnostics -q ping +# failureThreshold: 3 +# initialDelaySeconds: 15 +# periodSeconds: 15 +# timeoutSeconds: 30 \ No newline at end of file diff --git a/safe-helm-chart/templates/deploy-nginx.yaml b/safe-helm-chart/templates/deploy-nginx.yaml new file mode 100644 index 0000000..5ada25a --- /dev/null +++ b/safe-helm-chart/templates/deploy-nginx.yaml @@ -0,0 +1,43 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-nginx + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-nginx + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-nginx + spec: + containers: + - name: nginx + image: nginx:alpine + # + ports: + - containerPort: 8000 + protocol: TCP + # + volumeMounts: + - name: nginx-conf-file-volume + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf # The name of the file to be placed + readOnly: true + - name: nginx-shared-txs + mountPath: /nginx-txs + volumes: + - name: nginx-conf-file-volume + configMap: + name: {{ include "safe.fullname" . }}-nginx-conf + items: + - key : nginx.conf # Name of the item inside the ConfigMap (under data:) + path: nginx.conf # Name of the file to be placed inside the pod + - name: nginx-shared-txs + persistentVolumeClaim: + claimName: {{ .Release.Name }}-nginx-shared-txs + diff --git a/safe-helm-chart/templates/deploy-ui.yaml b/safe-helm-chart/templates/deploy-ui.yaml new file mode 100644 index 0000000..c6c0b69 --- /dev/null +++ b/safe-helm-chart/templates/deploy-ui.yaml @@ -0,0 +1,34 @@ +--- +apiVersion: apps/v1 +kind: Deployment + +metadata: + name: {{ include "safe.fullname" . }}-ui + +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "safe.fullname" . }}-ui + template: + metadata: + labels: + app: {{ include "safe.fullname" . }}-ui + spec: + containers: + - name: ui + image: {{ .Values.images.ui }} +# livenessProbe: +# exec: +# command: +# - ----something here---- +# failureThreshold: 3 +# initialDelaySeconds: 420 # 7 minutes, yeah the UI takes it's time to start ... +# periodSeconds: 60 +# timeoutSeconds: 30 + ports: + - name: port3000 + containerPort: 3000 + envFrom: + - configMapRef: + name: {{ include "safe.fullname" . }}-ui-env \ No newline at end of file diff --git a/safe-helm-chart/templates/ingress-ui.yaml b/safe-helm-chart/templates/ingress-ui.yaml new file mode 100644 index 0000000..7d6a9b8 --- /dev/null +++ b/safe-helm-chart/templates/ingress-ui.yaml @@ -0,0 +1,27 @@ +apiVersion: networking.k8s.io/v1 + +kind: Ingress + +metadata: + name: {{ include "safe.fullname" . }}-ui-ing + + annotations: + {{- range $k, $v := .Values.ingress.annotations }} + {{ $k }}: {{ $v | quote }} + {{ end }} + +spec: + # notice: ref: https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/ + ingressClassName: {{ .Values.ingress.ingressClassName }} + + rules: + - host: {{ .Values.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "safe.fullname" . }}-ui + port: + number: {{ .Values.ingress.target_svc_port }} \ No newline at end of file diff --git a/safe-helm-chart/templates/pv-ebs-storage-class.yaml b/safe-helm-chart/templates/pv-ebs-storage-class.yaml new file mode 100644 index 0000000..a65ee8e --- /dev/null +++ b/safe-helm-chart/templates/pv-ebs-storage-class.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: storage.k8s.io/v1 + +kind: StorageClass + +metadata: + name: {{ .Release.Name }}-ebs-retain-volumes + +reclaimPolicy: {{ .Values.custom_storage_class.reclaimPolicy }} # Delete/Retain + +provisioner: kubernetes.io/aws-ebs # change it to your liking +parameters: # parameters specific for AWS EBS provisioner + fsType: ext4 + type: gp2 diff --git a/safe-helm-chart/templates/pvc-cfg-pgdb-claim0.yaml b/safe-helm-chart/templates/pvc-cfg-pgdb-claim0.yaml new file mode 100644 index 0000000..5108342 --- /dev/null +++ b/safe-helm-chart/templates/pvc-cfg-pgdb-claim0.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 + +kind: PersistentVolumeClaim + +metadata: + name: {{ .Release.Name }}-cfg-db-claim0 + +spec: + storageClassName: {{ .Release.Name }}-ebs-retain-volumes + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi diff --git a/safe-helm-chart/templates/pvc-events-pgdb-claim0.yaml b/safe-helm-chart/templates/pvc-events-pgdb-claim0.yaml new file mode 100644 index 0000000..3f422ef --- /dev/null +++ b/safe-helm-chart/templates/pvc-events-pgdb-claim0.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 + +kind: PersistentVolumeClaim + +metadata: + name: {{ .Release.Name }}-events-db-claim0 + +spec: + storageClassName: {{ .Release.Name }}-ebs-retain-volumes + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi \ No newline at end of file diff --git a/safe-helm-chart/templates/pvc-nginx-shared-txs.yaml b/safe-helm-chart/templates/pvc-nginx-shared-txs.yaml new file mode 100644 index 0000000..52911ea --- /dev/null +++ b/safe-helm-chart/templates/pvc-nginx-shared-txs.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 + +kind: PersistentVolumeClaim + +metadata: + name: {{ .Release.Name }}-nginx-shared-txs + +spec: + storageClassName: {{ .Release.Name }}-ebs-retain-volumes + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi diff --git a/safe-helm-chart/templates/svc-cfg-pgdb.yaml b/safe-helm-chart/templates/svc-cfg-pgdb.yaml new file mode 100644 index 0000000..8c5747b --- /dev/null +++ b/safe-helm-chart/templates/svc-cfg-pgdb.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-cfg-db + +spec: + selector: + app: {{ include "safe.fullname" . }}-cfg-db + ports: + - name: postgres + protocol: TCP + port: 5432 + targetPort: 5432 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-cgw-redis.yaml b/safe-helm-chart/templates/svc-cgw-redis.yaml new file mode 100644 index 0000000..4ddba8e --- /dev/null +++ b/safe-helm-chart/templates/svc-cgw-redis.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-cgw-redis + +spec: + selector: + app: {{ include "safe.fullname" . }}-cgw-redis + ports: + - name: redis + protocol: TCP + port: 6379 + targetPort: 6379 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-cgw-web.yaml b/safe-helm-chart/templates/svc-cgw-web.yaml new file mode 100644 index 0000000..beaab2c --- /dev/null +++ b/safe-helm-chart/templates/svc-cgw-web.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-cgw-web + +spec: + selector: + app: {{ include "safe.fullname" . }}-cgw-web + ports: + - name: cgw-web + protocol: TCP + port: 3000 + targetPort: 3000 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-events-pgdb.yaml b/safe-helm-chart/templates/svc-events-pgdb.yaml new file mode 100644 index 0000000..ce8c60d --- /dev/null +++ b/safe-helm-chart/templates/svc-events-pgdb.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-events-db + +spec: + selector: + app: {{ include "safe.fullname" . }}-events-db + ports: + - name: postgres + protocol: TCP + port: 5432 + targetPort: 5432 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-nginx.yaml b/safe-helm-chart/templates/svc-nginx.yaml new file mode 100644 index 0000000..57c37d4 --- /dev/null +++ b/safe-helm-chart/templates/svc-nginx.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-nginx + +spec: + selector: + app: {{ include "safe.fullname" . }}-nginx + ports: + - name: "8000" + protocol: TCP + port: 8000 + targetPort: 8000 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-rabbit-ui.yaml b/safe-helm-chart/templates/svc-rabbit-ui.yaml new file mode 100644 index 0000000..406a46c --- /dev/null +++ b/safe-helm-chart/templates/svc-rabbit-ui.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-rabbit-ui + +spec: + selector: + app: {{ include "safe.fullname" . }}-rabbit-ui + ports: + - name: rabbit-ui + protocol: TCP + port: 15672 + targetPort: 15672 \ No newline at end of file diff --git a/safe-helm-chart/templates/svc-ui.yaml b/safe-helm-chart/templates/svc-ui.yaml new file mode 100644 index 0000000..1d89893 --- /dev/null +++ b/safe-helm-chart/templates/svc-ui.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 + +kind: Service + +metadata: + name: {{ include "safe.fullname" . }}-ui + +spec: + selector: + app: {{ include "safe.fullname" . }}-ui + ports: + - name: https + protocol: TCP + port: 443 # the port we want to reach our app from ingress + targetPort: 3000 # the port the app is listening on \ No newline at end of file diff --git a/safe-helm-chart/values.yaml b/safe-helm-chart/values.yaml new file mode 100644 index 0000000..4f3a6cb --- /dev/null +++ b/safe-helm-chart/values.yaml @@ -0,0 +1,77 @@ +images: # ref : https://github.com/safe-global/safe-infrastructure#setup + # + ui: safeglobal/safe-wallet-web:latest # Notice: needs to be rebuilt in order to listen on 0.0.0.0:3000 + +chains: + zora: + enabled: true + network_name: "ZoraGoerli" + node_url: "https://testnet.rpc.zora.energy" + txs_db_pg_password: postgres + txs_db_pg_user: postgres + # if the chain is activated AND there is no external db endpoint set, the db pod will be created + txs_db_pg_endpoint: # leave empty unless an external service is to be used [eg AWS RDS] + txs_db_pg_dbname: postgres + txs_db_pg_db_port: 5432 + mantle: + enabled: false + network_name: "MantleGoerli" + node_url: "https://rpc.testnet.mantle.xyz" + txs_db_pg_password: postgres + txs_db_pg_user: postgres + # if the chain is activated AND there is no external db endpoint set, the db pod will be created + txs_db_pg_endpoint: # leave empty unless an external service is to be used [eg AWS RDS] + txs_db_pg_dbname: postgres + txs_db_pg_db_port: 5432 + base: + enabled: false + network_name: "BaseGoerli" + node_url: "https://goerli.base.org" + txs_db_pg_password: postgres + txs_db_pg_user: postgres + # if the chain is activated AND there is no external db endpoint set, the db pod will be created + txs_db_pg_endpoint: # leave empty unless an external service is to be used [eg AWS RDS] + txs_db_pg_dbname: postgres + txs_db_pg_db_port: 5432 + avalanche: + enabled: false + network_name: "Fuji" + node_url: "https://avalanche-fuji.drpc.org/" + txs_db_pg_password: postgres + txs_db_pg_user: postgres + # if the chain is activated AND there is no external db endpoint set, the db pod will be created + txs_db_pg_endpoint: # leave empty unless an external service is to be used [eg AWS RDS] + txs_db_pg_dbname: postgres + txs_db_pg_db_port: 5432 +# some-other-chain: +# enabled: false # true/false +# network_name: "...." +# node_url: "...." +# txs_db_pg_password: postgres +# txs_db_pg_user: postgres +# # if the chain is activated AND there is no external db endpoint set, the db pod will be created +# txs_db_pg_endpoint: # leave empty unless an external service is to be used [eg AWS RDS] +# txs_db_pg_dbname: postgres +# txs_db_pg_db_port: 5432 + +postgres: + cfg_db: + pg_password: postgres + pg_user: postgres + events_db: + pg_password: postgres + pg_user: postgres + +tokens: + common_token_1: "MUST_BE_THE_SAME_BETWEEN_CGW_FLUSH_TOKEN_&_AUTH_TOKEN" + +wallets: + wallet_connect_project_id: "something" + wallet_connect_bridge: "something" + +# Note: +# For dev purposes, the reclaim policy for the PVs can be set to -Delete-, so if/when the deployed release is deleted, +# anything saved in the PVs will be also deleted. +# If it is set to -Retain-, the volumes will not be deleted, so watch out for unused volumes pilling up :] +custom_storage_class: + reclaimPolicy: Delete # Delete/Retain \ No newline at end of file diff --git a/safe-helm-chart/values_for_alb_ingress.yaml b/safe-helm-chart/values_for_alb_ingress.yaml new file mode 100644 index 0000000..f8f7e3a --- /dev/null +++ b/safe-helm-chart/values_for_alb_ingress.yaml @@ -0,0 +1,29 @@ +ingress: + ingressClassName: "alb" + host: some-special-subdomain.your-domain.com # notice : change this to yours + target_svc_port : 443 + + # Troubleshoot ALB ingress controller + # https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html + annotations: + # notice: Documentation about the annotations + # ref: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#healthcheck-protocol + alb.ingress.kubernetes.io/load-balancer-name: my-special-alb # notice : change this to yours + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/group.name: my-special-ingress-group # notice : change this to yours + alb.ingress.kubernetes.io/target-type: ip + + # Certs + alb.ingress.kubernetes.io/certificate-arn: .... # notice : change this to yours + # https redirection + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' + alb.ingress.kubernetes.io/ssl-redirect: '443' # outside world -> service[443] -> container[3000] + + # notice: ALB healthcheck details + # ref: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html + alb.ingress.kubernetes.io/healthcheck-protocol: HTTP + #alb.ingress.kubernetes.io/healthcheck-path : eg /v1/health + alb.ingress.kubernetes.io/healthcheck-interval-seconds: '30' # notice : change this to yours + + # + alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=600 # notice : change this to yours \ No newline at end of file