#!/bin/bash set -e # Вклеиваем Groq API ключ в index.html KEY=$(cat ~/lang/token.txt) cp ~/lang/index.html /tmp/lyngvo_index.html sed -i "s|const GROQ_API_KEY = '';|const GROQ_API_KEY = '${KEY}';|" /tmp/lyngvo_index.html # Синхронизация всей папки lang на ВМ rsync -az -e "ssh -i ~/.ssh/naeel_vm_id_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=10" ~/lang/ naeel@5.172.178.213:~/terra/lang/ # Деплой на ВМ (index.html с ключом — через временный файл) scp -i ~/.ssh/naeel_vm_id_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=10 /tmp/lyngvo_index.html naeel@5.172.178.213:~/terra/lang/index.html ssh -i ~/.ssh/naeel_vm_id_ed25519 -o StrictHostKeyChecking=no -o ConnectTimeout=10 naeel@5.172.178.213 ' cd ~/terra/lang && \ kubectl create configmap lyngvo-html --from-file=index.html -n default --dry-run=client -o yaml | kubectl apply -f - && \ kubectl create configmap lyngvo-nginx --from-file=default.conf=nginx.conf -n default --dry-run=client -o yaml | kubectl apply -f - && \ kubectl apply -f k8s/deployment.yaml && \ kubectl apply -f k8s/ingress.yaml && \ kubectl rollout restart deploy/lyngvo -n default && \ kubectl rollout status deploy/lyngvo -n default --timeout=60s ' rm -f /tmp/lyngvo_index.html echo "\n=== Деплой завершён. Проверяй capire.kube5s.ru ==="