Skip to content

Commit

Permalink
add avalacnhe
Browse files Browse the repository at this point in the history
  • Loading branch information
yukonet committed Jun 25, 2024
1 parent ec95859 commit 4c3004c
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/shkeeper/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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: 1.4.11
version: 1.4.12

# 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
Expand Down
51 changes: 51 additions & 0 deletions charts/shkeeper/templates/deployments/avalanche-fullnode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.avalanche_fullnode.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: avalanche
namespace: {{ .Values.namespace }}
labels:
app: avalanche
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: avalanche
template:
metadata:
labels:
app: avalanche
spec:
terminationGracePeriodSeconds: 300
tolerations: {{- toYaml .Values.avalanche_fullnode.tolerations | nindent 8 }}
nodeSelector: {{- toYaml .Values.avalanche_fullnode.nodeSelector | nindent 8 }}
containers:

- name: avalanchego
image: avaplatform/avalanchego:latest
command:
- /avalanchego/build/avalanchego

args:
{{- if .Values.avalanche_fullnode.mainnet }}
- --network-id=mainnet
{{- else }}
- --network-id=fuji
{{- end }}
- --http-host=0.0.0.0
- --http-port=9650
- --http-allowed-hosts=*
ports:
- containerPort: 9650
volumeMounts:
- name: avalanchego-volume
mountPath: /root/.avalanchego

volumes:
- name: avalanchego-volume
persistentVolumeClaim:
claimName: avalanchego-volume

