From 870c913711ec8b19ae7dc4aa89cec0f6146212d6 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sat, 3 Jun 2023 23:54:32 -0400 Subject: [PATCH] Improve performance, add additional ram, improve Ubuntu user-data (and fix 22.04) --- .drone.yml | 6 +++--- debian/debian-11-amd64.json | 3 ++- ubuntu/http/user-data | 18 ++++++++++++++++++ ubuntu/ubuntu-20.04-amd64.json | 3 ++- ubuntu/ubuntu-22.04-amd64.json | 4 +++- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 25a247d..bdc5a7d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,7 +10,7 @@ steps: - name: ubuntu commands: - packer build ubuntu/ubuntu-20.04-amd64.json - - wget -O mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc + - wget -qO mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc - ./mc mirror --overwrite builds/ STORAGE/$MC_BUCKET/ubuntu - rm -f mc environment: @@ -31,7 +31,7 @@ steps: - name: ubuntu commands: - packer build ubuntu/ubuntu-22.04-amd64.json - - wget -O mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc + - wget -qO mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc - ./mc mirror --overwrite builds/ STORAGE/$MC_BUCKET/ubuntu - rm -f mc environment: @@ -52,7 +52,7 @@ steps: - name: debian commands: - packer build debian/debian-11-amd64.json - - wget -O mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc + - wget -qO mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc - ./mc mirror --overwrite builds/ STORAGE/$MC_BUCKET/debian - rm -f mc environment: diff --git a/debian/debian-11-amd64.json b/debian/debian-11-amd64.json index dbaea32..580f126 100644 --- a/debian/debian-11-amd64.json +++ b/debian/debian-11-amd64.json @@ -36,6 +36,7 @@ "type": "qemu", "vm_name": "{{ user `template` }}", "qemuargs": [ + [ "-cpu", "host" ], [ "-m", "{{ user `memory` }}" ], [ "-display", "{{ user `qemu_display` }}" ] ] @@ -81,7 +82,7 @@ "https_proxy": "{{env `https_proxy`}}", "iso_checksum": "eb3f96fd607e4b67e80f4fc15670feb7d9db5be50f4ca8d0bf07008cb025766b", "iso_name": "debian-11.7.0-amd64-netinst.iso", - "memory": "1024", + "memory": "4096", "mirror": "http://cdimage.debian.org/cdimage/release", "mirror_directory": "11.7.0/amd64/iso-cd", "name": "debian-11", diff --git a/ubuntu/http/user-data b/ubuntu/http/user-data index 10c81fb..a4cad36 100644 --- a/ubuntu/http/user-data +++ b/ubuntu/http/user-data @@ -11,3 +11,21 @@ autoinstall: ssh: install-server: true allow-pw: yes + late-commands: + - | + curtin in-target --target=/target -- /bin/bash -c ' \ + sed -ie "s/^[#\s]*UseDNS.*$/UseDNS no/g" /etc/ssh/sshd_config; \ + ssh-keygen -A; \ + systemctl enable ssh.service; \ + sed -ie "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=\"0\"/g" /etc/default/grub; \ + sed -ie "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0\"/g" /etc/default/grub; \ + sed -ie "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0\"/g" /etc/default/grub; \ + update-grub; \ + update-initramfs -c -k all; \ + apt-get -y purge snapd; \ + systemctl disable apt-daily.service; \ + systemctl disable apt-daily.timer; \ + systemctl disable apt-daily-upgrade.service; \ + systemctl disable apt-daily-upgrade.timer; \ + exit 0 \ + ' \ No newline at end of file diff --git a/ubuntu/ubuntu-20.04-amd64.json b/ubuntu/ubuntu-20.04-amd64.json index 1b3aa0c..97e04bc 100644 --- a/ubuntu/ubuntu-20.04-amd64.json +++ b/ubuntu/ubuntu-20.04-amd64.json @@ -35,6 +35,7 @@ "vm_name": "{{ user `template` }}", "vnc_bind_address": "{{ user `vnc_bind_address` }}", "qemuargs": [ + [ "-cpu", "host" ], [ "-m", "{{ user `memory` }}" ], [ "-display", "{{ user `qemu_display` }}" ] ] @@ -78,7 +79,7 @@ "https_proxy": "{{env `https_proxy`}}", "iso_checksum": "b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b", "iso_name": "ubuntu-20.04.6-live-server-amd64.iso", - "memory": "2048", + "memory": "4096", "mirror": "http://releases.ubuntu.com", "mirror_directory": "focal", "name": "ubuntu-20.04-amd64", diff --git a/ubuntu/ubuntu-22.04-amd64.json b/ubuntu/ubuntu-22.04-amd64.json index 8b6687c..bb5cd68 100644 --- a/ubuntu/ubuntu-22.04-amd64.json +++ b/ubuntu/ubuntu-22.04-amd64.json @@ -34,12 +34,14 @@ "shutdown_command": "echo 'ubuntu' | sudo -S shutdown -P now", "ssh_password": "ubuntu", "ssh_port": 22, + "ssh_read_write_timeout": "600s", "ssh_timeout": "10000s", "ssh_username": "ubuntu", "type": "qemu", "vm_name": "{{ user `template` }}", "vnc_bind_address": "{{ user `vnc_bind_address` }}", "qemuargs": [ + [ "-cpu", "host" ], [ "-m", "{{ user `memory` }}" ], [ "-display", "{{ user `qemu_display` }}" ] ] @@ -83,7 +85,7 @@ "https_proxy": "{{env `https_proxy`}}", "iso_checksum": "5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931", "iso_name": "ubuntu-22.04.2-live-server-amd64.iso", - "memory": "2048", + "memory": "4096", "mirror": "http://releases.ubuntu.com", "mirror_directory": "22.04.2", "name": "ubuntu-22.04-amd64",