Skip to content

Commit

Permalink
add lightning
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-samoylenko committed Dec 18, 2024
1 parent f9a8cda commit 13085c4
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 8 deletions.
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.41
version: 1.4.50

# 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
72 changes: 72 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/lnd/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{{- if .Values.btc_lightning.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: lightning-lnd
namespace: {{ .Values.namespace }}
labels:
app: lightning-lnd
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: lightning-lnd
template:
metadata:
labels:
app: lightning-lnd
spec:
containers:
- name: lightning-lnd
image: {{ .Values.btc_lightning.lnd.image }}
args:
- --wallet-unlock-password-file=/root/.lnd/wallet-password
- --externalip=$(EXTERNAL_IP)
- --listen=0.0.0.0:$(P2P_PORT)
- --restlisten=0.0.0.0:8080
- --tlsextradomain=lightning-lnd-rest
- --bitcoin.$(NETWORK)
- --bitcoin.node=bitcoind
- --bitcoind.rpchost=bitcoind
- --bitcoind.rpcuser=$(BITCOIND_RPCUSER)
- --bitcoind.rpcpass=$(BITCOIND_RPCPASS)
- --bitcoind.zmqpubrawblock=tcp://bitcoind:28334
- --bitcoind.zmqpubrawtx=tcp://bitcoind:28335
env:
- name: EXTERNAL_IP
value: {{ .Values.external_ip }}
- name: P2P_PORT
value: {{ .Values.btc_lightning.lnd.p2p_port | quote }}
- name: NETWORK
value: {{ .Values.btc_lightning.network }}
- name: BITCOIND_RPCUSER
valueFrom:
secretKeyRef:
name: bitcoin-rpc
key: username
optional: false
- name: BITCOIND_RPCPASS
valueFrom:
secretKeyRef:
name: bitcoin-rpc
key: password
optional: false
{{- range $name, $value := .Values.btc_lightning.lnd.extraEnv }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}
ports:
- containerPort: {{ .Values.btc_lightning.lnd.p2p_port }}
name: p2p
- containerPort: 8080
name: rest
volumeMounts:
- name: lightning-lnd
mountPath: /root/.lnd
volumes:
- name: lightning-lnd
persistentVolumeClaim:
claimName: lightning-lnd
{{- end }}
12 changes: 12 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/lnd/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: lightning-lnd
namespace: {{ .Values.namespace }}
spec:
storageClassName: {{ .Values.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
29 changes: 29 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/lnd/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if .Values.btc_lightning.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: lightning-lnd-p2p
namespace: {{ .Values.namespace }}
spec:
selector:
app: lightning-lnd
ports:
- name: p2p
port: {{ .Values.btc_lightning.lnd.p2p_port }}
targetPort: p2p
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: lightning-lnd-rest
namespace: {{ .Values.namespace }}
spec:
selector:
app: lightning-lnd
ports:
- name: rest
port: 8080
targetPort: rest
{{ end }}
59 changes: 59 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/rtl/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{- if .Values.btc_lightning.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: lightning-rtl
namespace: {{ .Values.namespace }}
labels:
app: lightning-rtl
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: lightning-rtl
template:
metadata:
labels:
app: lightning-rtl
spec:
containers:
- name: lightning-rtl
image: {{ .Values.btc_lightning.rtl.image }}
env:
- name: LN_SERVER_URL
value: {{ .Values.btc_lightning.lnd.rest_url }}
- name: MACAROON_PATH
value: /shared/data/chain/bitcoin/{{ .Values.btc_lightning.network }}
- name: DB_DIRECTORY_PATH
value: /persistent/database
- name: CHANNEL_BACKUP_PATH
value: /persistent/backups
- name: RTL_SSO
value: "1"
- name: RTL_COOKIE_PATH
value: /shared/rtl-cookie
- name: LOGOUT_REDIRECT_LINK
value: {{ .Values.btc_lightning.rtl.logout_redirect_link }}
{{- range $name, $value := .Values.btc_lightning.rtl.extraEnv }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}
ports:
- containerPort: 3000
name: web

volumeMounts:
- name: lightning-rtl
mountPath: /persistent
- name: lightning-lnd
mountPath: /shared
volumes:
- name: lightning-rtl
persistentVolumeClaim:
claimName: lightning-rtl
- name: lightning-lnd
persistentVolumeClaim:
claimName: lightning-lnd
{{- end }}
12 changes: 12 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/rtl/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: lightning-rtl
namespace: {{ .Values.namespace }}
spec:
storageClassName: {{ .Values.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
16 changes: 16 additions & 0 deletions charts/shkeeper/templates/bitcoin-lightning/rtl/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.btc_lightning.enabled }}
apiVersion: v1
kind: Service
metadata:
name: lightning-rtl
namespace: {{ .Values.namespace }}
spec:
selector:
app: lightning-rtl
ports:
- name: web
port: 3000
targetPort: web
type: LoadBalancer

{{ end }}
13 changes: 8 additions & 5 deletions charts/shkeeper/templates/deployments/bitcoind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ spec:


- name: bitcoind
image: vsyshost/bitcoind
{{- if not .Values.btc.mainnet }}
image: {{ .Values.btc.bitcoind.image }}
command:
- /shkeeper/bitcoind
- -testnet
- -rpcport=8332
- -prune=550
- -rpcpassword=$BTC_PASSWORD
- -rpcuser=$BTC_USERNAME
- -rpcpassword=$(BTC_PASSWORD)
- -rpcuser=$(BTC_USERNAME)
- -rpcbind=0.0.0.0
- -rpcallowip=0.0.0.0/0
- -wallet=shkeeper
- -walletnotify=/shkeeper/walletnotify.sh %s
- -zmqpubrawblock=tcp://0.0.0.0:28334
- -zmqpubrawtx=tcp://0.0.0.0:28335
- -zmqpubhashblock=tcp://0.0.0.0:28336
{{- if not .Values.btc.mainnet }}
- -testnet
{{- end }}
env:
- name: BTC_USERNAME
Expand Down
24 changes: 24 additions & 0 deletions charts/shkeeper/templates/deployments/shkeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ metadata:
app.kubernetes.io/name: shkeeper
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/instance: shkeeper-vsys
Expand Down Expand Up @@ -251,6 +253,19 @@ spec:
- name: MONERO_DAEMON_PASS
value: {{ .Values.monero.fullnode.monerod.password }}
{{- end }}
{{- if .Values.btc_lightning.enabled }}
- name: LND_NETWORK
value: {{ .Values.btc_lightning.network }}
- name: LND_REST_URL
value: {{ .Values.btc_lightning.lnd.rest_url }}
- name: RTL_WEB_URL
value: {{ .Values.btc_lightning.rtl.web_url }}
- name: BITCOINLIGHTNING_WALLET
value: enabled
{{- else }}
- name: BITCOINLIGHTNING_WALLET
value: disabled
{{- end }}
- name: SHKEEPER_BTC_BACKEND_KEY
valueFrom:
secretKeyRef:
Expand All @@ -266,7 +281,16 @@ spec:
volumeMounts:
- name: shkeeper-db-storage
mountPath: /shkeeper.io/instance
{{- if .Values.btc_lightning.enabled }}
- name: lightning-lnd
mountPath: /lightning_shared
{{- end }}
volumes:
- name: shkeeper-db-storage
persistentVolumeClaim:
claimName: shkeeper-db-claim
{{- if .Values.btc_lightning.enabled }}
- name: lightning-lnd
persistentVolumeClaim:
claimName: lightning-lnd
{{- end }}
9 changes: 9 additions & 0 deletions charts/shkeeper/templates/services/bitcoind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ spec:
port: 8332
protocol: TCP
targetPort: 8332
- name: zmq-pub-rawblock
port: 28334
targetPort: 28334
- name: zmq-pub-rawtx
port: 28335
targetPort: 28335
- name: zmq-pub-hashblock
port: 28336
targetPort: 28336
- name: nginx
port: 5555
protocol: TCP
Expand Down
26 changes: 24 additions & 2 deletions charts/shkeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

namespace: shkeeper
external_ip: 0.0.0.0

dev:
imagePullSecrets:
Expand All @@ -14,7 +15,7 @@ storageClassName:
#

shkeeper:
image: vsyshost/shkeeper:2.1.55
image: vsyshost/shkeeper:2.2.2
port: 5000

#
Expand All @@ -24,6 +25,9 @@ shkeeper:
btc:
enabled: true
mainnet: true
bitcoind:
image: vsyshost/bitcoind:27.0

ltc:
enabled: true
mainnet: true
Expand Down Expand Up @@ -175,4 +179,22 @@ avax:
avalanche_usdt:
enabled: false
avalanche_usdc:
enabled: false
enabled: false

#
# BTC Lightning
#

btc_lightning:
enabled: false
network: mainnet

lnd:
image: vsyshost/lndinit:v0.1.22-beta-lnd-v0.18.3-beta
rest_url: https://lightning-lnd-rest:8080
p2p_port: 9735

rtl:
image: shahanafarooqui/rtl:v0.15.4
web_url: http://rtl:3000
logout_redirect_link: http://shkeeper:5000/wallet/BTC-LIGHTNING
11 changes: 11 additions & 0 deletions docker/lnd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# LNDINIT_VERSION="v0.1.22-beta"
# LND_VERSION="v0.18.3-beta"
# docker build --build-arg LNDINIT_VERSION=$LNDINIT_VERSION --build-arg LND_VERSION=$LND_VERSION -t vsyshost/lndinit:${LNDINIT_VERSION}-lnd-${LND_VERSION} .
# docker push vsyshost/lndinit:${LNDINIT_VERSION}-lnd-${LND_VERSION}

ARG LNDINIT_VERSION="v0.1.22-beta"
ARG LND_VERSION="v0.18.3-beta"

FROM lightninglabs/lndinit:${LNDINIT_VERSION}-lnd-${LND_VERSION}
COPY ./entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
Loading

0 comments on commit 13085c4

Please sign in to comment.