Skip to content

Commit

Permalink
ceph-website: setup nodejs for building the website
Browse files Browse the repository at this point in the history
Signed-off-by: Nizamudeen A <[email protected]>
  • Loading branch information
nizamial09 committed Feb 3, 2025
1 parent 6e02b6c commit 9b0bb35
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions ceph-website-prs/config/definitions/ceph-website-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
builders:
- shell:
!include-raw:
- ../../../scripts/ceph-website/install-deps.sh
- ../../build/build
1 change: 1 addition & 0 deletions ceph-website/config/definitions/ceph-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
builders:
- shell:
!include-raw:
- ../../../scripts/ceph-website/install-deps.sh
- ../../build/build
30 changes: 30 additions & 0 deletions scripts/ceph-website/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -ex

# install node.js
NODEJS_MAJOR_VERSION=18
DISTRO="$(lsb_release -cs)"
if [[ ! $(command -v node) || $(node --version | grep -oE "v([0-9])+" | cut -c 2-) < ${NODEJS_MAJOR_VERSION} ]]; then
NODEJS_KEYRING=/usr/share/keyrings/nodesource.gpg
NODESOURCE_PATH=/etc/apt/sources.list.d/nodesource.list

# remove the manually installed node from the system
sudo rm -f /usr/local/bin/node
sudo rm -f /usr/local/bin/npm
sudo rm -rf /usr/local/lib/node_modules/
sudo rm -f ${NODESOURCE_PATH}

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "${NODEJS_KEYRING}" >/dev/null
gpg --no-default-keyring --keyring "${NODEJS_KEYRING}" --list-keys

NODEJS_VERSION="node_${NODEJS_MAJOR_VERSION}.x"
echo "deb [signed-by=${NODEJS_KEYRING}] https://deb.nodesource.com/${NODEJS_VERSION} ${DISTRO} main" | sudo tee ${NODESOURCE_PATH}
echo "deb-src [signed-by=${NODEJS_KEYRING}] https://deb.nodesource.com/${NODEJS_VERSION} ${DISTRO} main" | sudo tee -a ${NODESOURCE_PATH}

sudo apt update -y
sudo apt install -y nodejs
sudo rm -f ${NODESOURCE_PATH}
fi

# print the version of node
node --version

0 comments on commit 9b0bb35

Please sign in to comment.