{{- end }}
105 changes: 105 additions & 0 deletions charts/shkeeper/templates/deployments/avalanche-shkeeper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{{- if or .Values.avax.enabled .Values.avalanche_usdt.enabled .Values.avalanche_usdc.enabled}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: avalanche-shkeeper
namespace: {{ .Values.namespace }}
labels:
app: avalanche-shkeeper
spec:
replicas: 1
selector:
matchLabels:
app: avalanche-shkeeper
template:
metadata:
labels:
app: avalanche-shkeeper
spec:
{{- with .Values.dev.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}

containers:

- name: app
image: {{ .Values.avalanche_shkeeper.image }}
command:
- gunicorn
- --access-logfile=-
- --workers=1
- --threads=16
- --timeout=600
- --bind=0.0.0.0:6000
- run:server
ports:
- containerPort: 6000
name: http
env:
- name: AVALANCHE_USERNAME
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: username
- name: AVALANCHE_PASSWORD
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: password
- name: SHKEEPER_BACKEND_KEY
valueFrom:
secretKeyRef:
name: shkeeper-btc-key
key: password
- name: CURRENT_AVALANCHE_NETWORK
{{- if .Values.avalanche_fullnode.mainnet }}
value: &CURRENT_AVALANCHE_NETWORK_VALUE "main"
{{- else }}
value: &CURRENT_AVALANCHE_NETWORK_VALUE "testnet"
{{- end }}
- name: FULLNODE_URL
value: {{ .Values.avalanche_fullnode.url }}
{{- range $name, $value := .Values.avalanche_shkeeper.extraEnv }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}

- name: tasks
image: {{ .Values.avalanche_shkeeper.image }}
command: ["celery", "-A", "celery_worker.celery", "worker", "--loglevel=info", "-B"]
env:
- name: AVALANCHE_USERNAME
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: username
- name: AVALANCHE_PASSWORD
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: password
- name: SHKEEPER_BACKEND_KEY
valueFrom:
secretKeyRef:
name: shkeeper-btc-key
key: password
- name: CURRENT_AVALANCHE_NETWORK
{{- if .Values.avalanche_fullnode.mainnet }}
value: *CURRENT_AVALANCHE_NETWORK_VALUE
{{- else }}
value: *CURRENT_AVALANCHE_NETWORK_VALUE
{{- end }}
- name: FULLNODE_URL
value: {{ .Values.avalanche_fullnode.url }}
- name: C_FORCE_ROOT
value: "1"
{{- range $name, $value := .Values.avalanche_shkeeper.extraEnv }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}

- name: redis
image: redis
{{- end }}
20 changes: 20 additions & 0 deletions charts/shkeeper/templates/deployments/shkeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ spec:
value: {{ if .Values.polygon_usdt.enabled }}enabled{{ else }}disabled{{ end }}
- name: POLYGON_USDC_WALLET
value: {{ if .Values.polygon_usdc.enabled }}enabled{{ else }}disabled{{ end }}
- name: AVAX_WALLET
value: {{ if .Values.avax.enabled }}enabled{{ else }}disabled{{ end }}
- name: AVALANCHE_USDT_WALLET
value: {{ if .Values.avalanche_usdt.enabled }}enabled{{ else }}disabled{{ end }}
- name: AVALANCHE_USDC_WALLET
value: {{ if .Values.avalanche_usdc.enabled }}enabled{{ else }}disabled{{ end }}
{{- if .Values.btc.enabled }}
- name: BTC_USERNAME
valueFrom:
Expand Down Expand Up @@ -209,6 +215,20 @@ spec:
key: password
optional: false
{{- end }}
{{- if or .Values.avax.enabled .Values.avalanche_usdt.enabled .Values.avalanche_usdc.enabled}}
- name: AVALANCHE_USERNAME
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: username
optional: false
- name: AVALANCHE_PASSWORD
valueFrom:
secretKeyRef:
name: avalanche-rpc
key: password
optional: false
{{- end }}
{{- if .Values.monero.enabled }}
- name: MONERO_WALLET_RPC_USER
valueFrom:
Expand Down
1 change: 1 addition & 0 deletions charts/shkeeper/templates/mariadb/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ data:
CREATE DATABASE IF NOT EXISTS `bnb-shkeeper`;
CREATE DATABASE IF NOT EXISTS `xrp-shkeeper`;
CREATE DATABASE IF NOT EXISTS `polygon-shkeeper`;
CREATE DATABASE IF NOT EXISTS `avalanche-shkeeper`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: avalanchego-volume
namespace: {{ .Values.namespace }}
spec:
storageClassName: {{ .Values.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1000Gi
12 changes: 12 additions & 0 deletions charts/shkeeper/templates/secrets/rpcvalues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ metadata:
data:
username: Yml0Y29pbmQtdXNlcg==
{{ end }}
{{- if or .Values.avax.enabled .Values.avalanche_usdt.enabled .Values.avalanche_usdc.enabled}}
---
apiVersion: v1
kind: Secret
metadata:
name: avalanche-rpc
namespace: {{ .Values.namespace }}
annotations:
secret-generator.v1.mittwald.de/autogenerate: password
data:
username: Yml0Y29pbmQtdXNlcg==
{{ end }}
15 changes: 15 additions & 0 deletions charts/shkeeper/templates/services/avalanche-fullnode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ if .Values.avalanche_fullnode.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: avalanche
namespace: {{ .Values.namespace }}
spec:
selector:
app: avalanche
ports:
- name: avalnchego
port: 9650
protocol: TCP
{{ end }}
15 changes: 15 additions & 0 deletions charts/shkeeper/templates/services/avalanche-shkeeper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if or .Values.avax.enabled .Values.avalanche_usdt.enabled .Values.avalanche_usdc.enabled}}
---
apiVersion: v1
kind: Service
metadata:
name: avalanche-shkeeper
namespace: {{ .Values.namespace }}
spec:
selector:
app: avalanche-shkeeper
ports:
- name: app-tcp
port: 6000
protocol: TCP
{{ end }}
21 changes: 21 additions & 0 deletions charts/shkeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,25 @@ matic:
polygon_usdt:
enabled: false
polygon_usdc:
enabled: false

#
# Avalanche
#

avalanche_fullnode:
enabled: false
url: http://avalanche:9650/ext/bc/C/rpc
mainnet: true
nodeSelector: {}
tolerations: []

avalanche_shkeeper:
image: vsyshost/avalanche-shkeeper:1.0.0

avax:
enabled: false
avalanche_usdt:
enabled: false
avalanche_usdc:
enabled: false

0 comments on commit 4c3004c

Please sign in to comment.