From 5a1e7752b8e579a0855804b1b52f304abe092c31 Mon Sep 17 00:00:00 2001 From: Nathan Slaughter <28688390+nslaughter@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:43:58 -0500 Subject: [PATCH] ghostunnel example Add linters tweak go checks add revised dashboard update process --- .github/workflows/ci.yml | 51 +++++++++++++++++++ .golangci.yml | 45 ++++++++++++++++ .../dashboards/overview/main.tf | 4 +- .../apimanagement_service/examples/tf/main.tf | 6 +-- .../compute_disks/dashboards/overview/main.tf | 4 +- azure/compute_disks/examples/tf/main.tf | 26 +++++----- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 26 +++++----- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 8 +-- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../dbformariadb_servers/examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- azure/dbformysql_servers/examples/tf/main.tf | 6 +-- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 26 +++++----- .../dashboards/overview/main.tf | 4 +- .../sql_managedinstances/examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../sql_servers_databases/examples/tf/main.tf | 16 +++--- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 16 +++--- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 2 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../dashboards/overview/main.tf | 4 +- .../examples/tf/main.tf | 4 +- .../ghosttunnel/examples/compose/Makefile | 38 ++++++++++++++ .../ghosttunnel/examples/compose/README.md | 36 +++++++++++++ .../examples/compose/collector.yaml | 31 +++++++++++ .../examples/compose/docker-compose.yaml | 50 ++++++++++++++++++ tools/internal/text/text.go | 8 ++- tools/internal/text/text_test.go | 2 +- 53 files changed, 393 insertions(+), 144 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .golangci.yml create mode 100644 collector/ghosttunnel/examples/compose/Makefile create mode 100644 collector/ghosttunnel/examples/compose/README.md create mode 100644 collector/ghosttunnel/examples/compose/collector.yaml create mode 100644 collector/ghosttunnel/examples/compose/docker-compose.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..55cdf27 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: Validate PR + +on: + pull_request: + paths: + - '**.tf' + - '**.go' + +jobs: + terraform-fmt: + name: Terraform Format Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + - name: Terraform FMT Check + run: | + terraform init + terraform fmt -check + + terraform-lint: + name: Terraform Lint Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install tflint + run: | + wget https://github.com/terraform-linters/tflint/releases/download/v0.31.0/tflint_linux_amd64.zip + unzip tflint_linux_amd64.zip + sudo mv tflint /usr/local/bin/ + - name: Run tflint + run: tflint + + go-lint: + name: Go Best Practices Lint Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.21 + - name: Install golangci-lint + run: | + wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.42.0 + - name: Run golangci-lint + run: ./bin/golangci-lint run diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..18e95c8 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,45 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0.8 + gofmt: + simplify: true + goimports: + local-prefixes: github.com/lightstep/integrations + maligned: + suggest-new: true + misspell: + locale: US + +linters: + enable: + - unused + - gosimple + - structcheck + - varcheck + - ineffassign + - deadcode + - gofmt + - goimports + - golint + - govet + - errcheck + - staticcheck + - typecheck + disable: + - megacheck + +issues: + exclude-rules: + # Exclude some linters from running on test files. + - path: _test\.go$ + linters: + - gosimple + - staticcheck + + # Exclude some directories from linting. + exclude-use-default: false + +run: + timeout: 5m diff --git a/azure/apimanagement_service/dashboards/overview/main.tf b/azure/apimanagement_service/dashboards/overview/main.tf index c3bcdc2..740e4ab 100644 --- a/azure/apimanagement_service/dashboards/overview/main.tf +++ b/azure/apimanagement_service/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "API Management Service Metrics" + project_name = var.lightstep_project + dashboard_name = "API Management Service Metrics" dashboard_description = "Monitor API Management Service with this metrics overview dashboard." chart { diff --git a/azure/apimanagement_service/examples/tf/main.tf b/azure/apimanagement_service/examples/tf/main.tf index 21d6835..3389dd7 100644 --- a/azure/apimanagement_service/examples/tf/main.tf +++ b/azure/apimanagement_service/examples/tf/main.tf @@ -4,16 +4,16 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-apimgmt" + default = "ex-apimgmt" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } resource "azurerm_api_management" "example" { - name = "${var.prefix}" + name = var.prefix location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name publisher_name = "My Company" diff --git a/azure/compute_disks/dashboards/overview/main.tf b/azure/compute_disks/dashboards/overview/main.tf index ca147a6..396e78a 100644 --- a/azure/compute_disks/dashboards/overview/main.tf +++ b/azure/compute_disks/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Compute Disks Metrics" + project_name = var.lightstep_project + dashboard_name = "Compute Disks Metrics" dashboard_description = "Monitor Compute Disks with this metrics overview dashboard." chart { diff --git a/azure/compute_disks/examples/tf/main.tf b/azure/compute_disks/examples/tf/main.tf index 69931ae..d91d960 100644 --- a/azure/compute_disks/examples/tf/main.tf +++ b/azure/compute_disks/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-compute-disks" + default = "ex-compute-disks" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -47,9 +47,9 @@ resource "azurerm_network_interface" "primary" { } resource "azurerm_network_interface" "internal" { - name = "${var.prefix}-internal-net" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location + name = "${var.prefix}-internal-net" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location ip_configuration { name = "internal" @@ -81,16 +81,16 @@ resource "azurerm_network_interface_security_group_association" "example" { } resource "azurerm_virtual_machine" "vm" { - name = "${var.prefix}-vm1" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - vm_size = "Standard_A1_v2" + name = "${var.prefix}-vm1" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + vm_size = "Standard_A1_v2" network_interface_ids = [ azurerm_network_interface.primary.id, azurerm_network_interface.internal.id ] primary_network_interface_id = azurerm_network_interface.primary.id - + delete_os_disk_on_termination = true storage_image_reference { @@ -101,9 +101,9 @@ resource "azurerm_virtual_machine" "vm" { } storage_os_disk { - caching = "ReadWrite" - name = "osdisk1" - create_option = "FromImage" + caching = "ReadWrite" + name = "osdisk1" + create_option = "FromImage" managed_disk_type = "Standard_LRS" } diff --git a/azure/compute_virtualmachines/dashboards/overview/main.tf b/azure/compute_virtualmachines/dashboards/overview/main.tf index 1eb2792..9264207 100644 --- a/azure/compute_virtualmachines/dashboards/overview/main.tf +++ b/azure/compute_virtualmachines/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Compute Virtual Machines Metrics" + project_name = var.lightstep_project + dashboard_name = "Compute Virtual Machines Metrics" dashboard_description = "Monitor Compute Virtual Machines with this metrics overview dashboard." chart { diff --git a/azure/compute_virtualmachines/examples/tf/main.tf b/azure/compute_virtualmachines/examples/tf/main.tf index 467ada3..098abe8 100644 --- a/azure/compute_virtualmachines/examples/tf/main.tf +++ b/azure/compute_virtualmachines/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-compute-vm" + default = "ex-compute-vm" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -47,9 +47,9 @@ resource "azurerm_network_interface" "primary" { } resource "azurerm_network_interface" "internal" { - name = "${var.prefix}-internal-net" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location + name = "${var.prefix}-internal-net" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location ip_configuration { name = "internal" @@ -81,16 +81,16 @@ resource "azurerm_network_interface_security_group_association" "example" { } resource "azurerm_virtual_machine" "vm" { - name = "${var.prefix}-vm1" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - vm_size = "Standard_A1_v2" + name = "${var.prefix}-vm1" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + vm_size = "Standard_A1_v2" network_interface_ids = [ azurerm_network_interface.primary.id, azurerm_network_interface.internal.id ] primary_network_interface_id = azurerm_network_interface.primary.id - + delete_os_disk_on_termination = true storage_image_reference { @@ -101,9 +101,9 @@ resource "azurerm_virtual_machine" "vm" { } storage_os_disk { - caching = "ReadWrite" - name = "osdisk1" - create_option = "FromImage" + caching = "ReadWrite" + name = "osdisk1" + create_option = "FromImage" managed_disk_type = "Standard_LRS" } diff --git a/azure/containerregistry_registries/dashboards/overview/main.tf b/azure/containerregistry_registries/dashboards/overview/main.tf index 339dd32..a46a392 100644 --- a/azure/containerregistry_registries/dashboards/overview/main.tf +++ b/azure/containerregistry_registries/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Container Registry Metrics" + project_name = var.lightstep_project + dashboard_name = "Container Registry Metrics" dashboard_description = "Monitor Container Registry with this metrics overview dashboard." chart { diff --git a/azure/containerregistry_registries/examples/tf/main.tf b/azure/containerregistry_registries/examples/tf/main.tf index aac2234..e0d17b7 100644 --- a/azure/containerregistry_registries/examples/tf/main.tf +++ b/azure/containerregistry_registries/examples/tf/main.tf @@ -4,17 +4,17 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exContainerRegistry" + default = "exContainerRegistry" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } resource "azurerm_container_registry" "example" { name = "${var.prefix}registry" - resource_group_name = "${azurerm_resource_group.example.name}" - location = "${azurerm_resource_group.example.location}" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location sku = "Standard" } diff --git a/azure/containerservice_managedclusters/dashboards/overview/main.tf b/azure/containerservice_managedclusters/dashboards/overview/main.tf index dc8ba08..5054752 100644 --- a/azure/containerservice_managedclusters/dashboards/overview/main.tf +++ b/azure/containerservice_managedclusters/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Container Service Managed Clusters Metrics" + project_name = var.lightstep_project + dashboard_name = "Container Service Managed Clusters Metrics" dashboard_description = "Monitor Container Service Managed Clusters with this metrics overview dashboard." chart { diff --git a/azure/containerservice_managedclusters/examples/tf/main.tf b/azure/containerservice_managedclusters/examples/tf/main.tf index b0949a1..ca7af17 100644 --- a/azure/containerservice_managedclusters/examples/tf/main.tf +++ b/azure/containerservice_managedclusters/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-container-cluster" + default = "ex-container-cluster" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/dbformariadb_servers/dashboards/overview/main.tf b/azure/dbformariadb_servers/dashboards/overview/main.tf index 1381862..10de4bc 100644 --- a/azure/dbformariadb_servers/dashboards/overview/main.tf +++ b/azure/dbformariadb_servers/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "MariaDB Servers Metrics" + project_name = var.lightstep_project + dashboard_name = "MariaDB Servers Metrics" dashboard_description = "Monitor MariaDB Servers with this metrics overview dashboard." chart { diff --git a/azure/dbformariadb_servers/examples/tf/main.tf b/azure/dbformariadb_servers/examples/tf/main.tf index f7da5d4..3797578 100644 --- a/azure/dbformariadb_servers/examples/tf/main.tf +++ b/azure/dbformariadb_servers/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-maria" + default = "ex-maria" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/dbformysql_flexibleservers/dashboards/overview/main.tf b/azure/dbformysql_flexibleservers/dashboards/overview/main.tf index 57437a0..e4758b9 100644 --- a/azure/dbformysql_flexibleservers/dashboards/overview/main.tf +++ b/azure/dbformysql_flexibleservers/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "MySQL Flexible Servers Metrics" + project_name = var.lightstep_project + dashboard_name = "MySQL Flexible Servers Metrics" dashboard_description = "Monitor MySQL Flexible Servers with this metrics overview dashboard." chart { diff --git a/azure/dbformysql_flexibleservers/examples/tf/main.tf b/azure/dbformysql_flexibleservers/examples/tf/main.tf index 99bc778..af2ce2e 100644 --- a/azure/dbformysql_flexibleservers/examples/tf/main.tf +++ b/azure/dbformysql_flexibleservers/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-mysql-flexible" + default = "ex-mysql-flexible" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/dbformysql_servers/dashboards/overview/main.tf b/azure/dbformysql_servers/dashboards/overview/main.tf index ffe3ed9..6330b44 100644 --- a/azure/dbformysql_servers/dashboards/overview/main.tf +++ b/azure/dbformysql_servers/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "MySQL Servers Metrics" + project_name = var.lightstep_project + dashboard_name = "MySQL Servers Metrics" dashboard_description = "Monitor MySQL Servers with this metrics overview dashboard." chart { diff --git a/azure/dbformysql_servers/examples/tf/main.tf b/azure/dbformysql_servers/examples/tf/main.tf index a4993af..68466a7 100644 --- a/azure/dbformysql_servers/examples/tf/main.tf +++ b/azure/dbformysql_servers/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-mysql-servers" + default = "ex-mysql-servers" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -34,7 +34,7 @@ resource "azurerm_mysql_server" "example" { } resource "azurerm_mysql_database" "example" { - name = "${var.prefix}" + name = var.prefix resource_group_name = azurerm_resource_group.example.name server_name = azurerm_mysql_server.example.name charset = "utf8" diff --git a/azure/dbforpostgresql_flexibleservers/dashboards/overview/main.tf b/azure/dbforpostgresql_flexibleservers/dashboards/overview/main.tf index 875f203..2e13d03 100644 --- a/azure/dbforpostgresql_flexibleservers/dashboards/overview/main.tf +++ b/azure/dbforpostgresql_flexibleservers/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "PostgreSQL Flexible Servers Metrics" + project_name = var.lightstep_project + dashboard_name = "PostgreSQL Flexible Servers Metrics" dashboard_description = "Monitor PostgreSQL Flexible Servers with this metrics overview dashboard." chart { diff --git a/azure/dbforpostgresql_flexibleservers/examples/tf/main.tf b/azure/dbforpostgresql_flexibleservers/examples/tf/main.tf index 143a34d..02acd16 100644 --- a/azure/dbforpostgresql_flexibleservers/examples/tf/main.tf +++ b/azure/dbforpostgresql_flexibleservers/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-postgre-flexible" + default = "ex-postgre-flexible" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/dbforpostgresql_servers/dashboards/overview/main.tf b/azure/dbforpostgresql_servers/dashboards/overview/main.tf index 2530210..71b3890 100644 --- a/azure/dbforpostgresql_servers/dashboards/overview/main.tf +++ b/azure/dbforpostgresql_servers/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "PostgreSQL Servers Metrics" + project_name = var.lightstep_project + dashboard_name = "PostgreSQL Servers Metrics" dashboard_description = "Monitor PostgreSQL Servers with this metrics overview dashboard." chart { diff --git a/azure/dbforpostgresql_servers/examples/tf/main.tf b/azure/dbforpostgresql_servers/examples/tf/main.tf index 1488bb3..1a3305a 100644 --- a/azure/dbforpostgresql_servers/examples/tf/main.tf +++ b/azure/dbforpostgresql_servers/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-postgre-servers" + default = "ex-postgre-servers" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/documentdb_cassandraclusters/dashboards/overview/main.tf b/azure/documentdb_cassandraclusters/dashboards/overview/main.tf index ae724de..b71a6be 100644 --- a/azure/documentdb_cassandraclusters/dashboards/overview/main.tf +++ b/azure/documentdb_cassandraclusters/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "DocumentDB Cassandra Clusters Metrics" + project_name = var.lightstep_project + dashboard_name = "DocumentDB Cassandra Clusters Metrics" dashboard_description = "[Beta] Monitor DocumentDB Cassandra Clusters with this metrics overview dashboard." chart { diff --git a/azure/documentdb_cassandraclusters/examples/tf/main.tf b/azure/documentdb_cassandraclusters/examples/tf/main.tf index f135405..2807110 100644 --- a/azure/documentdb_cassandraclusters/examples/tf/main.tf +++ b/azure/documentdb_cassandraclusters/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-docdb-cassandra" + default = "ex-docdb-cassandra" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/documentdb_databaseaccounts/dashboards/overview/main.tf b/azure/documentdb_databaseaccounts/dashboards/overview/main.tf index 89ec763..17b3e83 100644 --- a/azure/documentdb_databaseaccounts/dashboards/overview/main.tf +++ b/azure/documentdb_databaseaccounts/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "DocumentDB Database Accounts Metrics" + project_name = var.lightstep_project + dashboard_name = "DocumentDB Database Accounts Metrics" dashboard_description = "Monitor DocumentDB Database Accounts with this metrics overview dashboard." chart { diff --git a/azure/documentdb_databaseaccounts/examples/tf/main.tf b/azure/documentdb_databaseaccounts/examples/tf/main.tf index 41a7443..7a0dc5a 100644 --- a/azure/documentdb_databaseaccounts/examples/tf/main.tf +++ b/azure/documentdb_databaseaccounts/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-cosmosdb" + default = "ex-cosmosdb" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/network_networkinterfaces/dashboards/overview/main.tf b/azure/network_networkinterfaces/dashboards/overview/main.tf index b1e899e..d541910 100644 --- a/azure/network_networkinterfaces/dashboards/overview/main.tf +++ b/azure/network_networkinterfaces/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Network Interfaces Metrics" + project_name = var.lightstep_project + dashboard_name = "Network Interfaces Metrics" dashboard_description = "Monitor Network Interfaces with this metrics overview dashboard." chart { diff --git a/azure/network_networkinterfaces/examples/tf/main.tf b/azure/network_networkinterfaces/examples/tf/main.tf index 9f5fdfa..a412ad0 100644 --- a/azure/network_networkinterfaces/examples/tf/main.tf +++ b/azure/network_networkinterfaces/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-network-ni" + default = "ex-network-ni" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -47,9 +47,9 @@ resource "azurerm_network_interface" "primary" { } resource "azurerm_network_interface" "internal" { - name = "${var.prefix}-internal-net" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location + name = "${var.prefix}-internal-net" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location ip_configuration { name = "internal" @@ -81,16 +81,16 @@ resource "azurerm_network_interface_security_group_association" "example" { } resource "azurerm_virtual_machine" "vm" { - name = "${var.prefix}-vm1" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - vm_size = "Standard_A1_v2" + name = "${var.prefix}-vm1" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + vm_size = "Standard_A1_v2" network_interface_ids = [ azurerm_network_interface.primary.id, azurerm_network_interface.internal.id ] primary_network_interface_id = azurerm_network_interface.primary.id - + delete_os_disk_on_termination = true storage_image_reference { @@ -101,9 +101,9 @@ resource "azurerm_virtual_machine" "vm" { } storage_os_disk { - caching = "ReadWrite" - name = "osdisk1" - create_option = "FromImage" + caching = "ReadWrite" + name = "osdisk1" + create_option = "FromImage" managed_disk_type = "Standard_LRS" } diff --git a/azure/sql_managedinstances/dashboards/overview/main.tf b/azure/sql_managedinstances/dashboards/overview/main.tf index 169ce33..62cd625 100644 --- a/azure/sql_managedinstances/dashboards/overview/main.tf +++ b/azure/sql_managedinstances/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "SQL Managed Instances Metrics" + project_name = var.lightstep_project + dashboard_name = "SQL Managed Instances Metrics" dashboard_description = "[Beta] Monitor SQL Managed Instances with this metrics overview dashboard." chart { diff --git a/azure/sql_managedinstances/examples/tf/main.tf b/azure/sql_managedinstances/examples/tf/main.tf index b20b735..3b1cee4 100644 --- a/azure/sql_managedinstances/examples/tf/main.tf +++ b/azure/sql_managedinstances/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-sql-mi" + default = "ex-sql-mi" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/sql_servers_databases/dashboards/overview/main.tf b/azure/sql_servers_databases/dashboards/overview/main.tf index 8c03741..1ced958 100644 --- a/azure/sql_servers_databases/dashboards/overview/main.tf +++ b/azure/sql_servers_databases/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "SQL Servers Databases Metrics" + project_name = var.lightstep_project + dashboard_name = "SQL Servers Databases Metrics" dashboard_description = "Monitor SQL Servers Databases with this metrics overview dashboard." chart { diff --git a/azure/sql_servers_databases/examples/tf/main.tf b/azure/sql_servers_databases/examples/tf/main.tf index 600b473..42ffb28 100644 --- a/azure/sql_servers_databases/examples/tf/main.tf +++ b/azure/sql_servers_databases/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-sql-servers-db" + default = "ex-sql-servers-db" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -30,10 +30,10 @@ resource "azurerm_mssql_server" "example" { } resource "azurerm_mssql_database" "example" { - name = "${var.prefix}-db" - server_id = azurerm_mssql_server.example.id - collation = "SQL_Latin1_General_CP1_CI_AS" - license_type = "LicenseIncluded" - max_size_gb = 2 - sku_name = "S0" + name = "${var.prefix}-db" + server_id = azurerm_mssql_server.example.id + collation = "SQL_Latin1_General_CP1_CI_AS" + license_type = "LicenseIncluded" + max_size_gb = 2 + sku_name = "S0" } diff --git a/azure/sql_servers_elasticpools/dashboards/overview/main.tf b/azure/sql_servers_elasticpools/dashboards/overview/main.tf index f06f5c4..aa77111 100644 --- a/azure/sql_servers_elasticpools/dashboards/overview/main.tf +++ b/azure/sql_servers_elasticpools/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "SQL Servers Elastic Pools Metrics" + project_name = var.lightstep_project + dashboard_name = "SQL Servers Elastic Pools Metrics" dashboard_description = "Monitor SQL Servers Elastic Pools with this metrics overview dashboard." chart { diff --git a/azure/sql_servers_elasticpools/examples/tf/main.tf b/azure/sql_servers_elasticpools/examples/tf/main.tf index 8df09e0..3b2bb51 100644 --- a/azure/sql_servers_elasticpools/examples/tf/main.tf +++ b/azure/sql_servers_elasticpools/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-sql-servers-elastic" + default = "ex-sql-servers-elastic" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/storage_storageaccounts/dashboards/overview/main.tf b/azure/storage_storageaccounts/dashboards/overview/main.tf index 26b3ffe..eceb0ce 100644 --- a/azure/storage_storageaccounts/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Accounts Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Accounts Metrics" dashboard_description = "Monitor Storage Accounts with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts/examples/tf/main.tf b/azure/storage_storageaccounts/examples/tf/main.tf index 49417d3..b94a82e 100644 --- a/azure/storage_storageaccounts/examples/tf/main.tf +++ b/azure/storage_storageaccounts/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "ex-storage-account" + default = "ex-storage-account" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } @@ -30,10 +30,10 @@ resource "azurerm_mssql_server" "example" { } resource "azurerm_mssql_database" "example" { - name = "${var.prefix}-db" - server_id = azurerm_mssql_server.example.id - collation = "SQL_Latin1_General_CP1_CI_AS" - license_type = "LicenseIncluded" - max_size_gb = 2 - sku_name = "S0" + name = "${var.prefix}-db" + server_id = azurerm_mssql_server.example.id + collation = "SQL_Latin1_General_CP1_CI_AS" + license_type = "LicenseIncluded" + max_size_gb = 2 + sku_name = "S0" } diff --git a/azure/storage_storageaccounts_blobservices/dashboards/overview/main.tf b/azure/storage_storageaccounts_blobservices/dashboards/overview/main.tf index 44aaed2..19e836f 100644 --- a/azure/storage_storageaccounts_blobservices/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_blobservices/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Blob Services Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Blob Services Metrics" dashboard_description = "Monitor Storage Blob Services with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_blobservices/examples/tf/main.tf b/azure/storage_storageaccounts_blobservices/examples/tf/main.tf index 75f5121..4339e1a 100644 --- a/azure/storage_storageaccounts_blobservices/examples/tf/main.tf +++ b/azure/storage_storageaccounts_blobservices/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exstorageblob" + default = "exstorageblob" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/storage_storageaccounts_fileservices/dashboards/overview/main.tf b/azure/storage_storageaccounts_fileservices/dashboards/overview/main.tf index 1dc1711..9f0baf2 100644 --- a/azure/storage_storageaccounts_fileservices/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_fileservices/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage File Services Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage File Services Metrics" dashboard_description = "Monitor Storage File Services with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_fileservices/examples/tf/main.tf b/azure/storage_storageaccounts_fileservices/examples/tf/main.tf index 3088330..6a5fd3e 100644 --- a/azure/storage_storageaccounts_fileservices/examples/tf/main.tf +++ b/azure/storage_storageaccounts_fileservices/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exstoragefile" + default = "exstoragefile" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/storage_storageaccounts_objectreplicationpolicies/dashboards/overview/main.tf b/azure/storage_storageaccounts_objectreplicationpolicies/dashboards/overview/main.tf index e67ae5d..8b68f7e 100644 --- a/azure/storage_storageaccounts_objectreplicationpolicies/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_objectreplicationpolicies/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Object Replication Policies Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Object Replication Policies Metrics" dashboard_description = "[Beta] Monitor Storage Object Replication Policies with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_objectreplicationpolicies/examples/tf/main.tf b/azure/storage_storageaccounts_objectreplicationpolicies/examples/tf/main.tf index 6b540a9..f3c6e61 100644 --- a/azure/storage_storageaccounts_objectreplicationpolicies/examples/tf/main.tf +++ b/azure/storage_storageaccounts_objectreplicationpolicies/examples/tf/main.tf @@ -4,7 +4,7 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exstoragereplica" + default = "exstoragereplica" } resource "azurerm_resource_group" "src" { diff --git a/azure/storage_storageaccounts_queueservices/dashboards/overview/main.tf b/azure/storage_storageaccounts_queueservices/dashboards/overview/main.tf index e5feec2..f597f4b 100644 --- a/azure/storage_storageaccounts_queueservices/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_queueservices/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Queue Services Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Queue Services Metrics" dashboard_description = "Monitor Storage Queue Services with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_queueservices/examples/tf/main.tf b/azure/storage_storageaccounts_queueservices/examples/tf/main.tf index 18ddb32..5e3fcd8 100644 --- a/azure/storage_storageaccounts_queueservices/examples/tf/main.tf +++ b/azure/storage_storageaccounts_queueservices/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exstoragequeue" + default = "exstoragequeue" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/azure/storage_storageaccounts_storagetasks/dashboards/overview/main.tf b/azure/storage_storageaccounts_storagetasks/dashboards/overview/main.tf index fb5d69d..ba30e17 100644 --- a/azure/storage_storageaccounts_storagetasks/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_storagetasks/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Tasks Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Tasks Metrics" dashboard_description = "[Beta] Monitor Storage Tasks with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_tableservices/dashboards/overview/main.tf b/azure/storage_storageaccounts_tableservices/dashboards/overview/main.tf index c51eef5..80ed797 100644 --- a/azure/storage_storageaccounts_tableservices/dashboards/overview/main.tf +++ b/azure/storage_storageaccounts_tableservices/dashboards/overview/main.tf @@ -19,8 +19,8 @@ output "dashboard_url" { } resource "lightstep_dashboard" "otel_collector_dashboard" { - project_name = var.lightstep_project - dashboard_name = "Storage Table Services Metrics" + project_name = var.lightstep_project + dashboard_name = "Storage Table Services Metrics" dashboard_description = "Monitor Storage Table Services with this metrics overview dashboard." chart { diff --git a/azure/storage_storageaccounts_tableservices/examples/tf/main.tf b/azure/storage_storageaccounts_tableservices/examples/tf/main.tf index 031418f..b60b3d0 100644 --- a/azure/storage_storageaccounts_tableservices/examples/tf/main.tf +++ b/azure/storage_storageaccounts_tableservices/examples/tf/main.tf @@ -4,11 +4,11 @@ provider "azurerm" { variable "prefix" { description = "A prefix used for all resources in this example" - default = "exstoragetable" + default = "exstoragetable" } resource "azurerm_resource_group" "example" { - name = "${var.prefix}" + name = var.prefix location = "East US" } diff --git a/collector/ghosttunnel/examples/compose/Makefile b/collector/ghosttunnel/examples/compose/Makefile new file mode 100644 index 0000000..689bb19 --- /dev/null +++ b/collector/ghosttunnel/examples/compose/Makefile @@ -0,0 +1,38 @@ +# Makefile for setting up Ghostunnel with Prometheus metrics and OTel Collector + +.PHONY: certs build run stop clean + +CERT_DIR := certs + +# Generates necessary certificates for Ghostunnel +certs: + @mkdir -p $(CERT_DIR) + openssl genpkey -algorithm RSA -out $(CERT_DIR)/ca-key.pem + openssl req -new -x509 -key $(CERT_DIR)/ca-key.pem -out $(CERT_DIR)/ca-cert.pem -days 3650 -subj "/C=US/ST=ExampleState/L=ExampleCity/O=ExampleOrg/OU=ExampleUnit/CN=ca.example.com" + openssl genpkey -algorithm RSA -out $(CERT_DIR)/server-key.pem + openssl req -new -key $(CERT_DIR)/server-key.pem -out $(CERT_DIR)/server-req.csr -subj "/C=US/ST=ExampleState/L=ExampleCity/O=ExampleOrg/OU=ExampleUnit/CN=server.example.com" + openssl x509 -req -in $(CERT_DIR)/server-req.csr -CA $(CERT_DIR)/ca-cert.pem -CAkey $(CERT_DIR)/ca-key.pem -CAcreateserial -out $(CERT_DIR)/server-cert.pem -days 365 + openssl genpkey -algorithm RSA -out $(CERT_DIR)/client-key.pem + openssl req -new -key $(CERT_DIR)/client-key.pem -out $(CERT_DIR)/client-req.csr -subj "/C=US/ST=ExampleState/L=ExampleCity/O=ExampleOrg/OU=ExampleUnit/CN=client.example.com" + openssl x509 -req -in $(CERT_DIR)/client-req.csr -CA $(CERT_DIR)/ca-cert.pem -CAkey $(CERT_DIR)/ca-key.pem -CAcreateserial -out $(CERT_DIR)/client-cert.pem -days 365 + openssl pkcs12 -export -in $(CERT_DIR)/server-cert.pem -inkey $(CERT_DIR)/server-key.pem -out $(CERT_DIR)/server-keystore.p12 -password pass:password + openssl pkcs12 -export -in $(CERT_DIR)/client-cert.pem -inkey $(CERT_DIR)/client-key.pem -out $(CERT_DIR)/client-keystore.p12 -password pass:password + +# Build Docker images for Ghostunnel +build: + docker-compose build + +# Start Ghostunnel and OTel Collector services +run: + docker-compose up -d + +# Stop services +stop: + docker-compose down + +# Cleanup generated certificates +clean: + rm -rf $(CERT_DIR) + +# Full setup (generate certs, build images, run services) +all: certs build run diff --git a/collector/ghosttunnel/examples/compose/README.md b/collector/ghosttunnel/examples/compose/README.md new file mode 100644 index 0000000..3cf3931 --- /dev/null +++ b/collector/ghosttunnel/examples/compose/README.md @@ -0,0 +1,36 @@ +# Monitor NATS with the OpenTelemetry Collector for Lightstep + +## Overview + +NATS is a simple, secure, and high-performance open source messaging system. To maintain the reliability and performance of a NATS setup, it's crucial to have real-time monitoring. With the OpenTelemetry Collector, metrics from NATS can be effectively channeled to Lightstep for comprehensive analysis and visualization. This README will guide you through integrating NATS metrics with Lightstep using the OpenTelemetry Collector. + +## Prerequisites + +* Docker +* Docker Compose +* A Lightstep Observability account +* Lightstep Observability [access token][ls-docs-access-token] + +## How to set it up + +1. **Export your Lightstep access token**: + ```bash + export LS_ACCESS_TOKEN= + ``` +2. **Run the docker compose example to spin up NATS and the OpenTelemetry Collector**: + ```bash + docker-compose up -d + ``` +3. **Access the NATS dashboard**: Depending on your setup, typically you can visit a web UI to manage and observe NATS. In our case, you can NATS node 1 dashboard at `http://localhost:8222/`. +4. **Monitor NATS Metrics in Lightstep**: After setting things up, NATS metrics should start populating in your Lightstep dashboard. +5. **Shutting down the monitoring setup**: + ```bash + docker-compose down + ``` + +## Configuring NATS for Advanced Monitoring + +This guide assumes a standard NATS setup. However, NATS offers a variety of configuration options that can impact the metrics it provides. For in-depth configurations and best practices, always refer to [the official NATS documentation][nats-docs]. + +[ls-docs-access-token]: https://docs.lightstep.com/docs/create-and-manage-access-tokens +[nats-docs]: https://docs.nats.io/running-a-nats-service/nats_admin/monitoring diff --git a/collector/ghosttunnel/examples/compose/collector.yaml b/collector/ghosttunnel/examples/compose/collector.yaml new file mode 100644 index 0000000..533bb98 --- /dev/null +++ b/collector/ghosttunnel/examples/compose/collector.yaml @@ -0,0 +1,31 @@ +receivers: + prometheus: + config: + scrape_configs: + - job_name: 'ghostunnel-server' + metrics_path: '/_metrics/prometheus' + static_configs: + - targets: ['ghostunnel-server:6060'] + - job_name: 'ghostunnel-client' + metrics_path: '/_metrics/prometheus' + static_configs: + - targets: ['ghostunnel-client:6061'] + +processors: + batch: + +exporters: + logging: + loglevel: debug + # otlp: + # endpoint: ingest.lightstep.com:443 + #headers: + #- lightstep-access-token: ${LS_ACCESS_TOKEN} + +service: + pipelines: + metrics: + receivers: [prometheus] + processors: [batch] + exporters: [logging] + #exporters: [logging, otlp] diff --git a/collector/ghosttunnel/examples/compose/docker-compose.yaml b/collector/ghosttunnel/examples/compose/docker-compose.yaml new file mode 100644 index 0000000..b0b8d56 --- /dev/null +++ b/collector/ghosttunnel/examples/compose/docker-compose.yaml @@ -0,0 +1,50 @@ +version: "3.9" + +services: + otel-collector: + image: otel/opentelemetry-collector-contrib:${OTEL_VERSION:-0.81.0} + hostname: otel-collector + restart: always + command: [ "--config=/conf/collector.yaml" ] + volumes: + - ./collector.yaml:/conf/collector.yaml:rw + environment: + LS_ACCESS_TOKEN: ${LS_ACCESS_TOKEN} + depends_on: + - ghostunnel-server + + ghostunnel-server: + image: ghostunnel/ghostunnel:latest + hostname: ghostunnel-server + command: + - server + - "--listen=localhost:8443" + - "--target=localhost:8080" + - "--keystore=/certs/server-keystore.p12" + - "--storepass=password" + - "--cacert=/certs/ca-cert.pem" + - "--status=localhost:6060" + - "--allow-all" + ports: + - "8443:8443" + - "8080:8080" + - "6060:6060" # Expose server's metrics port + volumes: + - ./certs:/certs + + ghostunnel-client: + image: ghostunnel/ghostunnel + depends_on: + - ghostunnel-server # Ensure server is up before the client + command: + - client + - "--listen=localhost:8081" + - "--target=ghostunnel-server:8443" + - "--keystore=/certs/client-keystore.p12" + - "--storepass=password" + - "--status=localhost:6061" + volumes: + - ./certs/client-keystore.p12:/certs/client-keystore.p12 + ports: + - "8081:8081" # Expose client's local port to the host + - "6061:6061" # Expose client's metrics port to the host diff --git a/tools/internal/text/text.go b/tools/internal/text/text.go index 37107b1..a8f558f 100644 --- a/tools/internal/text/text.go +++ b/tools/internal/text/text.go @@ -14,13 +14,11 @@ var ( ErrEmptyKeyOrValue = errors.New("empty key or value in pair") ) -type Context any - -// Validate is a run-time type check to ensure that the Context is one of +// Validate is a run-time type check to ensure the variable is one of // - a string with key=value pairs delimited by commas: e.g. "ServicePort=8888,ScrapePort=9090" // - a map of type map[string]any // - any Go struct -func Validate(c Context) error { +func Validate(c interface{}) error { switch v := c.(type) { case string: _, err := ParseKeyValuePairs(v) @@ -72,6 +70,6 @@ func ParseKeyValuePairs(input string) (map[string]string, error) { // 2. // // Type notes: if you know how to constrain -func TemplateFileRender(path string, c Context) ([]byte, error) { +func TemplateFileRender(path string, c interface{}) ([]byte, error) { return nil, nil } diff --git a/tools/internal/text/text_test.go b/tools/internal/text/text_test.go index 218c420..b2da9da 100644 --- a/tools/internal/text/text_test.go +++ b/tools/internal/text/text_test.go @@ -11,7 +11,7 @@ import ( func TestValidate(t *testing.T) { tests := []struct { - input text.Context + input interface{} isValid bool errMsg error }{