Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Jul 23, 2024
1 parent 812da8f commit 76693c1
Show file tree
Hide file tree
Showing 44 changed files with 1,362 additions and 988 deletions.
32 changes: 32 additions & 0 deletions charts/composer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: v2
name: composer
description: Astria composer helm chart

# 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.1.0

# 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.1.0"

maintainers:
- name: wafflesvonmaple
url: astria.org
- name: quasystaty1
url: astria.org
- name: joroshiba
url: astria.org
26 changes: 26 additions & 0 deletions charts/composer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{/*
Namepsace to deploy elements into.
*/}}
{{- define "composer.namespace" -}}
{{- default .Release.Namespace .Values.global.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Single entry of rollup names
*/}}
{{- define "composer.rollupDefinition" }}
{{ .name }}::{{ .wsRpc }}
{{- end}}

{{/*
Rollup config string
*/}}
{{- define "composer.rollups" }}
{{- range $index, $element := .Values.config.rollups }}
{{- if $index }},{{- end }}{{- tpl (include "composer.rollupDefinition" $element) $ }}
{{- end }}
{{- end }}

{{- define "composer.image" -}}
{{ .Values.images.composer.repo }}:{{ if .Values.global.dev }}{{ .Values.images.composer.devTag }}{{ else }}{{ .Values.images.composer.tag }}{{ end }}
{{- end }}
46 changes: 46 additions & 0 deletions charts/composer/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: composer-env
namespace: {{ include "composer.namespace" . }}
data:
ASTRIA_COMPOSER_LOG: "astria_composer={{ .Values.config.logLevel }}"
ASTRIA_COMPOSER_API_LISTEN_ADDR: "0.0.0.0:{{ .Values.ports.healthApi }}"
ASTRIA_COMPOSER_GRPC_ADDR: "0.0.0.0:{{ .Values.ports.grpc }}"
ASTRIA_COMPOSER_SEQUENCER_CHAIN_ID: "{{ tpl .Values.config.sequencerChainId . }}"
ASTRIA_COMPOSER_SEQUENCER_URL: "{{ tpl .Values.config.sequencerRpc . }}"
ASTRIA_COMPOSER_ROLLUPS: "{{ include "composer.rollups" . }}"
ASTRIA_COMPOSER_PRIVATE_KEY_FILE: "/var/secrets/{{ .Values.config.privateKey.secret.filename }}"
ASTRIA_COMPOSER_MAX_BYTES_PER_BUNDLE: "{{ .Values.config.maxBytesPerBundle }}"
ASTRIA_COMPOSER_BUNDLE_QUEUE_CAPACITY: "{{ .Values.config.bundleQueueCapacity }}"
ASTRIA_COMPOSER_MAX_SUBMIT_INTERVAL_MS: "{{ .Values.config.maxSubmitInterval }}"
ASTRIA_COMPOSER_SEQUENCER_ADDRESS_PREFIX: "{{ .Values.config.sequencerAddressPrefix}}"
ASTRIA_COMPOSER_FEE_ASSET: "{{ .Values.config.sequencerNativeAssetBaseDenomination }}"
ASTRIA_COMPOSER_NO_METRICS: "{{ not .Values.metrics.enabled }}"
ASTRIA_COMPOSER_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.metrics }}"
ASTRIA_COMPOSER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
NO_COLOR: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_NO_OTEL: "{{ not .Values.otel.enabled }}"
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ tpl .Values.otel.endpoint . }}"
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "{{ tpl .Values.otel.tracesEndpoint . }}"
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: "{{ tpl .Values.otel.tracesTimeout . }}"
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: "{{ tpl .Values.otel.tracesCompression . }}"
OTEL_EXPORTER_OTLP_HEADERS: "{{ tpl .Values.otel.otlpHeaders . }}"
OTEL_EXPORTER_OTLP_TRACE_HEADERS: "{{ tpl .Values.otel.traceHeaders . }}"
OTEL_SERVICE_NAME: "{{ tpl .Values.otel.serviceName . }}"
{{- if not .Values.global.dev }}
{{- else }}
{{- end }}
---
{{- if not .Values.secretProvider.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ include "composer.namespace" . }}
name: sequencer-private-key
data:
{{ .Values.config.privateKey.secret.filename }}: |
{{ .Values.config.privateKey.devContent }}
---
{{- end }}
60 changes: 60 additions & 0 deletions charts/composer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: composer
namespace: {{ include "composer.namespace" . }}
labels:
app: composer
spec:
replicas: {{ .Values.global.replicaCount }}
selector:
matchLabels:
app: composer
template:
metadata:
labels:
app: composer
spec:
containers:
- name: composer
image: {{ include "composer.image" . }}
command: ["/usr/local/bin/astria-composer"]
stdin: {{ .Values.global.useTTY }}
tty: {{ .Values.global.useTTY }}
envFrom:
- configMapRef:
name: composer-env
volumeMounts:
- mountPath: "/var/secrets"
name: sequencer-private-key
startupProbe:
httpGet:
path: /readyz
port: {{ .Values.ports.healthApi }}
readinessProbe:
httpGet:
path: /readyz
port: {{ .Values.ports.healthApi }}
ports:
{{- if .Values.metrics.enabled }}
- containerPort: {{ .Values.ports.metrics }}
name: metrics
{{- end }}
- containerPort: {{ .Values.ports.healthApi }}
name: health-api
- containerPort: {{ .Values.ports.grpc }}
name: grpc
resources:
{{- toYaml .Values.resources | trim | nindent 12 }}
volumes:
- name: sequencer-private-key
{{- if .Values.secretProvider.enabled }}
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: sequencer-private-key
{{- else }}
configMap:
name: sequencer-private-key
{{- end }}
13 changes: 13 additions & 0 deletions charts/composer/templates/secretproviderclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
{{- if .Values.secretProvider.enabled }}
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: sequencer-private-key
spec:
provider: {{ .Values.secretProvider.provider }}
parameters:
{{- $_ := set $ "key" .Values.config.privateKey.secret }}
{{- tpl $.Values.secretProvider.parametersTemplate $ | nindent 4 }}
---
{{- end }}
29 changes: 29 additions & 0 deletions charts/composer/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
kind: Service
apiVersion: v1
metadata:
name: composer-service
namespace: {{ include "composer.namespace" . }}
spec:
selector:
app: composer
ports:
- name: grpc
port: {{ .Values.ports.grpc }}
targetPort: grpc
---
{{- if .Values.metrics.enabled }}
kind: Service
apiVersion: v1
metadata:
name: metrics
namespace: {{ include "composer.namespace" . }}
labels:
app: composer
spec:
selector:
app: composer
ports:
- name: metrics
port: {{ .Values.ports.metrics }}
targetPort: geth-metr
{{- end }}
27 changes: 27 additions & 0 deletions charts/composer/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: composer-metrics
labels:
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: composer-metrics
namespaceSelector:
matchNames:
- {{ include "composer.namespace" . }}
selector:
matchLabels:
app: composer
endpoints:
- port: metrics
path: /
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}
75 changes: 75 additions & 0 deletions charts/composer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
global:
namespaceOverride: ""
replicaCount: 1
# Whether to use tty readable logging for astria services, when false use json.
useTTY: false
dev: false

