Rename deploy to orchestration

Also updates README to note prior unnoted folders.
This commit is contained in:
Luke Parker
2023-07-27 03:19:35 -04:00
parent 101da0a641
commit 09a95c9bd2
49 changed files with 25 additions and 15 deletions

68
orchestration/README.md Normal file
View File

@@ -0,0 +1,68 @@
# Deploy
## Run with Docker Compose
Running the Serai infrastructure is easy with Docker.
We utilize compose profiles to easily orchestrate various pieces of the
infrastructure.
**Example:** `docker compose --profile cluster-coins-sm up`
All commands are assumed to be ran from `/deploy`, not the root folder.
### Profiles:
* `bitcoin` - Bitcoin node
* `monero` - Monero node
* `ethereum` - Ethereum node
* `coins` - Nodes for all external networks (BTC, ETH, XMR)
* `message-queue` - The message queue service.
* `processor` - Serai processor for one external network.
* `serai` - Serai node
* `cluster-sm` - "Alice", "Bob", and "Charlie" Serai nodes, all validators
* `cluster-lg` - `cluster-sm` with non-validators "Dave", "Eve", and "Ferdie"
You can supply one or more profiles to the docker compose command to orchestrate
the desired components.
**Example:** `docker compose --profile coins --profile serai up`
## Orchestration Approach
### Builds
The Serai infrastructure is locally compiled. This may take several minutes.
Images for external networks download binaries, before verifying their checksums
and signatures.
**Stage 1 -- Builder**
* Configure environment.
* Get the binary.
* Verify binary using GPG.
* Decompress binary to prepare image.
**Stage 2 -- Image**
* Copy needed files from builder.
* Move executables to bin folder.
* Copy scripts folder.
* Expose necessary ports.
* Map necessary volumes.
The best way is to build using `docker compose`. If you'd prefer to build using
`docker` directly, each image can be built independently.
**Example:** `docker build ./coins/bitcoin`
### Entrypoint
The Serai node and external networks' nodes are each started from an entrypoint
script inside the /scripts folder.
To update the scripts on the image you must rebuild the updated images using the
`--build` flag after `up` in `docker compose`.
**Example:** `docker compose --profile bitcoin up --build`

View File

