From 9ea54eb2faa4ba64757e5c30788794267e60f56d Mon Sep 17 00:00:00 2001 From: decfox Date: Sun, 8 Sep 2024 00:19:16 +0530 Subject: [PATCH] fix: move config to modules-enabled --- tf/modules/clickhouse_proxy/main.tf | 7 +++---- .../clickhouse_proxy/templates/setup-clickhouse-proxy.sh | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tf/modules/clickhouse_proxy/main.tf b/tf/modules/clickhouse_proxy/main.tf index 8362750a..c1c5f547 100644 --- a/tf/modules/clickhouse_proxy/main.tf +++ b/tf/modules/clickhouse_proxy/main.tf @@ -6,7 +6,7 @@ data "aws_ssm_parameter" "ubuntu_22_ami" { # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group#recreating-a-security-group resource "aws_security_group" "ckprx_sg" { description = "security group for nginx" - name_prefix = "ooni-clickhouse" + name_prefix = "ooni-ckprx" vpc_id = var.vpc_id @@ -66,6 +66,7 @@ resource "aws_launch_template" "clickhouse_proxy" { network_interfaces { delete_on_termination = true associate_public_ip_address = true + subnet_id = var.subnet_id security_groups = [ aws_security_group.ckprx_sg.id, ] @@ -82,14 +83,12 @@ resource "aws_instance" "clickhouse_proxy" { id = aws_launch_template.clickhouse_proxy.id version = "$Latest" } - - subnet_id = var.subnet_id lifecycle { create_before_destroy = true } - tags = merge(var.tags, { Name = "ansible-controller" }) + tags = merge(var.tags, { Name = "clickhouse-proxy" }) } resource "aws_route53_record" "clickhouse_proxy_alias" { diff --git a/tf/modules/clickhouse_proxy/templates/setup-clickhouse-proxy.sh b/tf/modules/clickhouse_proxy/templates/setup-clickhouse-proxy.sh index 1d212d45..4827497e 100644 --- a/tf/modules/clickhouse_proxy/templates/setup-clickhouse-proxy.sh +++ b/tf/modules/clickhouse_proxy/templates/setup-clickhouse-proxy.sh @@ -15,10 +15,12 @@ stream { listen 9000; proxy_pass clickhouse_backend; - } + } + + error_log /var/log/nginx/error.log; } EOF -sudo mv $tmpfile /etc/nginx/sites-available/default +sudo mv $tmpfile /etc/nginx/modules-enabled/stream.conf sudo nginx -t sudo systemctl reload nginx