From 018df8721c91611fe683a99db267253dea9dba82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josip=20Crnkovi=C4=87?= Date: Tue, 31 Oct 2023 11:07:45 +0100 Subject: [PATCH] fix: upgrade base server image from Ubuntu 18.04 to Ubuntu 22.04 (#4) --- app/Domain/Server/Services/Providers/AWS.php | 2 +- .../Services/Providers/DigitalOcean.php | 2 +- .../Server/Services/Providers/Hetzner.php | 2 +- .../Server/Services/Providers/Linode.php | 2 +- .../Server/Services/Providers/Vultr.php | 2 +- .../pre-install/await-apt-unlock.blade.php | 61 +++++++++++++++++-- .../pre-install/deps-jemalloc.blade.php | 1 + .../manual/pre-install/deps-node.blade.php | 11 +++- .../ark/manual/pre-install/deps-ntp.blade.php | 1 + .../manual/pre-install/deps-pgsql.blade.php | 3 + .../manual/pre-install/deps-program.blade.php | 1 + .../manual/pre-install/deps-system.blade.php | 5 +- .../manual/pre-install/deps-yarn.blade.php | 9 ++- .../pre-install/detect-system.blade.php | 2 + .../pre-install/update-system.blade.php | 9 +++ .../pre-install/await-apt-unlock.blade.php | 61 +++++++++++++++++-- .../pre-install/deps-docker.blade.php | 5 ++ .../pre-install/deps-jemalloc.blade.php | 1 + .../provision/pre-install/deps-node.blade.php | 11 +++- .../provision/pre-install/deps-ntp.blade.php | 1 + .../pre-install/deps-pgsql.blade.php | 3 + .../pre-install/deps-program.blade.php | 1 + .../pre-install/deps-system.blade.php | 5 +- .../provision/pre-install/deps-yarn.blade.php | 9 ++- .../pre-install/detect-system.blade.php | 2 + .../unattended-security-upgrades.blade.php | 2 +- .../pre-install/update-system.blade.php | 11 ++++ .../Server/Components/CreateServerTest.php | 12 ++-- .../Jobs/CreateServerOnProviderTest.php | 4 +- .../Token/Components/DeployBlockchainTest.php | 6 +- .../Services/Providers/DigitalOceanTest.php | 2 +- .../Server/Services/Providers/HetznerTest.php | 4 +- .../Server/Services/Providers/LinodeTest.php | 6 +- .../Server/Services/Providers/VultrTest.php | 8 +-- tests/fixtures/digitalocean/images.json | 6 +- tests/fixtures/digitalocean/server.json | 4 +- .../fixtures/hetzner/images-without-name.json | 6 +- tests/fixtures/hetzner/images.json | 6 +- tests/fixtures/hetzner/server.json | 6 +- tests/fixtures/linode/images.json | 4 +- tests/fixtures/linode/server.json | 2 +- tests/fixtures/vultr/images.json | 4 +- tests/fixtures/vultr/server.json | 2 +- 43 files changed, 238 insertions(+), 69 deletions(-) diff --git a/app/Domain/Server/Services/Providers/AWS.php b/app/Domain/Server/Services/Providers/AWS.php index eea40ad..6240ff3 100644 --- a/app/Domain/Server/Services/Providers/AWS.php +++ b/app/Domain/Server/Services/Providers/AWS.php @@ -352,7 +352,7 @@ public function deleteSecureShellKey(string $id): bool */ public function getImageId(): string { - return 'Ubuntu 18.04 x64'; + return 'Ubuntu 22.04 x64'; } /** diff --git a/app/Domain/Server/Services/Providers/DigitalOcean.php b/app/Domain/Server/Services/Providers/DigitalOcean.php index fd00008..dd2706b 100644 --- a/app/Domain/Server/Services/Providers/DigitalOcean.php +++ b/app/Domain/Server/Services/Providers/DigitalOcean.php @@ -336,7 +336,7 @@ public function deleteSecureShellKey(string $id): bool */ public function getImageId(): string { - return 'ubuntu-18-04-x64'; + return 'ubuntu-22-04-x64'; } /** diff --git a/app/Domain/Server/Services/Providers/Hetzner.php b/app/Domain/Server/Services/Providers/Hetzner.php index 81f576e..aacc7a2 100644 --- a/app/Domain/Server/Services/Providers/Hetzner.php +++ b/app/Domain/Server/Services/Providers/Hetzner.php @@ -350,7 +350,7 @@ public function deleteSecureShellKey(string $id): bool */ public function getImageId(): string { - return 'ubuntu-18.04'; + return 'ubuntu-22.04'; } /** diff --git a/app/Domain/Server/Services/Providers/Linode.php b/app/Domain/Server/Services/Providers/Linode.php index 2d97e05..f7546a4 100644 --- a/app/Domain/Server/Services/Providers/Linode.php +++ b/app/Domain/Server/Services/Providers/Linode.php @@ -323,7 +323,7 @@ public function deleteSecureShellKey(string $id): bool */ public function getImageId(): string { - return 'linode/ubuntu18.04'; + return 'linode/ubuntu22.04'; } /** diff --git a/app/Domain/Server/Services/Providers/Vultr.php b/app/Domain/Server/Services/Providers/Vultr.php index 20481a2..04a91a2 100644 --- a/app/Domain/Server/Services/Providers/Vultr.php +++ b/app/Domain/Server/Services/Providers/Vultr.php @@ -327,7 +327,7 @@ public function deleteSecureShellKey(string $id): bool */ public function getImageId(): string { - return '270'; //'Ubuntu 18.04 x64'; + return '270'; //'Ubuntu 22.04 x64'; } /** diff --git a/resources/views/scripts/ark/ark/manual/pre-install/await-apt-unlock.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/await-apt-unlock.blade.php index 6efcf74..320c140 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/await-apt-unlock.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/await-apt-unlock.blade.php @@ -1,7 +1,60 @@ # Wait For Apt To Unlock -while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do - echo "Waiting for other software managers to finish..." +apt_wait () { + while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock to be unlocked for sudo..." - sleep 1 -done + sleep 5 + done + + while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do + echo "Waiting: dpk for lock-frontend to be unlocked for sudo..." + + sleep 5 + done + + while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do + echo "Waiting for lists/lock to be unlocked for sudo..." + + sleep 5 + done + + if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then + while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do + echo "Waiting for unattended-upgrades to be unlocked for sudo..." + + sleep 5 + done + fi + + while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock to be unlocked for user..." + sleep 5 + done + + while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock-frontend to be unlocked for user..." + sleep 5 + done + + while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do + echo "Waiting for lists/lock to be unlocked for user..." + sleep 5 + done + + if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then + while fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do + echo "Waiting for unattended-upgrades to be unlocked for user..." + sleep 5 + done + fi +} + +heading "Waiting for locks..." +apt_wait + +sudo sed -i "s/#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/" /etc/gai.conf +if [ -f /etc/needrestart/needrestart.conf ]; then + # Ubuntu 22 has this set to (i)nteractive, but we want (a)utomatic. + sudo sed -i "s/^#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf +fi diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-jemalloc.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-jemalloc.blade.php index 85fe0f0..5055928 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-jemalloc.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-jemalloc.blade.php @@ -1,5 +1,6 @@ heading "Installing jemalloc..." +apt_wait sudo apt-get install -y libjemalloc-dev success "Installed jemalloc!" diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-node.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-node.blade.php index 172773d..1e7125c 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-node.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-node.blade.php @@ -3,9 +3,14 @@ sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} sudo rm -rf ~/{.npm,.forever,.node*,.cache,.nvm} -sudo wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - -(echo "deb https://deb.nodesource.com/node_14.x $(lsb_release -s -c) main" | sudo tee /etc/apt/sources.list.d/nodesource.list) +(echo -e "Package: nodejs\nPin: origin deb.nodesource.com\nPin-Priority: 999" | sudo tee /etc/apt/preferences.d/nodesource) +curl -sL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/nodesource.gpg >/dev/null +(echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x ${DEB_ID} main" | sudo tee /etc/apt/sources.list.d/nodesource.list) + +apt_wait sudo apt-get update -sudo apt-get install nodejs -y + +apt_wait +sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install nodejs -yq success "Installed node.js & npm!" diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-ntp.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-ntp.blade.php index 6730bcf..399db52 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-ntp.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-ntp.blade.php @@ -2,6 +2,7 @@ sudo timedatectl set-ntp off > /dev/null 2>&1 # disable the default systemd timesyncd service +apt_wait sudo apt-get install ntp -yyq sudo ntpd -gq diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-pgsql.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-pgsql.blade.php index 1be92bf..3f8cba0 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-pgsql.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-pgsql.blade.php @@ -1,6 +1,9 @@ heading "Installing PostgreSQL..." +apt_wait sudo apt-get update + +apt_wait sudo apt-get install postgresql postgresql-contrib -y success "Installed PostgreSQL!" diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-program.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-program.blade.php index 9e53adf..65dbdfd 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-program.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-program.blade.php @@ -1,5 +1,6 @@ heading "Installing program dependencies..." +apt_wait sudo apt-get install build-essential libcairo2-dev pkg-config libtool autoconf automake python libpq-dev jq zip unzip -y {{-- We need to install jq-1.6 because it contains fixes that we need later on --}} diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-system.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-system.blade.php index f5b81b7..b70c4dd 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-system.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-system.blade.php @@ -2,7 +2,10 @@ echo 'libssl1.1 libraries/restart-without-asking boolean true' | sudo debconf-set-selections +apt_wait sudo apt-get update -sudo apt-get install -y curl apt-transport-https update-notifier + +apt_wait +sudo apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y --force-yes curl apt-transport-https update-notifier bc wget gnupg net-tools zip make build-essential success "Installed system dependencies!" diff --git a/resources/views/scripts/ark/ark/manual/pre-install/deps-yarn.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/deps-yarn.blade.php index 1b4ba4a..d2f1308 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/deps-yarn.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/deps-yarn.blade.php @@ -1,9 +1,12 @@ heading "Installing Yarn..." -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - -(echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list) +curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null +(echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list) +apt_wait sudo apt-get update -sudo apt-get install -y yarn + +apt_wait +sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install yarn -yq success "Installed Yarn!" diff --git a/resources/views/scripts/ark/ark/manual/pre-install/detect-system.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/detect-system.blade.php index 109c313..0edbe42 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/detect-system.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/detect-system.blade.php @@ -4,6 +4,8 @@ # Detect SystemV / SystemD SYS=$([[ -L "/sbin/init" ]] && echo 'SystemD' || echo 'SystemV') +DEB_ID=$( (grep DISTRIB_CODENAME /etc/upstream-release/lsb-release || grep DISTRIB_CODENAME /etc/lsb-release || grep VERSION_CODENAME /etc/os-release) 2>/dev/null | cut -d'=' -f2 ) + if [[ -n $DEB ]]; then success "Running install for Debian derivate" else diff --git a/resources/views/scripts/ark/ark/manual/pre-install/update-system.blade.php b/resources/views/scripts/ark/ark/manual/pre-install/update-system.blade.php index f9f86ed..2a6a5cd 100644 --- a/resources/views/scripts/ark/ark/manual/pre-install/update-system.blade.php +++ b/resources/views/scripts/ark/ark/manual/pre-install/update-system.blade.php @@ -1,9 +1,18 @@ heading "Installing system updates..." +apt_wait sudo apt-get update + +apt_wait sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -yqq + +apt_wait sudo apt-get dist-upgrade -yqq + +apt_wait sudo apt-get autoremove -yyq + +apt_wait sudo apt-get autoclean -yq success "Installed system updates!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/await-apt-unlock.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/await-apt-unlock.blade.php index 6efcf74..320c140 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/await-apt-unlock.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/await-apt-unlock.blade.php @@ -1,7 +1,60 @@ # Wait For Apt To Unlock -while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do - echo "Waiting for other software managers to finish..." +apt_wait () { + while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock to be unlocked for sudo..." - sleep 1 -done + sleep 5 + done + + while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do + echo "Waiting: dpk for lock-frontend to be unlocked for sudo..." + + sleep 5 + done + + while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do + echo "Waiting for lists/lock to be unlocked for sudo..." + + sleep 5 + done + + if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then + while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do + echo "Waiting for unattended-upgrades to be unlocked for sudo..." + + sleep 5 + done + fi + + while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock to be unlocked for user..." + sleep 5 + done + + while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do + echo "Waiting for dpkg/lock-frontend to be unlocked for user..." + sleep 5 + done + + while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do + echo "Waiting for lists/lock to be unlocked for user..." + sleep 5 + done + + if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then + while fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do + echo "Waiting for unattended-upgrades to be unlocked for user..." + sleep 5 + done + fi +} + +heading "Waiting for locks..." +apt_wait + +sudo sed -i "s/#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/" /etc/gai.conf +if [ -f /etc/needrestart/needrestart.conf ]; then + # Ubuntu 22 has this set to (i)nteractive, but we want (a)utomatic. + sudo sed -i "s/^#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf +fi diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-docker.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-docker.blade.php index 63fe5f9..9b24faf 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-docker.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-docker.blade.php @@ -2,11 +2,16 @@ heading "Installing Docker..." +apt_wait sudo apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + +apt_wait sudo apt-get update + +apt_wait sudo apt-get -y install docker-ce sudo usermod -aG docker ${USER} sudo chmod 666 /var/run/docker.sock diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-jemalloc.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-jemalloc.blade.php index 029fe79..7cdddcb 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-jemalloc.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-jemalloc.blade.php @@ -2,6 +2,7 @@ heading "Installing jemalloc..." +apt_wait sudo apt-get install -y libjemalloc-dev success "Installed jemalloc!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-node.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-node.blade.php index d6ce41b..758c422 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-node.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-node.blade.php @@ -5,9 +5,14 @@ sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} sudo rm -rf ~/{.npm,.forever,.node*,.cache,.nvm} -sudo wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - -(echo "deb https://deb.nodesource.com/node_14.x $(lsb_release -s -c) main" | sudo tee /etc/apt/sources.list.d/nodesource.list) +(echo -e "Package: nodejs\nPin: origin deb.nodesource.com\nPin-Priority: 999" | sudo tee /etc/apt/preferences.d/nodesource) +curl -sL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/nodesource.gpg >/dev/null +(echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x ${DEB_ID} main" | sudo tee /etc/apt/sources.list.d/nodesource.list) + +apt_wait sudo apt-get update -sudo apt-get install nodejs -y + +apt_wait +sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install nodejs -yq success "Installed node.js & npm!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-ntp.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-ntp.blade.php index 96bc0a4..4a43159 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-ntp.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-ntp.blade.php @@ -4,6 +4,7 @@ sudo timedatectl set-ntp off > /dev/null 2>&1 # disable the default systemd timesyncd service +apt_wait sudo apt-get install ntp -yyq sudo ntpd -gq diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-pgsql.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-pgsql.blade.php index 2c88f4d..399695e 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-pgsql.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-pgsql.blade.php @@ -2,7 +2,10 @@ heading "Installing PostgreSQL..." +apt_wait sudo apt-get update + +apt_wait sudo apt-get install postgresql postgresql-contrib -y success "Installed PostgreSQL!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-program.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-program.blade.php index 2ba4fac..1558a40 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-program.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-program.blade.php @@ -2,6 +2,7 @@ heading "Installing program dependencies..." +apt_wait sudo apt-get install build-essential libcairo2-dev pkg-config libtool autoconf automake python libpq-dev jq zip unzip -y {{-- We need to install jq-1.6 because it contains fixes that we need later on --}} diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-system.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-system.blade.php index f95fdfa..e398ada 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-system.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-system.blade.php @@ -4,7 +4,10 @@ echo 'libssl1.1 libraries/restart-without-asking boolean true' | sudo debconf-set-selections +apt_wait sudo apt-get update -sudo apt-get install -y git curl apt-transport-https update-notifier + +apt_wait +sudo apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y --force-yes git curl apt-transport-https update-notifier bc wget gnupg net-tools zip make build-essential success "Installed system dependencies!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/deps-yarn.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/deps-yarn.blade.php index 611c1e3..a1eb09f 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/deps-yarn.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/deps-yarn.blade.php @@ -2,10 +2,13 @@ heading "Installing Yarn..." -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - -(echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list) +curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null +(echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list) +apt_wait sudo apt-get update -sudo apt-get install -y yarn + +apt_wait +sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install yarn -yq success "Installed Yarn!" diff --git a/resources/views/scripts/ark/ark/provision/pre-install/detect-system.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/detect-system.blade.php index 65b2917..3e951b2 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/detect-system.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/detect-system.blade.php @@ -5,6 +5,8 @@ # Detect SystemV / SystemD SYS=$([[ -L "/sbin/init" ]] && echo 'SystemD' || echo 'SystemV') +DEB_ID=$( (grep DISTRIB_CODENAME /etc/upstream-release/lsb-release || grep DISTRIB_CODENAME /etc/lsb-release || grep VERSION_CODENAME /etc/os-release) 2>/dev/null | cut -d'=' -f2 ) + if [[ -n $DEB ]]; then success "Running install for Debian derivate" else diff --git a/resources/views/scripts/ark/ark/provision/pre-install/unattended-security-upgrades.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/unattended-security-upgrades.blade.php index 2c82d5d..0d4526a 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/unattended-security-upgrades.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/unattended-security-upgrades.blade.php @@ -1,6 +1,6 @@ cat << EOF | sudo tee /etc/apt/apt.conf.d/50unattended-upgrades > /dev/null Unattended-Upgrade::Allowed-Origins { - "Ubuntu zesty-security"; + "Ubuntu jammy-security"; }; Unattended-Upgrade::Package-Blacklist { // diff --git a/resources/views/scripts/ark/ark/provision/pre-install/update-system.blade.php b/resources/views/scripts/ark/ark/provision/pre-install/update-system.blade.php index 0645d0e..2629c56 100644 --- a/resources/views/scripts/ark/ark/provision/pre-install/update-system.blade.php +++ b/resources/views/scripts/ark/ark/provision/pre-install/update-system.blade.php @@ -2,10 +2,21 @@ heading "Installing system updates..." +apt_wait sudo apt-get update + +apt_wait sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -yqq + +apt_wait sudo apt-get dist-upgrade -yqq + +apt_wait sudo apt-get autoremove -yyq + +apt_wait sudo apt-get autoclean -yq +apt_wait + success "Installed system updates!" diff --git a/tests/App/Server/Components/CreateServerTest.php b/tests/App/Server/Components/CreateServerTest.php index 9a8a9f0..18f1009 100644 --- a/tests/App/Server/Components/CreateServerTest.php +++ b/tests/App/Server/Components/CreateServerTest.php @@ -29,7 +29,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -71,7 +71,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -112,7 +112,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'linode/ubuntu18.04', + 'uuid' => 'linode/ubuntu22.04', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -156,7 +156,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18.04', + 'uuid' => 'ubuntu-22.04', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -201,7 +201,7 @@ $image = ServerProviderImage::factory()->create([ 'uuid' => 270, - 'name' => 'Ubuntu 18.04 x64', + 'name' => 'Ubuntu 22.04 x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -724,7 +724,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); diff --git a/tests/App/Server/Jobs/CreateServerOnProviderTest.php b/tests/App/Server/Jobs/CreateServerOnProviderTest.php index 4f37749..3236a91 100644 --- a/tests/App/Server/Jobs/CreateServerOnProviderTest.php +++ b/tests/App/Server/Jobs/CreateServerOnProviderTest.php @@ -36,7 +36,7 @@ $server->setMetaAttribute(ServerAttributeEnum::CREATOR, $user->id); ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $this->assertDatabaseMissing('servers', [ @@ -80,7 +80,7 @@ ]); ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $this->assertDatabaseMissing('servers', [ diff --git a/tests/App/Token/Components/DeployBlockchainTest.php b/tests/App/Token/Components/DeployBlockchainTest.php index 0da50dc..3b295b9 100644 --- a/tests/App/Token/Components/DeployBlockchainTest.php +++ b/tests/App/Token/Components/DeployBlockchainTest.php @@ -48,7 +48,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -138,7 +138,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); @@ -176,7 +176,7 @@ ]); $image = ServerProviderImage::factory()->create([ - 'uuid' => 'ubuntu-18-04-x64', + 'uuid' => 'ubuntu-22-04-x64', ]); $serverProvider->plans()->syncWithoutDetaching($plan); diff --git a/tests/Domain/Server/Services/Providers/DigitalOceanTest.php b/tests/Domain/Server/Services/Providers/DigitalOceanTest.php index 78ade5c..b7a18aa 100644 --- a/tests/Domain/Server/Services/Providers/DigitalOceanTest.php +++ b/tests/Domain/Server/Services/Providers/DigitalOceanTest.php @@ -356,7 +356,7 @@ $image = $actual->items->first(); expect($image->id)->toBe($source->client()->getImageId()); - expect($image->name)->toBe('18.04.3 (LTS) x64'); + expect($image->name)->toBe('22.04.3 (LTS) x64'); }); it('can create a secure shell key', function () { diff --git a/tests/Domain/Server/Services/Providers/HetznerTest.php b/tests/Domain/Server/Services/Providers/HetznerTest.php index b3a307d..00aabe6 100644 --- a/tests/Domain/Server/Services/Providers/HetznerTest.php +++ b/tests/Domain/Server/Services/Providers/HetznerTest.php @@ -344,7 +344,7 @@ $image = $actual->items->first(); expect($image->id)->toBe($source->client()->getImageId()); - expect($image->name)->toBe('Ubuntu 18.04 Standard 64 bit'); + expect($image->name)->toBe('Ubuntu 22.04 Standard 64 bit'); }); it('should ignore images without a name', function () { @@ -362,7 +362,7 @@ $image = $actual->items->first(); expect($image->id)->toBe($source->client()->getImageId()); - expect($image->name)->toBe('Ubuntu 18.04 Standard 64 bit'); + expect($image->name)->toBe('Ubuntu 22.04 Standard 64 bit'); }); it('can create a secure shell key', function () { diff --git a/tests/Domain/Server/Services/Providers/LinodeTest.php b/tests/Domain/Server/Services/Providers/LinodeTest.php index 65cc3a3..cb92d9b 100644 --- a/tests/Domain/Server/Services/Providers/LinodeTest.php +++ b/tests/Domain/Server/Services/Providers/LinodeTest.php @@ -76,7 +76,7 @@ expect($actual->region)->toBe('us-southeast'); expect($actual->status)->toBe('running'); expect($actual->remoteAddress)->toBe('104.131.186.241'); - expect($actual->image)->toBe('linode/ubuntu18.04'); + expect($actual->image)->toBe('linode/ubuntu22.04'); }); it('fails to create a new server if the servers limit is exceeded', function () { @@ -119,7 +119,7 @@ expect($actual->region)->toBe('us-southeast'); expect($actual->status)->toBe('running'); expect($actual->remoteAddress)->toBe('104.131.186.241'); - expect($actual->image)->toBe('linode/ubuntu18.04'); + expect($actual->image)->toBe('linode/ubuntu22.04'); }); it('will throw a server error if server does not exist', function () { @@ -296,7 +296,7 @@ $image = $actual->items->first(); expect($image->id)->toBe($source->client()->getImageId()); - expect($image->name)->toBe('Ubuntu 18.04 LTS'); + expect($image->name)->toBe('Ubuntu 22.04 LTS'); }); it('can create a secure shell key', function () { diff --git a/tests/Domain/Server/Services/Providers/VultrTest.php b/tests/Domain/Server/Services/Providers/VultrTest.php index 4b9c6a2..8a5b85a 100644 --- a/tests/Domain/Server/Services/Providers/VultrTest.php +++ b/tests/Domain/Server/Services/Providers/VultrTest.php @@ -34,7 +34,7 @@ $image = ServerProviderImage::factory()->create([ 'uuid' => $this->source->client()->getImageId(), - 'name' => 'Ubuntu 18.04 x64', + 'name' => 'Ubuntu 22.04 x64', ]); $this->server = ServerModel::factory()->vultr()->createForTest([ @@ -77,7 +77,7 @@ expect($actual->region)->toBe('New Jersey'); expect($actual->status)->toBe('active'); expect($actual->remoteAddress)->toBe('123.123.123.123'); - expect($actual->image)->toBe('Ubuntu 18.04 x64'); + expect($actual->image)->toBe('Ubuntu 22.04 x64'); }); it('fails to create a new server if the droplet limit is exceeded', function () { @@ -120,7 +120,7 @@ expect($actual->region)->toBe('New Jersey'); expect($actual->status)->toBe('active'); expect($actual->remoteAddress)->toBe('123.123.123.123'); - expect($actual->image)->toBe('Ubuntu 18.04 x64'); + expect($actual->image)->toBe('Ubuntu 22.04 x64'); }); it('will throw a server error if server does not exist', function () { @@ -286,7 +286,7 @@ $image = $actual->items[270]; expect($image->id)->toBe($source->client()->getImageId()); - expect($image->name)->toBe('Ubuntu 18.04 x64'); + expect($image->name)->toBe('Ubuntu 22.04 x64'); }); it('can create a secure shell key', function () { diff --git a/tests/fixtures/digitalocean/images.json b/tests/fixtures/digitalocean/images.json index c918b53..95f5a8c 100644 --- a/tests/fixtures/digitalocean/images.json +++ b/tests/fixtures/digitalocean/images.json @@ -2,16 +2,16 @@ "images": [ { "id": 53893572, - "name": "18.04.3 (LTS) x64", + "name": "22.04.3 (LTS) x64", "distribution": "Ubuntu", - "slug": "ubuntu-18-04-x64", + "slug": "ubuntu-22-04-x64", "public": true, "regions": ["nyc1", "sfo1", "nyc2", "ams2", "sgp1", "lon1", "nyc3", "ams3", "fra1", "tor1", "sfo2", "blr1"], "created_at": "2019-10-22T01:38:19Z", "min_disk_size": 20, "type": "snapshot", "size_gigabytes": 2.36, - "description": "Ubuntu 18.04 x64 20191022", + "description": "Ubuntu 22.04 x64 20191022", "tags": [], "status": "available", "error_message": "" diff --git a/tests/fixtures/digitalocean/server.json b/tests/fixtures/digitalocean/server.json index e7f3385..1386ca4 100644 --- a/tests/fixtures/digitalocean/server.json +++ b/tests/fixtures/digitalocean/server.json @@ -18,9 +18,9 @@ "snapshot_ids": [7938206], "image": { "id": 6918990, - "name": "18.04 x64", + "name": "22.04 x64", "distribution": "Ubuntu", - "slug": "ubuntu-18-04-x64", + "slug": "ubuntu-22-04-x64", "public": true, "regions": ["nyc1", "ams1", "sfo1", "nyc2", "ams2", "sgp1", "lon1", "nyc3", "ams3", "nyc3"], "created_at": "2014-10-17T20:24:33Z", diff --git a/tests/fixtures/hetzner/images-without-name.json b/tests/fixtures/hetzner/images-without-name.json index ca6b527..14f1dfc 100644 --- a/tests/fixtures/hetzner/images-without-name.json +++ b/tests/fixtures/hetzner/images-without-name.json @@ -4,8 +4,8 @@ "id": 4711, "type": "snapshot", "status": "available", - "name": "ubuntu-18.04", - "description": "Ubuntu 18.04 Standard 64 bit", + "name": "ubuntu-22.04", + "description": "Ubuntu 22.04 Standard 64 bit", "image_size": 2.3, "disk_size": 10, "created": "2016-01-30T23:50:00+00:00", @@ -15,7 +15,7 @@ }, "bound_to": null, "os_flavor": "ubuntu", - "os_version": "18.04", + "os_version": "22.04", "rapid_deploy": false, "protection": { "delete": false diff --git a/tests/fixtures/hetzner/images.json b/tests/fixtures/hetzner/images.json index 296cd47..a78a0af 100644 --- a/tests/fixtures/hetzner/images.json +++ b/tests/fixtures/hetzner/images.json @@ -4,8 +4,8 @@ "id": 4711, "type": "snapshot", "status": "available", - "name": "ubuntu-18.04", - "description": "Ubuntu 18.04 Standard 64 bit", + "name": "ubuntu-22.04", + "description": "Ubuntu 22.04 Standard 64 bit", "image_size": 2.3, "disk_size": 10, "created": "2016-01-30T23:50:00+00:00", @@ -15,7 +15,7 @@ }, "bound_to": null, "os_flavor": "ubuntu", - "os_version": "18.04", + "os_version": "22.04", "rapid_deploy": false, "protection": { "delete": false diff --git a/tests/fixtures/hetzner/server.json b/tests/fixtures/hetzner/server.json index 65ce596..d6c7fc8 100644 --- a/tests/fixtures/hetzner/server.json +++ b/tests/fixtures/hetzner/server.json @@ -88,15 +88,15 @@ "id": 168855, "type": "system", "status": "available", - "name": "ubuntu-18.04", - "description": "Ubuntu 18.04", + "name": "ubuntu-22.04", + "description": "Ubuntu 22.04", "image_size": null, "disk_size": 5, "created": "2018-05-02T11:02:30+00:00", "created_from": null, "bound_to": null, "os_flavor": "ubuntu", - "os_version": "18.04", + "os_version": "22.04", "rapid_deploy": true, "protection": { "delete": false diff --git a/tests/fixtures/linode/images.json b/tests/fixtures/linode/images.json index d51cea2..c870ecc 100644 --- a/tests/fixtures/linode/images.json +++ b/tests/fixtures/linode/images.json @@ -1,8 +1,8 @@ { "data": [ { - "id": "linode/ubuntu18.04", - "label": "Ubuntu 18.04 LTS", + "id": "linode/ubuntu22.04", + "label": "Ubuntu 22.04 LTS", "deprecated": false, "size": 2600, "created": "2018-04-26T22:23:37", diff --git a/tests/fixtures/linode/server.json b/tests/fixtures/linode/server.json index 41fcaa8..c6d419a 100644 --- a/tests/fixtures/linode/server.json +++ b/tests/fixtures/linode/server.json @@ -3,7 +3,7 @@ "created": "2018-01-01T00:01:01", "status": "running", "label": "ubuntu-us-southeast", - "image": "linode/ubuntu18.04", + "image": "linode/ubuntu22.04", "type": "g6-standard-1", "group": "Linode-Group", "tags": [], diff --git a/tests/fixtures/vultr/images.json b/tests/fixtures/vultr/images.json index e00e0e6..f74f00d 100644 --- a/tests/fixtures/vultr/images.json +++ b/tests/fixtures/vultr/images.json @@ -1,7 +1,7 @@ { "270": { "OSID": "270", - "name": "Ubuntu 18.04 x64", + "name": "Ubuntu 22.04 x64", "arch": "x64", "family": "ubuntu", "windows": false @@ -15,7 +15,7 @@ }, "148": { "OSID": "148", - "name": "Ubuntu 18.04 i386", + "name": "Ubuntu 22.04 i386", "arch": "i386", "family": "ubuntu", "windows": false diff --git a/tests/fixtures/vultr/server.json b/tests/fixtures/vultr/server.json index bc8bb80..6087128 100644 --- a/tests/fixtures/vultr/server.json +++ b/tests/fixtures/vultr/server.json @@ -1,7 +1,7 @@ { "576965": { "SUBID": "576965", - "os": "Ubuntu 18.04 x64", + "os": "Ubuntu 22.04 x64", "ram": "4096 MB", "disk": "Virtual 60 GB", "main_ip": "123.123.123.123",