Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube] Kube deployment for testnet and mainnet #2720

Merged
merged 10 commits into from
Oct 8, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ jobs:
chmod 600 private_key.pem
sudo apt update
sudo apt install -y --no-install-recommends openssh-server
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep main_debug | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep main_debug | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:main_debug' && docker run --rm -v /root:/root ghcr.io/rooch-network/rooch:main_debug server clean -n dev -f && docker run -d -v /root:/root -p 6767:6767 -p 9184:9184 'ghcr.io/rooch-network/rooch:main_debug' server start -n dev --btc-rpc-url '${{secrets.BTC_REGTEST_RPC_URL}}' --btc-rpc-username rooch-regtest --btc-rpc-password '${{secrets.BTC_REGTEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"fs\"}}]}}' --traffic-burst-size 100000 --traffic-per-second 10000"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep main_debug | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep main_debug | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:main_debug' && docker run --rm -v /root:/root ghcr.io/rooch-network/rooch:main_debug server clean -n dev -f && docker run -d -v /root:/root -p 6767:6767 -p 9184:9184 'ghcr.io/rooch-network/rooch:main_debug' server start -n dev --btc-rpc-url '${{secrets.BTC_REGTEST_RPC_URL}}' --btc-rpc-username rooch-regtest --btc-rpc-password '${{secrets.BTC_REGTEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"fs\"}}]}}' --traffic-burst-size 100000 --traffic-per-second 1"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST "cd /root/rooch && git pull origin main && bash scripts/check_dev_deploy_status.sh main_debug '${{ secrets.TESTNET_MNEMONIC_PHRASE }}'"
82 changes: 82 additions & 0 deletions kube/mainnet/faucet/mainnet-faucet-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mainnet-faucet
namespace: mainnet
spec:
replicas: 1
selector:
matchLabels:
app: mainnet-faucet
template:
metadata:
labels:
app: mainnet-faucet
spec:
initContainers:
- name: init-rooch
image: ghcr.io/rooch-network/rooch:main
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /root/.rooch/initialized ]; then
/rooch/rooch init -m "${INIT_SECRET}" --skip-password
/rooch/rooch env switch --alias main
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
ls -la /root/.rooch/rooch_config/
touch /root/.rooch/initialized
fi
env:
- name: INIT_SECRET
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: init-phrase
volumeMounts:
- name: rooch-data
mountPath: /root
containers:
- name: rooch-faucet
image: ghcr.io/rooch-network/rooch:main
command: ["/rooch/rooch"]
args:
- "faucet"
- "server"
- "--faucet-sender"
# the first account
- "rooch1ps458n8n37rzz3vtseu8unvkzf37udant9d4xhudsu5tv4zpzz4s30nlu0"
- "--faucet-module-address"
- "0x701c21bf1c8cd5af8c42983890d8ca55e7a820171b8e744c13f2d9998bf76cc3"
- "--faucet-object-id"
- "0xd5723eda84f691ae2623da79312c7909b1737c5b3866ecc5dbd6aa21718ff15d"
- "--discord-token"
- "$(DISCORD_TOKEN)"
env:
- name: DISCORD_TOKEN
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: discord-token
ports:
- containerPort: 6868
readinessProbe:
httpGet:
path: /
port: 6868
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 6868
initialDelaySeconds: 15
periodSeconds: 10
volumeMounts:
- name: rooch-data
mountPath: /root
volumes:
- name: rooch-data
persistentVolumeClaim:
claimName: mainnet-faucet-data
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rooch-faucet-data
name: mainnet-faucet-data
namespace: mainnet
spec:
accessModes:
- ReadWriteOnce
Expand Down
38 changes: 38 additions & 0 deletions kube/mainnet/mainnet-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mainnet-ingress
namespace: mainnet
annotations:
kubernetes.io/ingress.global-static-ip-name: "mainnet-ingress-static-ip"
#Note: there is a waring: Warning: annotation "kubernetes.io/ingress.class" is deprecated, please use 'spec.ingressClassName' instead
#But if we set the spec.ingressClassName, it do not worked.
kubernetes.io/ingress.class: "gce"
networking.gke.io/managed-certificates: "mainnet-cert"
spec:
rules:
- host: main-faucet.rooch.network
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mainnet-faucet-service
port:
number: 6868
---
apiVersion: v1
kind: Service
metadata:
name: mainnet-faucet-service
namespace: mainnet
spec:
type: NodePort
ports:
- port: 6868
targetPort: 6868
protocol: TCP
name: http
selector:
app: mainnet-faucet
8 changes: 8 additions & 0 deletions kube/mainnet/managed-cert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: mainnet-cert
namespace: mainnet
spec:
domains:
- main-faucet.rooch.network
68 changes: 68 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-binance-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mainnet-oracle-binance
namespace: mainnet
spec:
replicas: 1
selector:
matchLabels:
app: mainnet-oracle-binance
template:
metadata:
labels:
app: mainnet-oracle-binance
spec:
initContainers:
- name: init-rooch
image: ghcr.io/rooch-network/rooch:main
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /root/.rooch/initialized ]; then
/rooch/rooch init -m "${INIT_SECRET}" --skip-password
/rooch/rooch env switch --alias main
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
ls -la /root/.rooch/rooch_config/
touch /root/.rooch/initialized
fi
env:
- name: INIT_SECRET
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: init-phrase
volumeMounts:
- name: rooch-data
mountPath: /root
containers:
- name: rooch-oracle
image: ghcr.io/rooch-network/rooch:main
command: ["/rooch/rooch"]
args:
- "oracle"
- "reporter"
- "--sender"
#the fourth account
- "rooch1mfaa7tnexzyzq3rrcwf5h9u5s3lly7wshcznk69uvn9q4fw5te6qtpwwsg"
- "--oracle-id"
- "0x8316bdaf22b346fcbe43dab84faab08d039cf753a08342164150afcab718c1d2"
- "--oracle-admin-id"
- "0x54dcf30e42ef37ba2fc3f700cecb7f9ab92717247b0e4e8b5e32a54e26ce39cd"
- "--data-source"
- "binance"
- "--ticker"
- "btcusd"
- "--aggregate-strategy"
- "average"
- "--report-interval"
- "10"
volumeMounts:
- name: rooch-data
mountPath: /root
volumes:
- name: rooch-data
persistentVolumeClaim:
claimName: mainnet-oracle-binance-data
11 changes: 11 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-binance-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mainnet-oracle-binance-data
namespace: mainnet
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
68 changes: 68 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-okx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mainnet-oracle-okx
namespace: mainnet
spec:
replicas: 1
selector:
matchLabels:
app: mainnet-oracle-okx
template:
metadata:
labels:
app: mainnet-oracle-okx
spec:
initContainers:
- name: init-rooch
image: ghcr.io/rooch-network/rooch:main
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /root/.rooch/initialized ]; then
/rooch/rooch init -m "${INIT_SECRET}" --skip-password
/rooch/rooch env switch --alias main
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
ls -la /root/.rooch/rooch_config/
touch /root/.rooch/initialized
fi
env:
- name: INIT_SECRET
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: init-phrase
volumeMounts:
- name: rooch-data
mountPath: /root
containers:
- name: rooch-oracle
image: ghcr.io/rooch-network/rooch:main
command: ["/rooch/rooch"]
args:
- "oracle"
- "reporter"
- "--sender"
#the second account
- "rooch13gcqyg5y7ta9tchlpdmk23ck67d95ah0jf5493g2vhas0ktkwdyqgd0vpq"
- "--oracle-id"
- "0x1b83e993dec577fd5ab73aefa04113bcc15b255c80f87ed9fd9ab0f141757a2b"
- "--oracle-admin-id"
- "0x369f16946b39c0800c6fd2fa61e95afd8ce539d75d70eec21fa1fbdee6932d94"
- "--data-source"
- "okx"
- "--ticker"
- "btcusd"
- "--aggregate-strategy"
- "average"
- "--report-interval"
- "10"
volumeMounts:
- name: rooch-data
mountPath: /root
volumes:
- name: rooch-data
persistentVolumeClaim:
claimName: mainnet-oracle-okx-data
11 changes: 11 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-okx-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mainnet-oracle-okx-data
namespace: mainnet
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
68 changes: 68 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-pyth-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mainnet-oracle-pyth
namespace: mainnet
spec:
replicas: 1
selector:
matchLabels:
app: mainnet-oracle-pyth
template:
metadata:
labels:
app: mainnet-oracle-pyth
spec:
initContainers:
- name: init-rooch
image: ghcr.io/rooch-network/rooch:main
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /root/.rooch/initialized ]; then
/rooch/rooch init -m "${INIT_SECRET}" --skip-password
/rooch/rooch env switch --alias main
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
ls -la /root/.rooch/rooch_config/
touch /root/.rooch/initialized
fi
env:
- name: INIT_SECRET
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: init-phrase
volumeMounts:
- name: rooch-data
mountPath: /root
containers:
- name: rooch-oracle
image: ghcr.io/rooch-network/rooch:main
command: ["/rooch/rooch"]
args:
- "oracle"
- "reporter"
- "--sender"
#the third account
- "rooch1ydvn7z4tlhhm09a8rt29ma0y5apv0aemx02hpndcrhml5aewv2rqvgll6q"
- "--oracle-id"
- "0x4dabcae5783f5c2da59e5ad828a05ba6f0ec02cf91f4f8266be126dc92d6e5c1"
- "--oracle-admin-id"
- "0x719bfa2c592bd3f90188ac5c95f70b3b743970f10fe91da45f3f4a0f781ae34e"
- "--data-source"
- "pyth"
- "--ticker"
- "btcusd"
- "--aggregate-strategy"
- "average"
- "--report-interval"
- "10"
volumeMounts:
- name: rooch-data
mountPath: /root
volumes:
- name: rooch-data
persistentVolumeClaim:
claimName: mainnet-oracle-pyth-data
11 changes: 11 additions & 0 deletions kube/mainnet/oracle/mainnet-oracle-pyth-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mainnet-oracle-pyth-data
namespace: mainnet
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Loading
Loading