Skip to content

Commit 1309411

Browse files
iosifpeterfiEthernity CLOUD
andauthored
v3.3.0 (#99)
* Added support for Ubuntu 24.04 * Removed support for Ubuntu 18.04 * Fixed VM cleanup provisioning bug * Fixed memory upgrade on node reconfiguration Co-authored-by: Ethernity CLOUD <contact@ethernity.cloud>
1 parent 94f05eb commit 1309411

File tree

7 files changed

+175
-40
lines changed

7 files changed

+175
-40
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,17 @@ DELL Optiplex 5040
3232
Currently the following operating systems are suported:
3333

3434
```
35-
Ubuntu 18.04
3635
Ubuntu 20.04
3736
Ubuntu 22.04
38-
37+
Ubuntu 24.04
3938
```
4039

4140
We are planning support for the following operating systems:
4241

4342
```
44-
Debian 10*
45-
Fedora 30*
46-
CentOS 7*
47-
RHEL 8*
48-
43+
Debian 12*
44+
Fedora 41*
45+
Rocky 9*
4946
```
5047

5148
## Installation
@@ -162,4 +159,4 @@ $ ./etny-node-installer.sh
162159
### 2. Run the script again after system restart
163160
```
164161
$ cd mvp-pox-node
165-
$ ./etny-node-installer.sh
162+
$ ./etny-node-installer.sh

etny-node-installer.sh

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ choose_network() {
3030
read -p "Enter your choice: " choice
3131
case $choice in
3232
1) # Check Ubuntu kernel version
33-
if [ "$os" != 'Ubuntu 20.04' ] && [ "$os" != 'Ubuntu 22.04' ]; then
34-
echo "You need to upgrade your Ubuntu OS to at least version 20.04 or 22.04 to proceed with the installation."
35-
exit 1
36-
fi
3733
echo "You selected Automatic. This option will set polygon Mainnet if your wallet has MATIC, otherwise will set bloxberg Mainnet."
3834
export NETWORK=AUTO
3935
read -p "Do you want to use the default RPC? [Y/n]: " use_default_rpc
@@ -51,10 +47,6 @@ choose_network() {
5147
break
5248
;;
5349
2) # Check Ubuntu kernel version
54-
if [ "$os" != 'Ubuntu 20.04' ] && [ "$os" != 'Ubuntu 22.04' ]; then
55-
echo "You need to upgrade your Ubuntu OS to at least version 20.04 or 22.04 to proceed with the installation."
56-
exit 1
57-
fi
5850
echo "You selected Mainnet on POLYGON."
5951
export NETWORK=POLYGON
6052
read -p "Do you want to use the default POLYGON RPC? [Y/n]: " use_default_rpc
@@ -69,10 +61,6 @@ choose_network() {
6961
break
7062
;;
7163
3) # Check Ubuntu kernel version
72-
if [ "$os" != 'Ubuntu 20.04' ] && [ "$os" != 'Ubuntu 22.04' ]; then
73-
echo "You need to upgrade your Ubuntu OS to at least version 20.04 or 22.04 to proceed with the installation."
74-
exit 1
75-
fi
7664
echo "You selected Open Beta."
7765
export NETWORK=AMOY
7866
read -p "Do you want to use the default AMOY RPC? [Y/n]: " use_default_rpc
@@ -87,10 +75,6 @@ choose_network() {
8775
break
8876
;;
8977
4) # Check Ubuntu kernel version
90-
if [ "$os" != 'Ubuntu 20.04' ] && [ "$os" != 'Ubuntu 22.04' ]; then
91-
echo "You need to upgrade your Ubuntu OS to at least version 20.04 or 22.04 to proceed with the installation."
92-
exit 1
93-
fi
9478
echo "You selected Open Beta."
9579
export NETWORK=BLOXBERG
9680
read -p "Do you want to use the default Bloxberg RPC? [Y/n]: " use_default_rpc
@@ -461,12 +445,12 @@ case $(awk '/^VERSION_ID=/' /etc/*-release 2>/dev/null | awk -F'=' '{ print tolo
461445
20.04)
462446
os='Ubuntu 20.04'
463447
ubuntu_20_04;;
464-
18.04)
465-
os='Ubuntu 18.04'
466-
ubuntu_20_04;;
467448
22.04)
468449
os='Ubuntu 22.04'
469450
ubuntu_20_04;;
451+
24.04)
452+
os='Ubuntu 24.04'
453+
ubuntu_20_04;;
470454
*) echo "Version not supported. Exiting..."
471455
esac
472456
}

etny-node-vm-configuration.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Define minimum and recommended settings
44
MIN_MEMORY_MB=3072 #MB
55
MIN_CPUS=2
6-
MIN_DISK=80 #GB
6+
MIN_DISK=128 #GB
77

88
REC_MEMORY_MB=7168 #MB
9-
REC_CPUS=2
9+
REC_CPUS=4
1010
REC_DISK=200 #GB
1111

1212
# Function to get available resources
@@ -53,7 +53,7 @@ if ((new_cpus < MIN_CPUS || new_cpus > available_cpus)); then
5353
fi
5454

5555
# Prompt for additional storage
56-
read -p "Enter additional allocated storage (GB) (minimum $MIN_DISK, recommended $REC_DISK): " additional_storage
56+
read -p "Enter allocated storage (GB) (minimum $MIN_DISK, recommended $REC_DISK): " additional_storage
5757

5858
# Calculate the new total storage size
5959
total_storage=$(echo "$available_disk_size + $additional_storage" | bc)
@@ -74,13 +74,22 @@ modify_vagrantfile
7474

7575
echo "Backup of the original Vagrantfile created: Vagrantfile.bak"
7676
echo "Vagrantfile updated successfully!"
77+
echo "Reloading vagrant..."
7778

7879
# Reload Vagrant
79-
vagrant reload
80+
vagrant reload > /dev/null 2>&1
81+
sleep 60
82+
vagrant up > /dev/null 2>&1
8083
echo "Vagrant reloaded successfully!"
8184

85+
# Resize Memory
86+
echo "Setting up memory size"
87+
VAGRANT_ID=`vagrant status | grep etny | awk '{print $1}'`
88+
VMID=`virsh list | grep $VAGRANT_ID | awk '{print $2}'`
89+
virsh setmem --domain ${VMID} ${new_memory_MB}M --live
90+
8291
# Resize VM disk
83-
vagrant ssh -c "sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv"
92+
echo "Extending partition"
93+
vagrant ssh -c "sudo lvextend -l+100%FREE /dev/ubuntu-vg/ubuntu-lv"
8494
vagrant ssh -c "sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv"
85-
echo "Disk resized successfully!"
8695
echo "Configuration done"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
3+
- name: Ubuntu 24.04 | qemu dependency packages
4+
apt:
5+
pkg:
6+
- policycoreutils-python-utils
7+
- libfdt1
8+
- libvirt-clients
9+
- libvirt-daemon-system
10+
- bridge-utils
11+
- python3-libvirt
12+
- libnss-libvirt
13+
- libguestfs-tools
14+
- virtinst
15+
- virt-top
16+
- genisoimage
17+
- cpu-checker
18+
state: present
19+
- name: Ubuntu 24.04 | "Installing qemu"
20+
apt:
21+
pkg:
22+
- qemu-system-data
23+
- qemu-utils
24+
- qemu-system-common
25+
- qemu-system-x86
26+
- qemu-utils
27+
state: present
28+
- name: Ubuntu 24.04 | vagrant add key
29+
apt_key:
30+
url: https://apt.releases.hashicorp.com/gpg
31+
- name: Ubuntu 24.04 | vagrant repo
32+
apt_repository:
33+
repo: "deb [arch=amd64] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main"
34+
- name: Ubuntu 24.04 | vagrant install
35+
apt:
36+
pkg:
37+
- vagrant
38+
- name: Ubuntu 24.04 | vagrant-libvirt packages
39+
apt:
40+
pkg:
41+
- ebtables
42+
- dnsmasq-base
43+
- libxslt-dev
44+
- libxml2-dev
45+
- libvirt-dev
46+
- zlib1g-dev
47+
- ruby-dev
48+
state: present
49+
- name: Ubuntu 24.04 | vagrant template
50+
copy:
51+
src: vagrant/qemu-8.2
52+
dest: Vagrantfile
53+
force: yes

roles/install_node/tasks/main.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
script: ubuntu/etny-node-provision-sgx.sh
3333
when: "sgx_enclave_driver.rc != 0"
3434

35-
- name: Ubuntu 20.04 | enable_sgx dependencies
35+
- name: Ubuntu | enable_sgx dependencies
3636
apt:
3737
pkg:
3838
- make-guile
3939
- gcc
40-
- name: Ubuntu 20.04 | build enable_sgx
40+
- name: Ubuntu | build enable_sgx
4141
shell: make all -C sgx/
42-
- name: Ubuntu 20.04 | run enable_sgx
42+
- name: Ubuntu | run enable_sgx
4343
shell: sgx/sgx_enable
4444
register: sgx_register
4545
- name: "Print message"
@@ -136,16 +136,17 @@
136136
- name: vagrant - get VM name
137137
shell: virsh list --name --state-running
138138
register: vagrant_vm_name_running
139-
- name: vagrant - cleanup VM
140-
shell: virsh shutdown {{ vagrant_vm_name.stdout }}
139+
- name: vagrant - shutting down VM
140+
shell: virsh shutdown {{ vagrant_vm_name.stdout }} --mode acpi && sleep 60
141141
when:
142142
- vagrant_vm_name.stdout != ''
143143
- vagrant_vm_name_running.stdout != ''
144-
- name: vagrant - cleanup VM
144+
- name: vagrant - unset VM vars
145145
shell: virsh undefine {{ vagrant_vm_name.stdout }}
146146
when: vagrant_vm_name.stdout != ''
147147
- name: vagrant - cleanup VM
148-
shell: vagrant destroy -f && sleep 60
148+
shell: vagrant destroy -f; sleep 60
149+
ignore_errors: true
149150
#when: ansible_facts.services['etny-vagrant.service'].state != 'running'
150151
- name: vagrant - provision VM
151152
shell: vagrant up --provider=libvirt
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# file: roles/libvirt/vars/Debian.yml
3+
libvirt_packages:
4+
- libvirt-daemon-system
5+
libvirt_daemon_config_file: /etc/default/libvirtd
6+
libvirt_config_file: /etc/libvirt/libvirtd.conf
7+
libvirt_qemu_config_file: /etc/libvirt/qemu.conf
8+
libvirt_daemon_config:
9+
- { option: 'libvirtd_opts', value: 'libvirtd_opts=""' }

vagrant/qemu-8.2

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#
2+
# Copyright (C) 2018, 2019 Ethernity HODL UG
3+
#
4+
# This file is part of ETHERNITY NODE.
5+
#
6+
# ETHERNITY SC is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Affero General Public License as
8+
# published by the Free Software Foundation, either version 3 of the
9+
# License, or (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Affero General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Affero General Public License
17+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
#
19+
20+
Vagrant.configure("2") do |config|
21+
interface = `ip a | grep '2:' | head -1 | awk '{print $2}' | awk -F ':' '{print $1}'`
22+
23+
config.vm.define :etnyvm1 do |etnyvm1|
24+
etnyvm1.vm.box = "generic/ubuntu2204"
25+
etnyvm1.vm.provider :libvirt do |domain|
26+
domain.memory = 3072
27+
domain.cpus = 2
28+
domain.cpu_mode = 'maximum'
29+
domain.nested = true
30+
domain.kvm_hidden = false
31+
domain.machine_virtual_size = 128
32+
domain.disk_driver :cache => 'none'
33+
domain.qemuargs :value => '-cpu'
34+
domain.qemuargs :value => 'host,+sgx'
35+
domain.qemuargs :value => '-object'
36+
domain.qemuargs :value => 'memory-backend-epc,id=mem1,size=64M,prealloc=on'
37+
domain.qemuargs :value => '-M'
38+
domain.qemuargs :value => 'sgx-epc.0.memdev=mem1,sgx-epc.0.node=0'
39+
end
40+
etnyvm1.vm.network :public_network,
41+
:dev => interface.strip!,
42+
:mode => 'vepa',
43+
:type => 'direct'
44+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-provision-docker.sh", destination: "~/etny/node/etny-node-provision-docker.sh"
45+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-isgx-removal-tool.sh", destination: "~/etny/node/etny-node-isgx-removal-tool.sh"
46+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-provision-sgx.sh", destination: "~/etny/node/etny-node-provision-sgx.sh"
47+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-disable-upgrades.sh", destination: "~/etny/node/etny-node-disable-upgrades.sh"
48+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-provision-python.sh", destination: "~/etny/node/etny-node-provision-python.sh"
49+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-provision-ipfs.sh", destination: "~/etny/node/etny-node-provision-ipfs.sh"
50+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-provision-etny.sh", destination: "~/etny/node/etny-node-provision-etny.sh"
51+
etnyvm1.vm.provision "file", source: "./ubuntu/etny-node-start.sh", destination: "~/etny/node/etny-node-start.sh"
52+
etnyvm1.vm.provision "file", source: "./ubuntu/etc/systemd/system/etny-node.service", destination: "~/etny/node/etny-node.service"
53+
etnyvm1.vm.provision "file", source: "./ubuntu/etc/systemd/system/ipfs.service", destination: "~/etny/node/ipfs.service"
54+
etnyvm1.vm.provision "file", source: "./config", destination: "~/etny/node/config"
55+
etnyvm1.vm.provision "shell",
56+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-provision-sgx.sh"
57+
etnyvm1.vm.provision "shell",
58+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-provision-docker.sh"
59+
etnyvm1.vm.provision "shell",
60+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-disable-upgrades.sh"
61+
etnyvm1.vm.provision "shell",
62+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-provision-python.sh"
63+
etnyvm1.vm.provision "shell",
64+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-provision-ipfs.sh"
65+
etnyvm1.vm.provision "shell",
66+
inline: "/bin/bash /home/vagrant/etny/node/etny-node-provision-etny.sh"
67+
etnyvm1.vm.provision "shell",
68+
inline: "/bin/mv /home/vagrant/etny/node/ipfs.service /etc/systemd/system/"
69+
etnyvm1.vm.provision "shell",
70+
inline: "/bin/systemctl start ipfs.service"
71+
etnyvm1.vm.provision "shell",
72+
inline: "/bin/systemctl enable ipfs.service"
73+
etnyvm1.vm.provision "shell",
74+
inline: "/bin/mv /home/vagrant/etny/node/etny-node.service /etc/systemd/system/"
75+
etnyvm1.vm.provision "shell",
76+
inline: "/bin/systemctl start etny-node.service"
77+
etnyvm1.vm.provision "shell",
78+
inline: "/bin/systemctl enable etny-node.service"
79+
etnyvm1.vm.provision :reload
80+
81+
end
82+
end

0 commit comments

Comments
 (0)