fix: install node from official tarball in bootstrap
This commit is contained in:
@@ -29,35 +29,45 @@ install_packages() {
|
||||
log "Installing OS packages"
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl gnupg git nginx redis-server postgresql postgresql-contrib build-essential tar gzip openssl
|
||||
if ! command -v node >/dev/null 2>&1 || [[ "$(node -v | sed 's/^v//' | cut -d. -f1)" -lt 22 ]]; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
|
||||
fi
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl gnupg git nginx redis-server postgresql postgresql-contrib build-essential tar gzip xz-utils openssl
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y ca-certificates curl git nginx redis postgresql-server postgresql-contrib gcc gcc-c++ make tar gzip openssl
|
||||
dnf install -y ca-certificates curl git nginx redis postgresql-server postgresql-contrib gcc gcc-c++ make tar gzip xz openssl
|
||||
if [[ ! -d /var/lib/pgsql/data/base ]]; then
|
||||
postgresql-setup --initdb
|
||||
fi
|
||||
if ! command -v node >/dev/null 2>&1 || [[ "$(node -v | sed 's/^v//' | cut -d. -f1)" -lt 22 ]]; then
|
||||
curl -fsSL https://rpm.nodesource.com/setup_22.x | bash -
|
||||
dnf install -y nodejs
|
||||
fi
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
yum install -y ca-certificates curl git nginx redis postgresql-server postgresql-contrib gcc gcc-c++ make tar gzip openssl
|
||||
yum install -y ca-certificates curl git nginx redis postgresql-server postgresql-contrib gcc gcc-c++ make tar gzip xz openssl
|
||||
if [[ ! -d /var/lib/pgsql/data/base ]]; then
|
||||
postgresql-setup initdb
|
||||
fi
|
||||
if ! command -v node >/dev/null 2>&1 || [[ "$(node -v | sed 's/^v//' | cut -d. -f1)" -lt 22 ]]; then
|
||||
curl -fsSL https://rpm.nodesource.com/setup_22.x | bash -
|
||||
yum install -y nodejs
|
||||
fi
|
||||
else
|
||||
echo "Unsupported Linux distribution: apt-get/dnf/yum not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_node() {
|
||||
local version="${NODE_VERSION:-22.21.1}"
|
||||
local arch
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64) arch="x64" ;;
|
||||
aarch64|arm64) arch="arm64" ;;
|
||||
*) echo "Unsupported Node.js architecture: $(uname -m)" >&2; exit 1 ;;
|
||||
esac
|
||||
if command -v node >/dev/null 2>&1 && [[ "$(node -v | sed 's/^v//' | cut -d. -f1)" -ge 22 ]]; then
|
||||
return
|
||||
fi
|
||||
log "Installing Node.js ${version} for linux-${arch}"
|
||||
curl -fL "https://nodejs.org/dist/v${version}/node-v${version}-linux-${arch}.tar.xz" -o /tmp/node.tar.xz
|
||||
rm -rf /usr/local/lib/nodejs
|
||||
mkdir -p /usr/local/lib/nodejs
|
||||
tar -C /usr/local/lib/nodejs -xJf /tmp/node.tar.xz --strip-components=1
|
||||
ln -sf /usr/local/lib/nodejs/bin/node /usr/local/bin/node
|
||||
ln -sf /usr/local/lib/nodejs/bin/npm /usr/local/bin/npm
|
||||
ln -sf /usr/local/lib/nodejs/bin/npx /usr/local/bin/npx
|
||||
ln -sf /usr/local/lib/nodejs/bin/corepack /usr/local/bin/corepack
|
||||
}
|
||||
|
||||
install_go() {
|
||||
local version="${GO_VERSION:-1.26.0}"
|
||||
local arch
|
||||
@@ -240,6 +250,7 @@ run_deploy() {
|
||||
}
|
||||
|
||||
install_packages
|
||||
install_node
|
||||
install_go
|
||||
install_minio
|
||||
start_infra
|
||||
|
||||
Reference in New Issue
Block a user