Skip to content

Commit

Permalink
chore: update machine images to ubuntu 24.04
Browse files Browse the repository at this point in the history
Initially the Telegraf configurations don't seem to be working with this new version.
  • Loading branch information
jacderida committed Dec 5, 2024
1 parent 833e4de commit b9d97b8
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 68 deletions.
8 changes: 4 additions & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ build-evm-node-image:
build.pkr.hcl
)
build-staging-bootstrap-image:
build-bootstrap-image:
#!/usr/bin/env bash
(
cd resources/packer/node
packer init .
packer build -var 'size=s-1vcpu-2gb' node.pkr.hcl
)
build-staging-node-image:
build-node-image:
#!/usr/bin/env bash
(
cd resources/packer/node
packer init .
packer build -var 'size=s-2vcpu-4gb' node.pkr.hcl
)
build-staging-uploader-image:
build-uploader-image:
#!/usr/bin/env bash
(
cd resources/packer/node
packer init .
packer build -var 'size=s-2vcpu-4gb' node.pkr.hcl
)
build-prod-nat-gateway-image:
build-nat-gateway-image:
#!/usr/bin/env bash
(
cd resources/packer/node
Expand Down
4 changes: 1 addition & 3 deletions resources/ansible/create_node_image.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
- name: build a custom node image
hosts: all
become: False
become: True
roles:
- role: prerequisites
become: True
- role: filebeat
become: True
42 changes: 38 additions & 4 deletions resources/ansible/roles/prerequisites/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,58 @@
apt:
update_cache: yes

# The retries are for random lock failures.
- name: prerequisites for adding telegraf repository
apt:
name:
- curl
- gnupg
state: present

- name: add influxdata gpg key
ansible.builtin.command: >
curl -fsSL https://repos.influxdata.com/influxdata-archive_compat.key
-o /etc/apt/keyrings/influxdata-archive_compat.key
args:
creates: /etc/apt/keyrings/influxdata-archive_compat.key

- name: add influxdata repository
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/influxdata.list
content: "deb [signed-by=/etc/apt/keyrings/influxdata-archive_compat.key] https://repos.influxdata.com/ubuntu stable main"
owner: root
group: root
mode: '0644'

- name: update apt cache for new repository
apt:
update_cache: yes

- name: install telegraf
apt:
name: telegraf
state: present
register: result
until: result is succeeded
retries: 20
delay: 10

# Retry logic for other package installations
- name: install packages
ansible.builtin.package:
name: "{{ item }}"
state: present
with_items:
- graphviz # for the sn_auditor
- graphviz
- heaptrack
- jq
- python3
- python3-pip
- ripgrep
- telegraf
- zip
register: result
until: result is succeeded
retries: 20
delay: 10

- name: install boto3
- name: Install boto3
ansible.builtin.command: pip3 install boto3 --prefix /usr
10 changes: 5 additions & 5 deletions resources/ansible/roles/uploader-metrics/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
systemd:
daemon_reload: yes

- name: start telegraf service
systemd:
name: telegraf
enabled: yes
state: started
# - name: start telegraf service
# systemd:
# name: telegraf
# enabled: yes
# state: started
2 changes: 1 addition & 1 deletion resources/packer/build/build.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "user_home" {

variable "droplet_image" {
type = string
default = "ubuntu-22-04-x64"
default = "ubuntu-24-04-x64"
description = ""
}

Expand Down
4 changes: 2 additions & 2 deletions resources/packer/node/node.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "user_home" {

variable "droplet_image" {
type = string
default = "ubuntu-22-04-x64"
default = "ubuntu-24-04-x64"
}

variable "region" {
Expand All @@ -41,7 +41,7 @@ source "digitalocean" "build" {
image = var.droplet_image
region = var.region
size = var.size
snapshot_name = "safe_network-node-{{timestamp}}"
snapshot_name = "ant-node-{{timestamp}}"
ssh_username = var.ssh_username
}

Expand Down
6 changes: 4 additions & 2 deletions resources/scripts/install_ansible.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

cat /etc/os-release

export DEBIAN_FRONTEND=noninteractive

max_retries=10
retry_delay=5
max_retries=20
retry_delay=10

for i in $(seq 1 $max_retries); do
echo "Update Apt index attempt $i of $max_retries..."
Expand Down
12 changes: 6 additions & 6 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 = 162461040
bootstrap_droplet_image_id = 172040723
bootstrap_node_vm_count = 1
evm_node_droplet_size = "s-4vcpu-8gb"
evm_node_droplet_image_id = 167317579
evm_node_droplet_image_id = 172040852
evm_node_vm_count = 1
nat_gateway_droplet_image_id = 166664184
nat_gateway_droplet_image_id = 172051596
node_droplet_size = "s-4vcpu-8gb"
node_droplet_image_id = 162460774
node_droplet_image_id = 172040547
node_vm_count = 10
private_node_vm_count = 1
setup_nat_gateway = true
uploader_droplet_size = "s-2vcpu-4gb"
uploader_droplet_image_id = 162461150
uploader_vm_count = 1
uploader_droplet_image_id = 172051523
uploader_vm_count = 1
12 changes: 6 additions & 6 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 = 162461040
bootstrap_droplet_image_id = 172040723
bootstrap_node_vm_count = 2
evm_node_vm_count = 1
evm_node_droplet_size = "s-4vcpu-8gb"
evm_node_droplet_image_id = 167317579
nat_gateway_droplet_image_id = 166664184
evm_node_droplet_image_id = 172040852
nat_gateway_droplet_image_id = 172051596
node_droplet_size = "s-4vcpu-8gb"
node_droplet_image_id = 162460774
node_droplet_image_id = 172040547
node_vm_count = 39
private_node_vm_count = 1
setup_nat_gateway = true
uploader_droplet_size = "s-2vcpu-4gb"
uploader_droplet_image_id = 162461150
uploader_vm_count = 2
uploader_droplet_image_id = 172051523
uploader_vm_count = 2
4 changes: 2 additions & 2 deletions resources/terraform/testnet/digital-ocean/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ variable "build_machine_size" {
}

variable "build_droplet_image_id" {
default = "165140612"
default = "172040819"
}

variable "bootstrap_droplet_image_id" {
Expand Down Expand Up @@ -137,4 +137,4 @@ variable "node_volume_size" {
variable "private_node_volume_size" {
description = "Size of each volume in GB for private nodes"
type = number
}
}
13 changes: 0 additions & 13 deletions src/ansible/extra_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,6 @@ pub fn build_node_extra_vars_doc(
Ok(extra_vars.build())
}

pub fn build_safenode_rpc_client_extra_vars_doc(
cloud_provider: &str,
options: &ProvisionOptions,
genesis_multiaddr: &str,
) -> Result<String> {
let mut extra_vars = ExtraVarsDocBuilder::default();
extra_vars.add_variable("provider", cloud_provider);
extra_vars.add_variable("testnet_name", &options.name);
extra_vars.add_variable("genesis_multiaddr", genesis_multiaddr);
extra_vars.add_rpc_client_url_or_version(&options.name, &options.binary_option);
Ok(extra_vars.build())
}

pub fn build_uploaders_extra_vars_doc(
cloud_provider: &str,
options: &ProvisionOptions,
Expand Down
20 changes: 0 additions & 20 deletions src/ansible/provisioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,26 +439,6 @@ impl AnsibleProvisioner {
Ok(())
}

pub fn provision_safenode_rpc_client(
&self,
options: &ProvisionOptions,
genesis_multiaddr: &str,
) -> Result<()> {
let start = Instant::now();
println!("Running ansible against genesis node to start safenode_rpc_client service...");
self.ansible_runner.run_playbook(
AnsiblePlaybook::RpcClient,
AnsibleInventoryType::Genesis,
Some(extra_vars::build_safenode_rpc_client_extra_vars_doc(
&self.cloud_provider.to_string(),
options,
genesis_multiaddr,
)?),
)?;
print_duration(start.elapsed());
Ok(())
}

pub async fn provision_uploaders(
&self,
options: &ProvisionOptions,
Expand Down

0 comments on commit b9d97b8

Please sign in to comment.