Skip to content

Commit

Permalink
feat: refactor vega_core role
Browse files Browse the repository at this point in the history
  • Loading branch information
ehh-why-its-so-hard committed Oct 23, 2024
1 parent f8ac1c8 commit 6c05566
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
11 changes: 7 additions & 4 deletions roles/vega_core/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Check failure on line 50 in roles/vega_core/defaults/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
# 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: {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GatewayEnabled = true
AutoInitialiseFromNetworkHistory = false
ChainID = "{{- vega_core_chain_id -}}"
GatewayEnabled = true
MaxMemoryPercent = 33

[Admin]
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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 -%}]
Expand Down
2 changes: 1 addition & 1 deletion roles/vega_monitoring/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6c05566

Please sign in to comment.