feat: weather-demo MQ pipeline + sqs-consumer v1.2 with JWT auto-refresh
- sqs-consumer: new Go binary v1.2 with tokenManager (auto-login /auth/login, 5min cache, retry on 401) - console: add MQ/KW triggers UI (mqtriggers.go, kwtriggers.go, mq.js) - console: update python-env image to v1.1 (boto3+psycopg2+requests) - weather-demo: fix consumer/main.py (Flask Request.get_json instead of dict access) - weather-demo: fix fetcher/main.py (boto3 SQS publish, 5 cities) - weather-demo: update main.tf (python-env v1.1, deploy_type=literal) - python-env: add psycopg2-binary to Dockerfile (v1.1) - terraform provider: client auth fix
This commit is contained in:
@@ -24,11 +24,6 @@ variable "namespace" {
|
||||
description = "Namespace для функций и триггеров."
|
||||
}
|
||||
|
||||
variable "owm_api_key" {
|
||||
sensitive = true
|
||||
description = "OpenWeatherMap API key."
|
||||
}
|
||||
|
||||
variable "sqs_access_key" {
|
||||
sensitive = true
|
||||
description = "SQS Access Key."
|
||||
@@ -61,7 +56,7 @@ resource "fission_iot_device" "weather_station" {
|
||||
|
||||
resource "fission_environment" "python" {
|
||||
name = "weather-python"
|
||||
image = "naeel/fission-python-env:v1.0"
|
||||
image = "naeel/fission-python-env:v1.1"
|
||||
version = 2
|
||||
namespace = var.namespace
|
||||
}
|
||||
@@ -73,7 +68,7 @@ resource "fission_package" "fetcher" {
|
||||
environment = fission_environment.python.name
|
||||
namespace = var.namespace
|
||||
source_dir = "${path.module}/fetcher"
|
||||
deploy_type = "source"
|
||||
deploy_type = "literal"
|
||||
}
|
||||
|
||||
# ── Пакет: consumer ──────────────────────────────────────────────────
|
||||
@@ -83,20 +78,19 @@ resource "fission_package" "consumer" {
|
||||
environment = fission_environment.python.name
|
||||
namespace = var.namespace
|
||||
source_dir = "${path.module}/consumer"
|
||||
deploy_type = "source"
|
||||
deploy_type = "literal"
|
||||
}
|
||||
|
||||
# ── Функция: fetcher (читает OWM, пишет в SQS) ───────────────────────
|
||||
|
||||
# ── Функция: fetcher (читает Open-Meteo, пишет в SQS) ───────────────
|
||||
# Open-Meteo: бесплатный API без ключа. https://open-meteo.com
|
||||
resource "fission_function" "fetcher" {
|
||||
name = "weather-fetcher"
|
||||
environment = fission_environment.python.name
|
||||
namespace = var.namespace
|
||||
package_name = fission_package.fetcher.name
|
||||
entrypoint = "main"
|
||||
# Env vars с секретами задаются через K8s Secret вне Terraform.
|
||||
# Имя секрета: weather-fetcher-env (namespace: var.namespace)
|
||||
# Ключи: OWM_API_KEY, SQS_ACCESS_KEY, SQS_SECRET_KEY
|
||||
# Env vars задаются через K8s Secret weather-fetcher-env (namespace: var.namespace)
|
||||
# Ключи: SQS_ACCESS_KEY, SQS_SECRET_KEY
|
||||
}
|
||||
|
||||
# ── CRON trigger: каждые 10 минут ────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user