-
Notifications
You must be signed in to change notification settings - Fork 276
Expand file tree
/
Copy pathdeploy.yaml
More file actions
101 lines (94 loc) · 3.08 KB
/
Copy pathdeploy.yaml
File metadata and controls
101 lines (94 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
version: "2.0"
services:
logos-blockchain-node:
image: ghcr.io/vpavlin/logos-blockchain-node:0.1.2-curl-3
env:
- "USER_CONFIG_BASE64=" # Optional: base64-encoded user_config.yaml. If set, skips init and uses this config instead.
- "EXTERNAL_IP=" # Optional: manual override for the leased IP. Auto-detected from Kubernetes API if not set.
command:
- "sh"
- "-c"
args:
- |
cd /state
# Restore or generate config
if [ -n "$USER_CONFIG_BASE64" ]; then
echo "$USER_CONFIG_BASE64" | base64 -d > user_config.yaml
elif [ ! -f user_config.yaml ]; then
logos-blockchain-node init \
-p /ip4/65.109.51.37/udp/3000/quic-v1 \
-p /ip4/65.109.51.37/udp/3001/quic-v1 \
-p /ip4/65.109.51.37/udp/3002/quic-v1 \
-p /ip4/65.109.51.37/udp/3003/quic-v1
fi
# Detect leased IP on every startup
DETECTED_IP=""
if [ -f /var/run/secrets/kubernetes.io/serviceaccount/token ]; then
KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
KUBE_NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace 2>/dev/null || echo "default")
DETECTED_IP=$(curl -s --max-time 5 \
-H "Authorization: Bearer $KUBE_TOKEN" \
--cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
"https://kubernetes.default.svc/api/v1/namespaces/$KUBE_NAMESPACE/services" 2>/dev/null | \
jq -r '.items[] | select(.spec.type=="LoadBalancer") | .status.loadBalancer.ingress[0].ip // empty' 2>/dev/null | head -1)
fi
PUBLIC_IP="${EXTERNAL_IP:-$DETECTED_IP}"
if [ -n "$PUBLIC_IP" ]; then
echo "Setting static external address: $PUBLIC_IP"
yq -i ".network.backend.swarm.nat = {\"type\": \"static\", \"external_address\": \"/ip4/$PUBLIC_IP/udp/3000/quic-v1\"}" user_config.yaml
else
echo "Warning: could not detect leased IP, node will rely on NAT traversal"
fi
logos-blockchain-node user_config.yaml || sleep infinity
expose:
- port: 3000
proto: udp
as: 3000
to:
- global: true
ip: logos-node-ip
- port: 3400
proto: udp
as: 3400
to:
- global: true
ip: logos-node-ip
params:
storage:
state:
mount: /state
profiles:
compute:
logos-blockchain-node:
resources:
cpu:
units: 2.0
memory:
size: 4Gi
storage:
- size: 512Mi
- name: state
size: 20Gi
attributes:
persistent: true
class: beta3
placement:
akash:
attributes:
host: akash
signedBy:
anyOf:
- "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
pricing:
logos-blockchain-node:
denom: uact
amount: 10000
endpoints:
logos-node-ip:
kind: ip
deployment:
logos-blockchain-node:
akash:
profile: logos-blockchain-node
count: 1