images:
composer:
repo: ghcr.io/astriaorg/composer
tag: "0.8.0"
devTag: latest

config:
logLevel: "debug"
maxBytesPerBundle: 200000
bundleQueueCapacity: 40000
maxSubmitInterval: 2000
sequencerAddressPrefix: astria
sequencerNativeAssetBaseDenomination: "nria"
sequencerRpc: ""
sequencerChainId: ""
privateKey:
devContent: ""
secret:
filename: "key.hex"
resourceName: "projects/$PROJECT_ID/secrets/sequencerPrivateKey/versions/latest"
rollups:
- name: "astria"
wsRpc: "ws://"

otel:
enabled: false
serviceName: "composer"
endpoint: ""
tracesEndpoint: ""
tracesCompression: "gzip"
tracesTimeout: "10"
otlpHeaders: ""
traceHeaders: ""

metrics:
enabled: false

serviceMonitor:
# set to enable port svc and service monitor
enabled: false
port: 6060
additionalLabels:
release: kube-prometheus-stack

# When deploying in a production environment should use a secret provider
# This is configured for use with GCP, need to set own resource names
# and keys
secretProvider:
enabled: false
provider: gcp
parametersTemplate: |-
secrets: |
- resourceName: {{ .key.resourceName }}
fileName: "{{ .key.filename }}"
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1000m
memory: 1Gi

# Default service ports
ports:
grpc: 50052
healthApi: 2450
metrics: 6060
35 changes: 17 additions & 18 deletions charts/deploy.just
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,21 @@ wait-for-sequencer:
kubectl wait -n astria-dev-cluster deployment celestia-local --for=condition=Available=True --timeout=600s
kubectl rollout status --watch statefulset/sequencer -n astria-dev-cluster --timeout=600s

deploy-rollup: deploy-dev-rollup deploy-bridge-withdrawer wait-for-rollup
deploy-rollup: deploy-dev-rollup wait-for-rollup
wait-for-rollup: wait-for-dev-rollup wait-for-bridge-withdrawer
delete-rollup: delete-dev-rollup delete-bridge-withdrawer
delete-rollup: delete-dev-rollup

