Skip to content

Commit

Permalink
chore: change various telegraf configuration details
Browse files Browse the repository at this point in the history
In the base images, Telegraf has been disabled from automatically starting, because we don't want it
to start transmitting new metric names to the production database. Various lines for starting the
service have been commented out. These can be enabled again when we have the setup working.

Environment variables related to Telegraf are now prefixed with `ANTNODE_` or `ANT_` rather than
safe-based prefixes.

There's also a change in here to get `antcltd` to deploy correctly when a version-based deployment
is used.
  • Loading branch information
jacderida committed Dec 5, 2024
1 parent b9d97b8 commit 5f8406b
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 59 deletions.
9 changes: 9 additions & 0 deletions resources/ansible/create_node_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@
roles:
- role: prerequisites
- role: filebeat
# Right now we are in a situation where we don't want Telegraf to be started automatically because
# we don't want metrics with new names to be forwarded to the existing production infrastructure.
tasks:
- name: stop telegraf
become: True
ansible.builtin.systemd:
name: telegraf
state: stopped
enabled: no
25 changes: 9 additions & 16 deletions resources/ansible/nodes.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
---
- name: copy logstash certificate to nodes
hosts: all
become: False
max_fail_percentage: 10
ignore_unreachable: yes
tasks:
- name: copy public logstash certificate to node
copy:
src: logstash-{{ logstash_stack_name }}-public.crt
dest: /tmp/logstash-{{ logstash_stack_name }}-public.crt
mode: 0644
when: logstash_stack_name is defined and logstash_stack_name | length > 0

- name: deploy antnode to remaining nodes
hosts: all
become: False
Expand Down Expand Up @@ -52,9 +39,15 @@
name: systemd-journald
state: restarted
enabled: yes
- name: restart telegraf
# - name: restart telegraf
# become: True
# ansible.builtin.systemd:
# name: telegraf
# state: restarted
# enabled: yes
- name: stop telegraf
become: True
ansible.builtin.systemd:
name: telegraf
state: restarted
enabled: yes
state: stopped
enabled: no
1 change: 0 additions & 1 deletion resources/ansible/roles/node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
- --data-dir-path=/mnt/antnode-storage/data
- --log-dir-path=/mnt/antnode-storage/log
- "--count={{ nodes_to_add }}"
- "--owner=maidsafe"
- "--peer={{ genesis_multiaddr }}"
- "--rpc-address={{ node_rpc_ip }}"
- "--rewards-address={{ rewards_address }}"
Expand Down
30 changes: 15 additions & 15 deletions resources/ansible/roles/telegraf-configuration/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,31 @@
dest: /etc/default/telegraf
remote_src: yes

- name: replace SAFENODE_TESTNET_NAME value
- name: replace ANTNODE_TESTNET_NAME value
replace:
path: "/etc/default/telegraf"
regexp: 'SAFENODE_TESTNET_NAME=UNDEFINED'
replace: 'SAFENODE_TESTNET_NAME={{ testnet_name | upper }}'
regexp: 'ANTNODE_TESTNET_NAME=UNDEFINED'
replace: 'ANTNODE_TESTNET_NAME={{ testnet_name | upper }}'

- name: replace SAFENODE_HOST_ROLE value
- name: replace ANTNODE_HOST_ROLE value
replace:
path: "/etc/default/telegraf"
regexp: 'SAFENODE_HOST_ROLE=UNDEFINED'
replace: 'SAFENODE_HOST_ROLE={{ node_type | upper }}'
regexp: 'ANTNODE_HOST_ROLE=UNDEFINED'
replace: 'ANTNODE_HOST_ROLE={{ node_type | upper }}'

# The real branch name will be supplied later, when it is available in `safenode`.
- name: replace SAFENODE_BRANCH_NAME value
- name: replace ANTNODE_BRANCH_NAME value
replace:
path: "/etc/default/telegraf"
regexp: "SAFENODE_BRANCH_NAME=UNDEFINED"
replace: "SAFENODE_BRANCH_NAME=STABLE"
regexp: "ANTNODE_BRANCH_NAME=UNDEFINED"
replace: "ANTNODE_BRANCH_NAME=STABLE"

# The real commit hash will be supplied later, when it is available in `safenode`.
- name: replace SAFENODE_BRANCH_COMMIT value
- name: replace ANTNODE_BRANCH_COMMIT value
replace:
path: "/etc/default/telegraf"
regexp: "SAFENODE_BRANCH_COMMIT=UNDEFINED"
replace: "SAFENODE_BRANCH_COMMIT=UNDEFINED"
regexp: "ANTNODE_BRANCH_COMMIT=UNDEFINED"
replace: "ANTNODE_BRANCH_COMMIT=UNDEFINED"

- name: copy telegraf config file
copy:
Expand Down Expand Up @@ -109,9 +109,9 @@
become: True
command: systemctl daemon-reload

- name: reload the configuration files for systemctl daemon
become: True
command: systemctl start telegraf-elasticsearch.service
# - name: reload the configuration files for systemctl daemon
# become: True
# command: systemctl start telegraf-elasticsearch.service

# - name: start telegraf service
# systemd:
Expand Down
24 changes: 12 additions & 12 deletions resources/ansible/roles/uploader-metrics/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,31 @@
dest: /etc/default/telegraf
remote_src: yes

