feat(relayer): цена SOL из NATS + WS-раздача + деплой-артефакты
deploy-contract / deploy-contract (release) Failing after 3m34s
deploy-contract / deploy-contract (release) Failing after 3m34s
priceSource больше не рандомит: цена берётся из NATS (market.price.solusdt), конверсия строка->целое x1e8 без float. Шлюз раздаёт цену по WS (/ws, нормализация /api/... -> /...) — фронт просто выводит её. Добавлены Dockerfile и helm-чарт для деплоя в k3s.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "smart-updown-relayer.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "smart-updown-relayer.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels.
|
||||
*/}}
|
||||
{{- define "smart-updown-relayer.labels" -}}
|
||||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
app.kubernetes.io/name: {{ include "smart-updown-relayer.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels.
|
||||
*/}}
|
||||
{{- define "smart-updown-relayer.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "smart-updown-relayer.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,111 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "smart-updown-relayer.fullname" . }}
|
||||
labels:
|
||||
{{- include "smart-updown-relayer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "smart-updown-relayer.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "smart-updown-relayer.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: seed-bettors
|
||||
image: "{{ .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- '[ -f /app/data/.gateway-bettors.json ] || cp /seed/.gateway-bettors.json /app/data/.gateway-bettors.json'
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
- name: bettors-seed
|
||||
mountPath: /seed
|
||||
readOnly: true
|
||||
containers:
|
||||
- name: gateway
|
||||
image: "{{ .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SMART_RPC_URL
|
||||
value: {{ .Values.smart.rpcUrl | quote }}
|
||||
- name: SMART_PROGRAM_ID
|
||||
value: {{ .Values.smart.programId | quote }}
|
||||
- name: SMART_TOKEN_MINT
|
||||
value: {{ .Values.smart.tokenMint | quote }}
|
||||
- name: SMART_ADMIN_KEYPAIR
|
||||
value: {{ .Values.smart.adminKeypair | quote }}
|
||||
- name: SMART_ALLOW_AIRDROP
|
||||
value: {{ .Values.smart.allowAirdrop | ternary "1" "0" | quote }}
|
||||
- name: SMART_MIN_AMOUNT
|
||||
value: {{ .Values.smart.minAmount | quote }}
|
||||
- name: SMART_MAX_AMOUNT
|
||||
value: {{ .Values.smart.maxAmount | quote }}
|
||||
- name: SMART_MULTIPLIER_BPS
|
||||
value: {{ .Values.smart.multiplierBps | quote }}
|
||||
- name: SMART_EXPIRY_SECONDS
|
||||
value: {{ .Values.smart.expirySeconds | quote }}
|
||||
- name: SMART_START_BALANCE
|
||||
value: {{ .Values.smart.startBalance | quote }}
|
||||
- name: GW_PORT
|
||||
value: {{ .Values.port | quote }}
|
||||
- name: GW_BETTOR_KEYSTORE
|
||||
value: {{ .Values.keystorePath | quote }}
|
||||
- name: NATS_URL
|
||||
value: {{ .Values.nats.url | quote }}
|
||||
- name: NATS_PRICE_SUBJECT
|
||||
value: {{ .Values.nats.priceSubject | quote }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
- name: admin-keypair
|
||||
mountPath: /app/secrets
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "smart-updown-relayer.fullname" . }}-data
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: admin-keypair
|
||||
secret:
|
||||
secretName: smart-updown-keypair
|
||||
items:
|
||||
- key: admin-keypair.json
|
||||
path: admin-keypair.json
|
||||
defaultMode: 0444
|
||||
- name: bettors-seed
|
||||
secret:
|
||||
secretName: testfront-bettors
|
||||
items:
|
||||
- key: .gateway-bettors.json
|
||||
path: .gateway-bettors.json
|
||||
defaultMode: 0444
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "smart-updown-relayer.fullname" . }}
|
||||
labels:
|
||||
{{- include "smart-updown-relayer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "smart-updown-relayer.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.persistence.enabled }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "smart-updown-relayer.fullname" . }}-data
|
||||
labels:
|
||||
{{- include "smart-updown-relayer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "smart-updown-relayer.fullname" . }}
|
||||
labels:
|
||||
{{- include "smart-updown-relayer.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
selector:
|
||||
{{- include "smart-updown-relayer.selectorLabels" . | nindent 4 }}
|
||||
Reference in New Issue
Block a user