defaultRollupName := "astria"
defaultNetworkId := ""
defaultPrivateKey := ""
defaultSequencerStartBlock := ""
deploy-dev-rollup rollupName=defaultRollupName networkId=defaultNetworkId:
helm dependency update charts/evm-rollup > /dev/null
helm dependency update charts/evm-stack > /dev/null
helm install \
{{ if rollupName != '' { replace('--set config.rollup.name=# --set celestia-node.config.labelPrefix=#', '#', rollupName) } else { '' } }} \
{{ if networkId != '' { replace('--set config.rollup.networkId=#', '#', networkId) } else { '' } }} \
-f dev/values/rollup/dev.yaml \
{{rollupName}}-chain-chart ./charts/evm-rollup --namespace astria-dev-cluster
{{rollupName}}-chain-chart ./charts/evm-stack --namespace astria-dev-cluster

delete-dev-rollup rollupName=defaultRollupName:
@just delete chart {{rollupName}}-chain
Expand Down Expand Up @@ -156,41 +156,40 @@ deploy-smoke-test tag=defaultTag:
@just wait-for-ingress-controller > /dev/null
@echo "Deploying local celestia instance..." && just deploy celestia-local > /dev/null
@helm dependency update charts/sequencer > /dev/null
@helm dependency update charts/evm-rollup > /dev/null
@helm dependency update charts/evm-stack > /dev/null
@echo "Setting up single astria sequencer..." && helm install \
-n astria-validator-single single-sequencer-chart ./charts/sequencer \
-f dev/values/validators/all.yml \
-f dev/values/validators/single.yml \
{{ if tag != '' { replace('--set images.sequencer.devTag=# --set sequencer-relayer.images.sequencerRelayer.devTag=#', '#', tag) } else { '' } }} \
--create-namespace > /dev/null
@just wait-for-sequencer > /dev/null
@echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-rollup -f dev/values/rollup/dev.yaml \
{{ if tag != '' { replace('--set images.conductor.devTag=# --set images.composer.devTag=#', '#', tag) } else { '' } }} \
--set config.blockscout.enabled=false \
--set config.faucet.enabled=false > /dev/null
@echo "Starting Bridge Withdrawer..." && helm install -n astria-dev-cluster evm-bridge-withdrawer-chart ./charts/evm-bridge-withdrawer \
-f dev/values/withdrawer/values.yaml \
{{ if tag != '' { replace('--set images.evmBridgeWithdrawer.devTag=#', '#', tag) } else { '' } }} > /dev/null
@echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-stack -f dev/values/rollup/dev.yaml \
{{ if tag != '' { replace('--set evm-rollup.images.conductor.devTag=# --set composer.images.composer.devTag=# --set evm-bridge-withdrawer.images.evmBridgeWithdrawer.devTag=#', '#', tag) } else { '' } }} \
--set blockscout-stack.enabled=false \
--set postgresql.enabled=false \
--set evm-faucet.enabled=false > /dev/null
@just wait-for-rollup > /dev/null

deploy-smoke-cli tag=defaultTag:
@echo "Deploying ingress controller..." && just deploy ingress-controller > /dev/null
@just wait-for-ingress-controller > /dev/null
@echo "Deploying local celestia instance..." && just deploy celestia-local > /dev/null
@helm dependency update charts/sequencer > /dev/null
@helm dependency update charts/evm-rollup > /dev/null
@helm dependency update charts/evm-stack > /dev/null
@echo "Setting up single astria sequencer..." && helm install \
-n astria-validator-single single-sequencer-chart ./charts/sequencer \
-f dev/values/validators/all.yml \
-f dev/values/validators/single.yml \
{{ if tag != '' { replace('--set images.sequencer.devTag=# --set sequencer-relayer.images.sequencerRelayer.devTag=#', '#', tag) } else { '' } }} \
--create-namespace > /dev/null
@just wait-for-sequencer > /dev/null
@echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-rollup -f dev/values/rollup/dev.yaml \
{{ if tag != '' { replace('--set images.conductor.devTag=# --set images.composer.devTag=#', '#', tag) } else { '' } }} \
--set config.blockscout.enabled=false \
--set config.faucet.enabled=false > /dev/null
@just wait-for-dev-rollup > /dev/null
@echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-stack -f dev/values/rollup/dev.yaml \
{{ if tag != '' { replace('--set evm-rollup.images.conductor.devTag=# --set composer.images.composer.devTag=# --set evm-bridge-withdrawer.images.evmBridgeWithdrawer.devTag=#', '#', tag) } else { '' } }} \
--set blockscout-stack.enabled=false \
--set postgresql.enabled=false \
--set evm-faucet.enabled=false > /dev/null
@just wait-for-rollup > /dev/null


evm_destination_address := "0xaC21B97d35Bf75A7dAb16f35b111a50e78A72F30"
Expand Down
Loading

0 comments on commit 76693c1

Please sign in to comment.