- name: replace SAFE_UPLOADER_TESTNET_NAME value
- name: replace ANT_UPLOADER_TESTNET_NAME value
replace:
path: "/etc/default/telegraf"
regexp: 'SAFE_UPLOADER_TESTNET_NAME=UNDEFINED'
replace: 'SAFE_UPLOADER_TESTNET_NAME={{ testnet_name | upper }}'
regexp: 'ANT_UPLOADER_TESTNET_NAME=UNDEFINED'
replace: 'ANT_UPLOADER_TESTNET_NAME={{ testnet_name | upper }}'

- name: replace SAFE_UPLOADER_HOST_ROLE value
- name: replace ANT_UPLOADER_HOST_ROLE value
replace:
path: "/etc/default/telegraf"
regexp: 'SAFE_UPLOADER_HOST_ROLE=UNDEFINED'
replace: 'SAFE_UPLOADER_HOST_ROLE=UPLOADER_NODE'
regexp: 'ANT_UPLOADER_HOST_ROLE=UNDEFINED'
replace: 'ANT_UPLOADER_HOST_ROLE=UPLOADER_NODE'

# The real branch name will be supplied later, when it is available in `safenode`.
- name: replace SAFE_UPLOADER_BRANCH_NAME value
- name: replace ANT_UPLOADER_BRANCH_NAME value
replace:
path: "/etc/default/telegraf"
regexp: "SAFE_UPLOADER_BRANCH_NAME=UNDEFINED"
replace: "SAFE_UPLOADER_BRANCH_NAME=STABLE"
regexp: "ANT_UPLOADER_BRANCH_NAME=UNDEFINED"
replace: "ANT_UPLOADER_BRANCH_NAME=STABLE"

# The real commit hash will be supplied later, when it is available in `safenode`.
- name: replace SAFE_UPLOADER_BRANCH_COMMIT value
- name: replace ANT_UPLOADER_BRANCH_COMMIT value
replace:
path: "/etc/default/telegraf"
regexp: "SAFE_UPLOADER_BRANCH_COMMIT=UNDEFINED"
replace: "SAFE_UPLOADER_BRANCH_COMMIT=UNDEFINED"
regexp: "ANT_UPLOADER_BRANCH_COMMIT=UNDEFINED"
replace: "ANT_UPLOADER_BRANCH_COMMIT=UNDEFINED"

- name: copy telegraf config file
copy:
Expand Down
14 changes: 10 additions & 4 deletions resources/ansible/uploaders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
name: systemd-journald
state: restarted
enabled: yes
# The Telegraf service seems to need to be rebooted for metrics to start transmitting.
- name: restart telegraf
# # The Telegraf service seems to need to be rebooted for metrics to start transmitting.
# - name: restart telegraf
# become: True
# ansible.builtin.systemd:
# name: telegraf
# state: restarted
# enabled: yes
- name: stop telegraf
become: True
ansible.builtin.systemd:
name: telegraf
state: restarted
enabled: yes
state: stopped
enabled: no
8 changes: 4 additions & 4 deletions resources/terraform/testnet/digital-ocean/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
bootstrap_droplet_size = "s-2vcpu-4gb"
bootstrap_droplet_image_id = 172040723
bootstrap_droplet_image_id = 172129824
bootstrap_node_vm_count = 1
evm_node_droplet_size = "s-4vcpu-8gb"
evm_node_droplet_image_id = 172040852
evm_node_vm_count = 1
nat_gateway_droplet_image_id = 172051596
nat_gateway_droplet_image_id = 172129956
node_droplet_size = "s-4vcpu-8gb"
node_droplet_image_id = 172040547
node_droplet_image_id = 172129019
node_vm_count = 10
private_node_vm_count = 1
setup_nat_gateway = true
uploader_droplet_size = "s-2vcpu-4gb"
uploader_droplet_image_id = 172051523
uploader_droplet_image_id = 172130080
uploader_vm_count = 1
8 changes: 4 additions & 4 deletions resources/terraform/testnet/digital-ocean/staging.tfvars
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
bootstrap_droplet_size = "s-2vcpu-4gb"
bootstrap_droplet_image_id = 172040723
bootstrap_droplet_image_id = 172129824
bootstrap_node_vm_count = 2
evm_node_vm_count = 1
evm_node_droplet_size = "s-4vcpu-8gb"
evm_node_droplet_image_id = 172040852
nat_gateway_droplet_image_id = 172051596
nat_gateway_droplet_image_id = 172129956
node_droplet_size = "s-4vcpu-8gb"
node_droplet_image_id = 172040547
node_droplet_image_id = 172129019
node_vm_count = 39
private_node_vm_count = 1
setup_nat_gateway = true
uploader_droplet_size = "s-2vcpu-4gb"
uploader_droplet_image_id = 172051523
uploader_droplet_image_id = 172130080
uploader_vm_count = 2
6 changes: 3 additions & 3 deletions src/ansible/extra_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ impl ExtraVarsDocBuilder {
repo_owner,
);
}
_ => {
BinaryOption::Versioned { antctl_version, .. } => {
self.add_variable(
"antctld_archive_url",
&format!(
"{}/antctld-latest-x86_64-unknown-linux-musl.tar.gz",
ANTCTL_S3_BUCKET_URL,
"{}/antctld-{}-x86_64-unknown-linux-musl.tar.gz",
ANTCTL_S3_BUCKET_URL, antctl_version
),
);
}
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,7 @@ async fn main() -> Result<()> {
/// The second option is to build from source, which is useful for testing changes from forks.
///
/// The usage of arguments are also validated here.
#[allow(clippy::too_many_arguments)]
async fn get_binary_option(
branch: Option<String>,
protocol_version: Option<String>,
Expand Down

0 comments on commit 5f8406b

Please sign in to comment.