Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Kubernetes configuration for Bitcoin/Electrum #888

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions infrastructure/kube/keep-test/electrumx-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: v1
kind: Service
metadata:
name: electrumx
namespace: default
labels:
app: bitcoin
type: electrumx
spec:
type: LoadBalancer
loadBalancerIP: 34.70.22.39
# Expose the service on ports that are proxied by Cloudflare.
# See: https://developers.cloudflare.com/fundamentals/get-started/reference/network-ports/
ports:
- name: tcp
port: 80
targetPort: tcp
- name: ssl
port: 443
targetPort: ssl
- name: ws
port: 8080
targetPort: ws
- name: wss
port: 8443
targetPort: wss
selector:
app: bitcoin
type: electrumx
93 changes: 93 additions & 0 deletions infrastructure/kube/keep-test/electrumx-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: electrumx
namespace: default
labels:
app: bitcoin
type: electrumx
spec:
replicas: 1
serviceName: electrumx
volumeClaimTemplates:
- metadata:
name: electrumx-data
spec:
storageClassName: electrumx
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 30Gi
selector:
matchLabels:
app: bitcoin
type: electrumx
template:
metadata:
labels:
app: bitcoin
type: electrumx
spec:
containers:
- name: electrumx-server
image: lukechilds/electrumx:v1.16.0
imagePullPolicy: Always
ports:
- name: tcp
containerPort: 50001
- name: ssl
containerPort: 50002
- name: ws
containerPort: 50003
- name: wss
containerPort: 50004
- name: rpc
containerPort: 8000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we align it with prod configuration and use the same ports as in the service?

        ports:
          - containerPort: 443
          - containerPort: 8080
          - containerPort: 8443
          - containerPort: 8000

readinessProbe:
tcpSocket:
port: tcp
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: tcp
initialDelaySeconds: 15
periodSeconds: 20
# Full list of env vars: https://electrumx.readthedocs.io/en/latest/environment.html
env:
- name: DB_DIRECTORY
value: /mnt/electrum/data
- name: SSL_CERTFILE
value: /mnt/electrum/cert/tls.crt
- name: SSL_KEYFILE
value: /mnt/electrum/cert/tls.key
- name: DAEMON_URL
valueFrom:
secretKeyRef:
name: bcoin
key: bcoin-url
- name: SERVICES
value: tcp://:50001,ssl://:50002,ws://:50003,wss://:50004,rpc://0.0.0.0:8000
- name: COIN
value: Bitcoin
- name: NET
value: testnet
- name: COST_SOFT_LIMIT
value: '0'
- name: COST_HARD_LIMIT
value: '0'
- name: LOG_LEVEL
value: debug
volumeMounts:
- name: electrumx-data
mountPath: /mnt/electrum/data
- name: tbtc-network-cloudflare-origin-cert
mountPath: /mnt/electrum/cert
volumes:
- name: electrumx-data
persistentVolumeClaim:
claimName: electrumx-data
- name: tbtc-network-cloudflare-origin-cert
secret:
secretName: electrumx-server-test-tbtc-network
14 changes: 14 additions & 0 deletions infrastructure/kube/keep-test/electrumx-storageclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: electrumx
namespace: default
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
replication-type: none
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
- debug
volumeBindingMode: Immediate