@@ -0,0 +1,40 @@
# Configure Environment
FROM alpine:latest as builder
ENV BITCOIN_VERSION=25.0
ENV GLIBC_VERSION=2.28-r0
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
WORKDIR /home/bitcoin
RUN apk update && \
apk --no-cache add ca-certificates bash su-exec git gnupg
# Download Bitcoin
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc
# Verify all sigs and check for a valid signature from laanwj -- 71A3
RUN git clone https://github.com/bitcoin-core/guix.sigs && \
cd guix.sigs/builder-keys && \
find . -iname '*.gpg' -exec gpg --import {} \; && \
gpg --verify --status-fd 1 --verify ../../SHA256SUMS.asc ../../SHA256SUMS | grep "^\[GNUPG:\] VALIDSIG.*71A3B16735405025D447E8F274810B012346C9A6"
RUN grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c
# Prepare Image
RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
FROM debian:bookworm-slim as image
WORKDIR /home/bitcoin
COPY --from=builder /home/bitcoin/* .
RUN mv bin/* /bin && mv lib/* /lib
COPY ./scripts /scripts
# Upgrade packages
RUN apt update && apt upgrade -y
EXPOSE 8332 8333 18332 18333 18443 18444
VOLUME ["/home/bitcoin/.bitcoin"]

View File

@@ -0,0 +1,8 @@
#!/bin/bash
RPC_USER="${RPC_USER:=serai}"
RPC_PASS="${RPC_PASS:=seraidex}"
bitcoind -txindex -regtest \
-rpcuser=$RPC_USER -rpcpassword=$RPC_PASS \
-rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0

View File

@@ -0,0 +1,37 @@
# Prepare Environment
FROM alpine:latest as builder
ENV GETH_VERSION=1.10.23-d901d853
WORKDIR /home/ethereum
RUN apk update \
&& apk --no-cache add ca-certificates gnupg bash su-exec
# Get Binary
RUN wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${GETH_VERSION}.tar.gz\
&& wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${GETH_VERSION}.tar.gz.asc
# Verify Binary
# Refer to https://geth.ethereum.org/downloads/#openpgp_signatures for the PGP
# PGP keys of builders and developers
ENV KEYS 9BA28146 E058A81C 05A5DDF0 1CCB7DD2
RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${KEYS} \
&& gpg --verify geth-linux-amd64-${GETH_VERSION}.tar.gz.asc geth-linux-amd64-${GETH_VERSION}.tar.gz
# Prepare Image
RUN tar xzvf geth-linux-amd64-${GETH_VERSION}.tar.gz
# Prepare Image
FROM ubuntu:latest as image
WORKDIR /home/ethereum
COPY --from=builder /home/ethereum/* .
RUN mv * /bin/
COPY ./scripts /scripts
EXPOSE 8545 8546 30303 30303/udp
# Run
CMD ["geth"]

View File

@@ -0,0 +1,6 @@
#!/bin/sh
geth --dev --networkid 5208 --datadir "eth-devnet" \
--http --http.api "web3,net,eth,miner" \
--http.addr 0.0.0.0 --http.port 8545 \
--http.vhosts="*" --http.corsdomain "*"

View File

@@ -0,0 +1,40 @@
FROM alpine:latest as builder
# https://downloads.getmonero.org/cli/monero-linux-x64-v0.18.2.2.tar.bz2
# Verification will fail if MONERO_VERSION doesn't match the latest
# due to the way monero publishes releases. They overwrite a single hashes.txt
# file with each release, meaning we can only grab the SHA256 of the latest
# release.
# Most publish a asc file for each release / build architecture ¯\_(ツ)_/¯
ENV MONERO_VERSION=0.18.2.2
ENV GLIBC_VERSION=2.28-r0
WORKDIR /home/monero
RUN apk update \
&& apk --no-cache add ca-certificates gnupg bash su-exec
# Download Monero
RUN wget https://downloads.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2
# Verify Binary -- fingerprint from https://github.com/monero-project/monero-site/issues/1949
ADD ./temp/hashes-v${MONERO_VERSION}.txt .
RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options no-self-sigs-only --receive-keys 81AC591FE9C4B65C5806AFC3F0AF4D462A0BDF92 && \
gpg --verify hashes-v${MONERO_VERSION}.txt && \
cat hashes-v${MONERO_VERSION}.txt | grep "$(sha256sum monero-linux-x64-v${MONERO_VERSION}.tar.bz2 | cut -c 1-64)"
# Cleanup
RUN tar -xvjf monero-linux-x64-v${MONERO_VERSION}.tar.bz2 --strip-components=1
# Build the actual image
FROM alpine:latest as image
WORKDIR /home/monero
COPY --from=builder /home/monero/monerod /bin
ADD scripts /scripts
# Upgrade packages
RUN apk update && apk upgrade && apk add gcompat
EXPOSE 18080 18081
VOLUME /home/monero/.bitmonero

View File

@@ -0,0 +1,10 @@
#!/bin/sh
RPC_USER="${RPC_USER:=serai}"
RPC_PASS="${RPC_PASS:=seraidex}"
# Run Monero
# TODO: Restore Auth
monerod --regtest --offline --fixed-difficulty=1 \
--rpc-bind-ip=0.0.0.0 --rpc-access-control-origins * --confirm-external-bind \
--non-interactive

View File

@@ -0,0 +1,48 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
# This GPG-signed message exists to confirm the SHA256 sums of Monero binaries.
#
# Please verify the signature against the key for binaryFate in the
# source code repository (/utils/gpg_keys).
#
#
## CLI
ec7b9913d048bec79ec7f7320df03e1f9c7ee015a051d8509e2d4ed33ddf3301 monero-android-armv7-v0.18.2.2.tar.bz2
c9d4889ff3f2c01e34f3beb3ab640fd73a535cc715ae8db591fd23724be0401c monero-android-armv8-v0.18.2.2.tar.bz2
187f58410b5aac866f7200bb1e4244ba1940b51db772d33374dfa748f30c11a7 monero-freebsd-x64-v0.18.2.2.tar.bz2
11b70a9965e3749970531baaa6c9d636b631d8b0a0256ee23a8e519f13b4b300 monero-linux-armv7-v0.18.2.2.tar.bz2
f3867f2865cb98ab1d18f30adfd9168f397bd07bf7c36550dfe3a2a11fc789ba monero-linux-armv8-v0.18.2.2.tar.bz2
186800de18f67cca8475ce392168aabeb5709a8f8058b0f7919d7c693786d56b monero-linux-x64-v0.18.2.2.tar.bz2
c0999191b57156fc7b4e7e64fe50ffdf16781bae0ebc12c96c41b2c60bdee79f monero-linux-x86-v0.18.2.2.tar.bz2
b6acf2716e6474d329d4c0bdf3b797299e4e789758f631bafa3930b613e3643c monero-mac-armv8-v0.18.2.2.tar.bz2
8043a681155bf0339dc2eac1feb93d03295bd68c9bb5b472600fa5b1439ba68d monero-mac-x64-v0.18.2.2.tar.bz2
964c13f5d596289d2ab8ba9e265ff1e255a06269cf8fd216187d7b77a11c1371 monero-win-x64-v0.18.2.2.zip
b7366408e74b321aa5fa3993187a862d93dc41cbc43dc585f82fc17a4c423ded monero-win-x86-v0.18.2.2.zip
c3345c4ca24aab13182433ccec8f7008ec3e37ba5e8c640714ad015a1f683aac monero-source-v0.18.2.2.tar.bz2
#
## GUI
165c183a7490cfe04a8296e05ad592e3e08705c879bd9facf2dab16a6ef2cf05 monero-gui-install-win-x64-v0.18.2.2.exe
027707b0ad740908c26895e3bf569ca284a813263129fe2635049313c5129230 monero-gui-linux-x64-v0.18.2.2.tar.bz2
0b676d21b8133830b8446744382ae7c8b51d0e228713184d70100721504bdd4c monero-gui-mac-x64-v0.18.2.2.dmg
770eb381e1eb3490113c1edac67a92506e0b027daa1de8486b8d5fac3b4def54 monero-gui-win-x64-v0.18.2.2.zip
58ced28d3eecda0c47f51003ae65b5bdf076ef60bdb25614421a07ef2e0791a4 monero-gui-source-v0.18.2.2.tar.bz2
#
#
# ~binaryFate
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEgaxZH+nEtlxYBq/D8K9NRioL35IFAmQ0AzAACgkQ8K9NRioL
35IOCA//YyuvSVI6k8wOxDV9FTIVxYhEganpJJQfXx5Z7Cz022GnJRRYdSBHgvhP
ALZ9T3oxaY+pXV7iYq6kHeXdkJ7Rrkmjho09sjwS1dpo7u1CXw5wFK7Fn8TnoSjt
ykGaCwcfPTg8QzT7sjSulCGEsNPv2Lg5+bDcNcr6NXukoTTD4BxxQeyJxKbyZg7F
/ImVTVNO5qH15zDXVIE/oUSohxrNvWtwdjjCbmmbGwaJsnBw+cWbybJyWuAzsNYG
xtr2tuABJM0Vy2G28uNWZxSqE+ty5CEk+bQSZPGFjPemwtJOS55qPOBxqSn5O+cy
YnEdbGjJthTM9a+om0qQ2Z1b45ahmZ9M2rkX7gOXqFDhVqaErbWFsEzgPGIR3YkS
2Hy80cdFhRKp2dLVJfv3vHQJzyU4OXjjcHy2MXE349Ec/Iquun5RO5GJMyySnkGK
oySSyi/D+A/jgimmFN6DNZaDLh0AvaUYzYJI9B2Y/9troo6YSvItD876gcZ84bvU
dJYFt9b6q66ngwdFOVcmMVDWM6LwuXYDZHRwzdo5ujeTof+5Bsn72s2J64pYvVqc
VMGCrJfCePNr9iLXWSW+Z2MDrHE1XrNSjOxkQNNoTJFwur97j/K7O8+WeaEpFAFs
H9C09/mPzHehYGYqXBk7ghLtr3N3j4DgnCU7uM9oASdO5e57bts=
=W+Y7
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,169 @@
version: "3.9"
name: serai-dev
volumes:
serai-node:
serai-alice:
serai-bob:
serai-charlie:
serai-dave:
serai-eve:
serai-ferdie:
services:
# Coin services
bitcoin:
profiles:
- bitcoin
- coins
build:
context: ./coins/bitcoin/
restart: unless-stopped
volumes:
- "./coins/bitcoin/scripts:/scripts"
entrypoint: /scripts/entry-dev.sh
ports:
- "18443:18443"
ethereum:
profiles:
- ethereum
- coins
build:
context: ./coins/ethereum/
restart: unless-stopped
volumes:
- "./coins/ethereum/scripts:/scripts"
entrypoint: /scripts/entry-dev.sh
monero:
profiles:
- monero
- coins
build:
context: ./coins/monero/
restart: unless-stopped
volumes:
- "./coins/monero/scripts:/scripts"
entrypoint: /scripts/entry-dev.sh
ports:
- "18081:18081"
# Infrastructure
message-queue:
profiles:
- message-queue
build:
context: ../
dockerfile: ./orchestration/message-queue/Dockerfile
restart: unless-stopped
volumes:
- "./message-queue/scripts:/scripts"
entrypoint: /scripts/entry-dev.sh
ports:
- "2287:2287"
processor:
profiles:
- processor
build:
context: ../
dockerfile: ./orchestration/processor/Dockerfile
restart: unless-stopped
volumes:
- "./processor/scripts:/scripts"
entrypoint: /scripts/entry-dev.sh
# Serai services
_serai:
&serai_defaults
restart: unless-stopped
image: serai:dev
profiles:
- _
build:
context: ../
dockerfile: ./orchestration/serai/Dockerfile
args:
TAG: serai
entrypoint: /scripts/entry-dev.sh
volumes:
- "./serai/scripts:/scripts"
serai-node:
<<: *serai_defaults
hostname: serai-node
profiles:
- serai
environment:
CHAIN: local
NAME: node
serai-alice:
<<: *serai_defaults
hostname: serai-alice
profiles:
- alice
- cluster-sm
- cluster-lg
environment:
CHAIN: local
NAME: alice
VALIDATOR: true
serai-bob:
<<: *serai_defaults
hostname: serai-bob
profiles:
- bob
- cluster-sm
- cluster-lg
environment:
CHAIN: local
NAME: bob
VALIDATOR: true
serai-charlie:
<<: *serai_defaults
hostname: serai-charlie
profiles:
- charlie
- cluster-sm
- cluster-lg
environment:
CHAIN: local
NAME: charlie
VALIDATOR: true
serai-dave:
<<: *serai_defaults
hostname: serai-dave
profiles:
- dave
- cluster-lg
environment:
CHAIN: local
NAME: dave
serai-eve:
<<: *serai_defaults
hostname: serai-eve
profiles:
- eve
- cluster-lg
environment:
CHAIN: local
NAME: eve
serai-ferdie:
<<: *serai_defaults
hostname: serai-ferdie
profiles:
- ferdie
- cluster-lg
environment:
CHAIN: local
NAME: ferdie

View File

@@ -0,0 +1,103 @@
SHELL := /bin/bash
check-helm:
@helm version || $(MAKE) install-helm
check-kubectl:
@kubectl version || $(MAKE) install-kubectl
install-helm:
@curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
@chmod 700 get_helm.sh
@./get_helm.sh
@rm get_helm.sh
install-kubectl:
@curl -LO 'https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl'
@sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
@rm kubectl
deploy-base:
@docker compose -f ../docker-compose.yml --profile base build --quiet
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-base charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-base,nameOverride=serai-base,\
image.envVariables[1].value=base,configMapFile=%
deploy-bitcoin:
@docker compose -f ../docker-compose.yml --profile bitcoin build --quiet
@(cat ../coins/bitcoin/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install bitcoin-daemon\
charts/bitcoin/ --values charts/bitcoin/values.yaml --set configMapFile=%
deploy-ethereum:
@docker compose -f ../docker-compose.yml --profile ethereum build --quiet
@(cat ../coins/ethereum/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install ethereum-daemon\
charts/ethereum/ --values charts/ethereum/values.yaml --set configMapFile=%
deploy-monero:
@docker compose -f ../docker-compose.yml --profile monero build --quiet
@(cat ../coins/monero/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install monero-daemon\
charts/monero/ --values charts/monero/values.yaml --set configMapFile=%
deploy-cluster-sm:
@docker compose -f ../docker-compose.yml --profile cluster-sm build --quiet
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-alice charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-alice,nameOverride=serai-alice,\
image.envVariables[1].value=Alice,image.envVariables[2].value="'1'",configMapFile=%
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-charlie charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-charlie,nameOverride=serai-charlie,\
image.envVariables[1].value=Charlie,configMapFile=%
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-bob charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-bob,nameOverride=serai-bob,\
image.envVariables[1].value=Bob,configMapFile=%
deploy-cluster-lg: deploy-cluster-sm
@docker compose -f ../docker-compose.yml --profile cluster-lg build --quiet
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-dave charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-dave,nameOverride=serai-dave,\
image.envVariables[1].value=Dave,configMapFile=%
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-eve charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-eve,nameOverride=serai-eve,\
image.envVariables[1].value=Eve,configMapFile=%
@(cat ../serai/scripts/entry-dev.sh | base64 -w 0 -) | xargs -I % helm upgrade --install serai-ferdie charts/serai/\
--values charts/serai/values.yaml --set image.envVariablesfullnameOverride=serai-ferdie,nameOverride=serai-ferdie,\
image.envVariables[1].value=Ferdie,configMapFile=%
deploy-coins: deploy-bitcoin deploy-ethereum deploy-monero
deploy-cluster-coins-sm: deploy-cluster-sm deploy-coins
deploy-cluster-coins-lg: deploy-cluster-lg deploy-coins
deploy-all: deploy-cluster-coins-lg
delete-base:
@helm delete serai-base
delete-bitcoin:
@helm delete bitcoin-daemon
delete-ethereum:
@helm delete ethereum-daemon
delete-monero:
@helm delete monero-daemon
delete-cluster-lg: delete-cluster-sm
@helm delete serai-dave
@helm delete serai-eve
@helm delete serai-ferdie
delete-cluster-sm:
@helm delete serai-alice
@helm delete serai-charlie
@helm delete serai-bob
delete-coins: delete-bitcoin delete-ethereum delete-monero
delete-cluster-coins-sm: delete-cluster-sm delete-coins
delete-cluster-coins-lg: delete-cluster-lg delete-coins
delete-all: delete-cluster-coins-lg
check-dependencies: check-helm check-kubectl

View File

@@ -0,0 +1,41 @@
# Kubernetes
## Run with Kubernetes
Running the Serai infrastructure is easy with Kubernetes.
We utilize Makefile to easily orchestrate various pieces of the infrastructure on kubernetes.
**Example to deploy:** `make deploy-<Profile_Name>`
```bash
make deploy-cluster-sm
```
**Example to delete:** `make -i delete-<Profile_Name>`
```bash
make delete-cluster-sm
```
All commands are assumed to be ran from the kubernetes folder, not the serai root folder.
### Profiles:
* deploy-base - single node, named base
* deploy-coins - node clients for coins only (BTC, ETH, XMR)
* deploy-cluster-sm - Alice (Validator), Bob, Charlie
* deploy-cluster-coins-sm - cluster-sm with coins
* deploy-cluster-lg - Alice (Validator), Bob, Charlie, Dave, Eve, Ferdie
* deploy-cluster-coins-lg - cluster-lg with coins
* deploy-monero - full node monero only
* deploy-bitcoin - full node bitcoin only
* deploy-ethereum - full node ethereum only
## Requirements for Linux
* Local built images of serai and coins, please follow the Instructions [here](../README.md)
* Running kubernetes cluster (version >= 1.19)
* Curl tool
* Make tool
* Kubectl, check if not installed
```bash
make check-kubectl
```
* Helm, check if not installed
```bash
make check-helm
```

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: bitcoin
description: A Helm chart for bitcoin-daemon
type: application
version: 0.1.0

View File

@@ -0,0 +1,42 @@
{{- define "bitcoin.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "bitcoin.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "bitcoin.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "bitcoin.labels" -}}
helm.sh/chart: {{ include "bitcoin.chart" . }}
{{ include "bitcoin.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "bitcoin.selectorLabels" -}}
app.kubernetes.io/name: {{ include "bitcoin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "bitcoin.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "bitcoin.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
entry-dev.sh: |
{{ .Values.configMapFile | b64dec | indent 4}}

View File

@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bitcoin.fullname" . }}
labels:
{{- include "bitcoin.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "bitcoin.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "bitcoin.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "bitcoin.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if hasKey .Values.image "ports" }}
ports:
{{- range .Values.image.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "command" }}
command:
{{- toYaml .Values.image.command | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "args" }}
args:
{{- toYaml .Values.image.args | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "envVariables" }}
env:
{{- toYaml .Values.image.envVariables | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "volumeMounts" }}
volumeMounts:
{{- range .Values.image.volumeMounts }}
- mountPath: {{ .mountPath }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if hasKey .Values "volumes" }}
volumes:
{{- range .Values.volumes }}
- configMap:
defaultMode: {{ .configMap.defaultMode }}
name: {{ $.Release.Name}}-{{ .configMap.name }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "bitcoin.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "bitcoin.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if .pathType }}
pathType: {{ .pathType }}
{{- end }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "bitcoin.fullname" . }}
labels:
{{- include "bitcoin.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if hasKey .Values.service "ports" }}
{{- range .Values.service.ports }}
- port: {{ .port }}
name: {{ .name }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
{{- else }}
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- end }}
selector:
{{- include "bitcoin.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,74 @@
replicaCount: 1
net: mainnet
image:
repository: serai-dev-bitcoin
pullPolicy: IfNotPresent
tag: "latest"
ports:
- name: p2p
containerPort: 18444
protocol: TCP
- name: rpc
containerPort: 18443
protocol: TCP
volumeMounts:
- mountPath: /scripts
name: configmap-volume
args:
- bash
- /scripts/entry-dev.sh
volumes:
- configMap:
defaultMode: 420
name: configmap
name: configmap-volume
configMapFile: "entry-dev.sh"
imagePullSecrets: []
serviceAccount:
create: false
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: ClusterIP
ports:
- name: p2p
port: 18444
targetPort: p2p
protocol: TCP
- name: rpc
port: 18443
targetPort: rpc
protocol: TCP
ingress:
enabled: false
className: ""
annotations: {}
hosts: []
tls: []
resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: ethereum
description: A Helm chart for ethereum-daemon
type: application
version: 0.1.0

View File

@@ -0,0 +1,42 @@
{{- define "ethereum.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "ethereum.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "ethereum.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "ethereum.labels" -}}
helm.sh/chart: {{ include "ethereum.chart" . }}
{{ include "ethereum.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "ethereum.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ethereum.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "ethereum.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ethereum.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
entry-dev.sh: |
{{ .Values.configMapFile | b64dec | indent 4}}

View File

@@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ethereum.fullname" . }}
labels:
{{- include "ethereum.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "ethereum.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ethereum.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ethereum.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if hasKey .Values.image "ports" }}
ports:
{{- range .Values.image.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
protocol: {{ .protocol }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "command" }}
command:
{{- toYaml .Values.image.command | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "args" }}
args:
{{- toYaml .Values.image.args | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "envVariables" }}
env:
{{- toYaml .Values.image.envVariables | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "volumeMounts" }}
volumeMounts:
{{- range .Values.image.volumeMounts }}
- mountPath: {{ .mountPath }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if hasKey .Values "volumes" }}
volumes:
{{- range .Values.volumes }}
- configMap:
defaultMode: {{ .configMap.defaultMode }}
name: {{ $.Release.Name}}-{{ .configMap.name }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "ethereum.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "ethereum.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if .pathType }}
pathType: {{ .pathType }}
{{- end }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "ethereum.fullname" . }}
labels:
{{- include "ethereum.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if hasKey .Values.service "ports" }}
{{- range .Values.service.ports }}
- port: {{ .port }}
name: {{ .name }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
{{- else }}
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- end }}
selector:
{{- include "ethereum.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,60 @@
replicaCount: 1
image:
repository: serai-dev-ethereum
pullPolicy: IfNotPresent
tag: "latest"
ports:
- name: rpc
containerPort: 8545
protocol: TCP
volumeMounts:
- mountPath: /scripts
name: configmap-volume
args:
- bash
- /scripts/entry-dev.sh
volumes:
- configMap:
defaultMode: 420
name: configmap
name: configmap-volume
configMapFile: "entry-dev.sh"
imagePullSecrets: []
serviceAccount:
create: false
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: ClusterIP
port: 8545
ingress:
enabled: false
className: ""
annotations: {}
hosts: []
tls: []
resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: monero
description: A Helm chart for monero-daemon
type: application
version: 0.1.0

View File

@@ -0,0 +1,42 @@
{{- define "monero.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "monero.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "monero.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "monero.labels" -}}
helm.sh/chart: {{ include "monero.chart" . }}
{{ include "monero.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "monero.selectorLabels" -}}
app.kubernetes.io/name: {{ include "monero.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "monero.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "monero.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
entry-dev.sh: |
{{ .Values.configMapFile | b64dec | indent 4}}

View File

@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "monero.fullname" . }}
labels:
{{- include "monero.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "monero.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "monero.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "monero.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if hasKey .Values.image "ports" }}
ports:
{{- range .Values.image.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "command" }}
command:
{{- toYaml .Values.image.command | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "args" }}
args:
{{- toYaml .Values.image.args | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "envVariables" }}
env:
{{- toYaml .Values.image.envVariables | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "volumeMounts" }}
volumeMounts:
{{- range .Values.image.volumeMounts }}
- mountPath: {{ .mountPath }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if hasKey .Values "volumes" }}
volumes:
{{- range .Values.volumes }}
- configMap:
defaultMode: {{ .configMap.defaultMode }}
name: {{ $.Release.Name}}-{{ .configMap.name }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "monero.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "monero.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if .pathType }}
pathType: {{ .pathType }}
{{- end }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "monero.fullname" . }}
labels:
{{- include "monero.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if hasKey .Values.service "ports" }}
{{- range .Values.service.ports }}
- port: {{ .port }}
name: {{ .name }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
{{- else }}
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- end }}
selector:
{{- include "monero.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,72 @@
replicaCount: 1
image:
repository: serai-dev-monero
pullPolicy: IfNotPresent
tag: "latest"
ports:
- name: p2p
containerPort: 18080
protocol: TCP
- name: rpc
containerPort: 18081
protocol: TCP
volumeMounts:
- mountPath: /scripts
name: configmap-volume
args:
- bash
- /scripts/entry-dev.sh
volumes:
- configMap:
defaultMode: 420
name: configmap
name: configmap-volume
configMapFile: "entry-dev.sh"
imagePullSecrets: []
serviceAccount:
create: false
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: ClusterIP
ports:
- name: p2p
port: 18080
targetPort: p2p
protocol: TCP
- name: rpc
port: 18081
targetPort: rpc
protocol: TCP
ingress:
enabled: false
className: ""
annotations: {}
hosts: []
tls: []
resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: serai
description: A Helm chart for serai
type: application
version: 0.1.0

View File

@@ -0,0 +1,42 @@
{{- define "serai-base.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "serai-base.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 253 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "serai-base.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 253 | trimSuffix "-" }}
{{- end }}
{{- define "serai-base.labels" -}}
helm.sh/chart: {{ include "serai-base.chart" . }}
{{ include "serai-base.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "serai-base.selectorLabels" -}}
app.kubernetes.io/name: {{ include "serai-base.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "serai-base.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "serai-base.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
entry-dev.sh: |
{{ .Values.configMapFile | b64dec | indent 4}}

View File

@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "serai-base.fullname" . }}
labels:
{{- include "serai-base.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "serai-base.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "serai-base.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "serai-base.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if hasKey .Values.image "ports" }}
ports:
{{- range .Values.image.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "command" }}
command:
{{- toYaml .Values.image.command | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "args" }}
args:
{{- toYaml .Values.image.args | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "envVariables" }}
env:
{{- toYaml .Values.image.envVariables | nindent 12 }}
{{- end }}
{{- if hasKey .Values.image "volumeMounts" }}
volumeMounts:
{{- range .Values.image.volumeMounts }}
- mountPath: {{ .mountPath }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if hasKey .Values "volumes" }}
volumes:
{{- range .Values.volumes }}
- configMap:
defaultMode: {{ .configMap.defaultMode }}
name: {{ $.Release.Name}}-{{ .configMap.name }}
name: {{ $.Release.Name}}-{{ .name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,50 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "serai-base.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "serai-base.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if .pathType }}
pathType: {{ .pathType }}
{{- end }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "serai-base.fullname" . }}
labels:
{{- include "serai-base.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if hasKey .Values.service "ports" }}
{{- range .Values.service.ports }}
- port: {{ .port }}
name: {{ .name }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
{{- else }}
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- end }}
selector:
{{- include "serai-base.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,92 @@
replicaCount: 1
image:
repository: serai
pullPolicy: IfNotPresent
tag: "dev"
ports:
- name: p2p
containerPort: 30333
protocol: TCP
- name: prometheus
containerPort: 9615
protocol: TCP
- name: rpc
containerPort: 9933
protocol: TCP
- name: ws
containerPort: 9944
protocol: TCP
volumeMounts:
- mountPath: /scripts
name: configmap-volume
envVariables:
- name: CHAIN
value: dev
- name: NAME
value: base
- name: VALIDATOR
value:
args:
- bash
- /scripts/entry-dev.sh
volumes:
- configMap:
defaultMode: 420
name: configmap
name: configmap-volume
configMapFile: "entry-dev.sh"
imagePullSecrets: []
serviceAccount:
create: false
name: ""
podAnnotations: {}
podSecurityContext: {}
securityContext: {}
service:
type: ClusterIP
ports:
- name: p2p
port: 30333
targetPort: p2p
protocol: TCP
- name: prometheus
port: 9615
targetPort: prometheus
protocol: TCP
- name: rpc
port: 9933
targetPort: rpc
protocol: TCP
- name: ws
port: 9944
targetPort: ws
protocol: TCP
ingress:
enabled: false
className: ""
annotations: {}
hosts: []
tls: []
resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,46 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
ADD coins /serai/coins
ADD message-queue /serai/message-queue
ADD processor /serai/processor
ADD coordinator /serai/coordinator
ADD substrate /serai/substrate
ADD tests /serai/tests
ADD Cargo.toml /serai
ADD Cargo.lock /serai
ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt install -y pkg-config clang libssl-dev
# Mount the caches and build
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
cd message-queue && \
cargo build --release --all-features && \
mkdir /serai/bin && \
mv /serai/target/release/serai-message-queue /serai/bin
# Prepare Image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"
WORKDIR /home/serai
# Copy the Message Queue binary and relevant license
COPY --from=builder /serai/bin/serai-message-queue /bin/
COPY --from=builder /serai/AGPL-3.0 .
# Upgrade packages
RUN apt update && apt upgrade -y
# Run message-queue
EXPOSE 2287
CMD ["serai-message-queue"]

View File

@@ -0,0 +1,10 @@
#!/bin/bash
export BITCOIN_KEY="0000000000000000000000000000000000000000000000000000000000000000"
export ETHEREUM_KEY="0000000000000000000000000000000000000000000000000000000000000000"
export MONERO_KEY="0000000000000000000000000000000000000000000000000000000000000000"
export COORDINATOR_KEY="0000000000000000000000000000000000000000000000000000000000000000"
export DB_PATH="./message-queue-db"
serai-message-queue

View File

@@ -0,0 +1,48 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
ADD coins /serai/coins
ADD message-queue /serai/message-queue
ADD processor /serai/processor
ADD coordinator /serai/coordinator
ADD substrate /serai/substrate
ADD tests /serai/tests
ADD Cargo.toml /serai
ADD Cargo.lock /serai
ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt upgrade -y && apt install -y pkg-config clang libssl-dev
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown
# Mount the caches and build
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
cd processor && \
cargo build --release --all-features && \
mkdir /serai/bin && \
mv /serai/target/release/serai-processor /serai/bin
# Prepare Image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"
WORKDIR /home/serai
# Copy necessary files to run node
COPY --from=builder /serai/bin/serai-processor /bin/
COPY --from=builder /serai/AGPL-3.0 .
# Upgrade packages and install openssl
RUN apt update && apt upgrade -y && apt install -y libssl-dev
# Run processor
CMD ["serai-processor"]

View File

@@ -0,0 +1,13 @@
#!/bin/bash
export MESSAGE_QUEUE_KEY="0000000000000000000000000000000000000000000000000000000000000000"
export MESSAGE_QUEUE_RPC="http://127.0.0.1:2287"
export DB_PATH="./bitcoin-db"
export ENTROPY="0001020304050607080910111213141516171819202122232425262728293031"
export NETWORK="bitcoin"
export NETWORK_RPC_LOGIN="serai:seraidex"
export NETWORK_RPC_HOSTNAME="127.0.0.1"
export NETWORK_RPC_PORT="18443"
serai-processor

View File

@@ -0,0 +1,49 @@
FROM rust:1.71-slim-bookworm as builder
LABEL description="STAGE 1: Build"
# Add files for build
ADD common /serai/common
ADD crypto /serai/crypto
ADD coins /serai/coins
ADD message-queue /serai/message-queue
ADD processor /serai/processor
ADD coordinator /serai/coordinator
ADD substrate /serai/substrate
ADD tests /serai/tests
ADD Cargo.toml /serai
ADD Cargo.lock /serai
ADD AGPL-3.0 /serai
WORKDIR /serai
RUN apt update && apt upgrade -y && apt install -y git pkg-config make clang libssl-dev protobuf-compiler
# Add the wasm toolchain
RUN rustup target add wasm32-unknown-unknown
# Mount the caches and build
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
cd substrate/node && \
cargo build --release && \
mkdir /serai/bin && \
mv /serai/target/release/serai-node /serai/bin
# Prepare Image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"
WORKDIR /home/serai
# Copy necessary files to run node
COPY --from=builder /serai/bin/serai-node /bin/
COPY --from=builder /serai/AGPL-3.0 .
# Upgrade packages
RUN apt update && apt upgrade -y
# Run node
EXPOSE 30333 9615 9933 9944
CMD ["serai-node"]

View File

@@ -0,0 +1,7 @@
#!/bin/bash
if [[ -z $VALIDATOR ]]; then
serai-node --tmp --chain $CHAIN --name $NAME
else
serai-node --tmp --chain $CHAIN --$NAME
fi