Files
a13labs.infra/terraform/modules/apps/searxng/main.tf
T
alexandre.pires e9e28a5ca8 Add new model files and update Ansible playbooks for Qwen3.5 and Qwen3.6
- Created model files for Qwen3.5 with different context lengths.
- Added a new Ansible host variable file for CI server configuration.
- Updated GPU server host variables to include Ollama models and model files.
- Enhanced playbooks for Podman to manage Ollama models, including copying model files and checking existing models.
- Introduced a new playbook for setting up Qwen3.6 with specific configurations.
- Updated Windows SSH tasks to improve security and configuration management.
- Added a Python utility to parse Ollama model names from command output.
- Modified Terraform configurations to include new DNS entries and proxy settings.
- Improved Nginx proxy configurations with timeout settings.
2026-05-27 23:53:00 +02:00

219 lines
4.4 KiB
Terraform

resource "kubernetes_namespace" "searxng" {
metadata {
name = "searxng"
}
}
resource "kubernetes_service_account" "searxng" {
metadata {
name = "searxng-sa"
namespace = kubernetes_namespace.searxng.metadata[0].name
}
automount_service_account_token = false
}
resource "kubernetes_config_map" "searxng_config" {
metadata {
name = "searxng-config"
namespace = kubernetes_namespace.searxng.metadata[0].name
}
data = {
BASE_URL = "https://${local.app_fqdn}/"
GRANIAN_HOST = "0.0.0.0"
}
}
resource "kubernetes_config_map" "searxng_config_file" {
metadata {
name = "searxng-config-file"
namespace = kubernetes_namespace.searxng.metadata[0].name
}
data = {
"settings.yml" = local.searxng_config
}
}
resource "kubernetes_secret" "searxng_secrets" {
metadata {
name = "searxng-keys"
namespace = kubernetes_namespace.searxng.metadata[0].name
}
data = {
SEARXNG_SECRET = var.secret_key
}
}
resource "kubernetes_deployment" "searxng" {
metadata {
name = "searxng"
namespace = kubernetes_namespace.searxng.metadata[0].name
labels = {
app = "searxng"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "searxng"
}
}
strategy {
type = "Recreate"
}
template {
metadata {
labels = {
app = "searxng"
}
annotations = {
"checksum/config" = local.searxng_config_checksum
}
}
spec {
service_account_name = kubernetes_service_account.searxng.metadata[0].name
automount_service_account_token = false
security_context {
run_as_non_root = true
run_as_user = 977
run_as_group = 977
fs_group = 977
seccomp_profile {
type = "RuntimeDefault"
}
}
container {
name = "searxng"
image = "searxng/searxng:${local.app_version}"
env_from {
config_map_ref {
name = kubernetes_config_map.searxng_config.metadata[0].name
}
}
env {
name = "SEARXNG_SECRET"
value_from {
secret_key_ref {
name = kubernetes_secret.searxng_secrets.metadata[0].name
key = "SEARXNG_SECRET"
}
}
}
security_context {
allow_privilege_escalation = false
privileged = false
capabilities {
drop = ["ALL"]
}
read_only_root_filesystem = true
}
port {
name = "http"
container_port = 8080
protocol = "TCP"
}
liveness_probe {
http_get {
path = "/"
port = "http"
}
initial_delay_seconds = 30
period_seconds = 15
}
readiness_probe {
http_get {
path = "/"
port = "http"
}
initial_delay_seconds = 10
period_seconds = 10
}
volume_mount {
name = "searxng-data"
mount_path = "/var/cache/searxng"
}
volume_mount {
name = "searxng-tmp"
mount_path = "/tmp"
}
volume_mount {
name = "searxng-config-file"
mount_path = "/etc/searxng/settings.yml"
sub_path = "settings.yml"
}
}
volume {
name = "searxng-data"
host_path {
path = local.app_folder
}
}
volume {
name = "searxng-tmp"
empty_dir {}
}
volume {
name = "searxng-config-file"
config_map {
name = kubernetes_config_map.searxng_config_file.metadata[0].name
}
}
}
}
}
}
resource "kubernetes_service" "searxng" {
metadata {
name = "searxng-service"
namespace = kubernetes_namespace.searxng.metadata[0].name
}
spec {
selector = {
app = "searxng"
}
port {
name = "http"
port = 8080
target_port = 8080
}
type = "ClusterIP"
}
lifecycle {
ignore_changes = [
metadata[0].annotations
]
}
}