diff --git a/roles/vega_core/defaults/main.yaml b/roles/vega_core/defaults/main.yaml index fa7c58d..2c9b168 100644 --- a/roles/vega_core/defaults/main.yaml +++ b/roles/vega_core/defaults/main.yaml @@ -45,12 +45,15 @@ vega_core_evm_chain_configs: - chain_id: 1 endpoint: "" -vega_core_data_node_bootstrap_peers: [] -vega_core_data_node_postgresql_username: "vega" -vega_core_data_node_postgresql_database: "vega" -vega_core_data_node_postgresql_password: "vega" vega_core_data_node_with_monitoring_optimized_retention: false +# Example +# vega_core_data_node_sql_retention_policies: +# orders: 2 days +# market_data: 14 days +vega_core_data_node_sql_retention_policies: {} vega_core_block_explorer_postgresql_username: "tendermint" vega_core_block_explorer_postgresql_database: "tendermint" vega_core_block_explorer_postgresql_password: "tendermint" + +vega_core_data_node_settings: {} diff --git a/roles/vega_core/templates/home/vega/vega_home/config/data-node/config.toml.j2 b/roles/vega_core/templates/home/vega/vega_home/config/data-node/config.toml.j2 index 0af2294..a17d1b7 100644 --- a/roles/vega_core/templates/home/vega/vega_home/config/data-node/config.toml.j2 +++ b/roles/vega_core/templates/home/vega/vega_home/config/data-node/config.toml.j2 @@ -1,6 +1,6 @@ +GatewayEnabled = true AutoInitialiseFromNetworkHistory = false ChainID = "{{- vega_core_chain_id -}}" -GatewayEnabled = true MaxMemoryPercent = 33 [Admin] @@ -71,9 +71,9 @@ MaxMemoryPercent = 33 [SQLStore.ConnectionConfig] Host = "localhost" Port = 5432 - Username = "{{- vega_core_data_node_postgresql_username -}}" - Password = "{{- vega_core_data_node_postgresql_password -}}" - Database = "{{- vega_core_data_node_postgresql_database -}}" + Username = "{{- vega_core_data_node_settings['SQLStore.ConnectionConfig.Username']|default('vega') -}}" + Password = "{{- vega_core_data_node_settings['SQLStore.ConnectionConfig.Password']|default('vega') -}}" + Database = "{{- vega_core_data_node_settings['SQLStore.ConnectionConfig.Database']|default('vega') -}}" SocketDir = "/tmp" MaxConnLifetime = "30m0s" MaxConnLifetimeJitter = "5m0s" @@ -91,8 +91,8 @@ MaxMemoryPercent = 33 MaxSize = 100 MaxAge = 2 -{% if vega_core_data_node_with_monitoring_optimized_retention %} +{% if vega_core_data_node_with_monitoring_optimized_retention %} [[SQLStore.RetentionPolicies]] HypertableOrCaggName = "balances" DataRetentionPeriod = "7 days" @@ -110,7 +110,7 @@ MaxMemoryPercent = 33 DataRetentionPeriod = "45 days" [[SQLStore.RetentionPolicies]] HypertableOrCaggName = "orders" - DataRetentionPeriod = "45 days" + DataRetentionPeriod = "2 days" [[SQLStore.RetentionPolicies]] HypertableOrCaggName = "trades" DataRetentionPeriod = "45 days" @@ -252,6 +252,12 @@ MaxMemoryPercent = 33 [[SQLStore.RetentionPolicies]] HypertableOrCaggName = "volume_rebate_stats" DataRetentionPeriod = "45 days" +{% elif vega_core_data_node_sql_retention_policies|length > 0 %} +{% for table, period in vega_core_data_node_sql_retention_policies.items() %} + [[SQLStore.RetentionPolicies]] + HypertableOrCaggName = "{{- table -}}" + DataRetentionPeriod = "{{- period -}}" +{% endfor %} {% endif %} [Gateway] @@ -333,13 +339,13 @@ MaxMemoryPercent = 33 Level = "Info" Enabled = true WipeOnStartup = false - Publish = true + Publish = {{ vega_core_data_node_settings['NetworkHistory.Publish']|default(true)|lower }} FetchRetryMax = 10 RetryTimeout = "50s" [NetworkHistory.Store] PeerID = "XXXXXXXXXXXXXXXXXXXXX" PrivKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - BootstrapPeers = [{%- for peer in vega_core_data_node_bootstrap_peers -%} + BootstrapPeers = [{%- for peer in vega_core_data_node_settings['NetworkHistory.Store.BootstrapPeers']|default([]) -%} "{{- peer -}}" {%- if not loop.last %},{% endif -%} {%- endfor -%}] diff --git a/roles/vega_monitoring/tasks/main.yaml b/roles/vega_monitoring/tasks/main.yaml index 89fbb17..4ec24db 100644 --- a/roles/vega_monitoring/tasks/main.yaml +++ b/roles/vega_monitoring/tasks/main.yaml @@ -62,7 +62,7 @@ src: "/tmp/vega-monitoring-{{ os }}-{{ arch }}.zip" dest: "{{ vega_monitoring_home }}" copy: false - ignore_errors: "{{ ansible_check_mode }}" + when: not ansible_check_mode - name: Vega-Monitoring | Validate vega-monitoring version ansible.builtin.command: "{{ vega_monitoring_home }}/vega-monitoring version"