diff --git a/deploy_billing_service.yml b/deploy_billing_service.yml index 6a8d30f..000a0d4 100644 --- a/deploy_billing_service.yml +++ b/deploy_billing_service.yml @@ -9,6 +9,11 @@ billing_service_exporter_base_url: >- {{ lookup('ansible.builtin.env', 'EXPORTER_BASE_URL') | default('http://127.0.0.1:8080', true) }} + billing_service_exporter_sources_json: >- + {{ lookup('ansible.builtin.env', 'EXPORTER_SOURCES_JSON') + | default('', true) }} + billing_service_internal_service_token: >- + {{ lookup('ansible.builtin.vars', 'INTERNAL_SERVICE_TOKEN', default=lookup('ansible.builtin.env', 'INTERNAL_SERVICE_TOKEN') | default('', true)) }} billing_service_database_url: >- {{ lookup('ansible.builtin.env', 'DATABASE_URL') | default('', true) }} @@ -40,5 +45,11 @@ - billing_service_database_url | length > 0 fail_msg: "DATABASE_URL must be exported before running this playbook." success_msg: "DATABASE_URL found" + - name: Validate INTERNAL_SERVICE_TOKEN is present + ansible.builtin.assert: + that: + - billing_service_internal_service_token | length > 0 + fail_msg: "INTERNAL_SERVICE_TOKEN must be exported before running this playbook." + success_msg: "INTERNAL_SERVICE_TOKEN found" roles: - roles/vhosts/billing-service diff --git a/deploy_xray_exporter.yml b/deploy_xray_exporter.yml index daffcfc..dd04270 100644 --- a/deploy_xray_exporter.yml +++ b/deploy_xray_exporter.yml @@ -23,6 +23,12 @@ | default('https://accounts.svc.plus', true) }} xray_exporter_internal_service_token: >- {{ lookup('ansible.builtin.vars', 'INTERNAL_SERVICE_TOKEN', default=lookup('ansible.builtin.env', 'INTERNAL_SERVICE_TOKEN') | default('', true)) }} + xray_exporter_snapshot_store_path: >- + {{ lookup('ansible.builtin.env', 'SNAPSHOT_STORE_PATH') + | default('/var/lib/xray-exporter/snapshots.db', true) }} + xray_exporter_snapshot_retention: >- + {{ lookup('ansible.builtin.env', 'SNAPSHOT_RETENTION') + | default('72h', true) }} xray_exporter_listen_addr: >- {{ lookup('ansible.builtin.env', 'XRAY_EXPORTER_LISTEN_ADDR') | default('127.0.0.1:8080', true) }} diff --git a/roles/vhosts/billing-service/defaults/main.yml b/roles/vhosts/billing-service/defaults/main.yml index 8d122f1..c54a1cc 100644 --- a/roles/vhosts/billing-service/defaults/main.yml +++ b/roles/vhosts/billing-service/defaults/main.yml @@ -15,6 +15,8 @@ billing_service_env_path: "{{ billing_service_env_dir }}/billing-service" billing_service_listen_addr: "127.0.0.1:8081" billing_service_exporter_base_url: "http://127.0.0.1:8080" +billing_service_exporter_sources_json: "" +billing_service_internal_service_token: "" billing_service_database_url: "" billing_service_collect_interval: "1m" billing_service_default_region: "" diff --git a/roles/vhosts/billing-service/templates/billing-service.env.j2 b/roles/vhosts/billing-service/templates/billing-service.env.j2 index 311cc30..805c914 100644 --- a/roles/vhosts/billing-service/templates/billing-service.env.j2 +++ b/roles/vhosts/billing-service/templates/billing-service.env.j2 @@ -1,4 +1,6 @@ EXPORTER_BASE_URL={{ billing_service_exporter_base_url }} +EXPORTER_SOURCES_JSON={{ billing_service_exporter_sources_json }} +INTERNAL_SERVICE_TOKEN={{ billing_service_internal_service_token }} DATABASE_URL={{ billing_service_database_url }} LISTEN_ADDR={{ billing_service_listen_addr }} COLLECT_INTERVAL={{ billing_service_collect_interval }} diff --git a/roles/vhosts/xray-exporter/defaults/main.yml b/roles/vhosts/xray-exporter/defaults/main.yml index a9a8429..9ea3fd9 100644 --- a/roles/vhosts/xray-exporter/defaults/main.yml +++ b/roles/vhosts/xray-exporter/defaults/main.yml @@ -21,3 +21,5 @@ xray_exporter_stats_url: "http://127.0.0.1:49227/debug/vars" xray_exporter_stats_token: "" xray_exporter_accounts_base_url: "https://accounts.svc.plus" xray_exporter_internal_service_token: "" +xray_exporter_snapshot_store_path: "/var/lib/xray-exporter/snapshots.db" +xray_exporter_snapshot_retention: "72h" diff --git a/roles/vhosts/xray-exporter/tasks/main.yml b/roles/vhosts/xray-exporter/tasks/main.yml index 3dd04af..58e14bf 100644 --- a/roles/vhosts/xray-exporter/tasks/main.yml +++ b/roles/vhosts/xray-exporter/tasks/main.yml @@ -50,6 +50,7 @@ loop: - "{{ xray_exporter_app_dir }}" - "{{ xray_exporter_env_dir }}" + - "{{ xray_exporter_snapshot_store_path | dirname }}" - name: Sync xray-exporter source tree ansible.posix.synchronize: diff --git a/roles/vhosts/xray-exporter/templates/xray-exporter.env.j2 b/roles/vhosts/xray-exporter/templates/xray-exporter.env.j2 index 847775e..60629ab 100644 --- a/roles/vhosts/xray-exporter/templates/xray-exporter.env.j2 +++ b/roles/vhosts/xray-exporter/templates/xray-exporter.env.j2 @@ -2,6 +2,8 @@ XRAY_STATS_URL={{ xray_exporter_stats_url }} XRAY_STATS_TOKEN={{ xray_exporter_stats_token }} ACCOUNTS_BASE_URL={{ xray_exporter_accounts_base_url }} INTERNAL_SERVICE_TOKEN={{ xray_exporter_internal_service_token }} +SNAPSHOT_STORE_PATH={{ xray_exporter_snapshot_store_path }} +SNAPSHOT_RETENTION={{ xray_exporter_snapshot_retention }} EXPORTER_NODE_ID={{ xray_exporter_node_id }} EXPORTER_ENV={{ xray_exporter_env_name }} SCRAPE_INTERVAL={{ xray_exporter_scrape_interval }}