Skip to content

Commit

Permalink
fix(dev): update environment for website development (vectordotdev#18657
Browse files Browse the repository at this point in the history
)

* fix(dev): update environment for website development

The `nodejs` and `npm` packages installed from the stock Ubuntu Focal repository are outdated for the
current website dependencies. This commit installs an updated Node.js (current LTS version) directly
from the NodeSource repository instead.

The `yarn` package in the stock Ubuntu Focal repository is not the Yarn package manager.
The package is actually an alias package for the unrelated `cmdtest` package
(ref: <https://packages.ubuntu.com/focal/yarn>). This commit installs (enables) the correct `yarn`
command using the same updated Node.js installation above.

Website development requires two tools not currently installed in the environment:

* Hugo (static site generator).
* htmltest (HTML checker for the website content).

This commit also installs these tools directly from their GitHub release assets. In the case of
Hugo, the installed version matches the version currently specified in 'netlify.toml'.

In addition to all the above, this commit also improves the Ubuntu bootstrap script:

* Switches `apt` for `apt-get` as recommended for non-interactive scripts.
* Add missing temporary directory cleaning commands.

After all the above changes, the following now works properly in `website/` in the environment:

    make serve
    make local-preview-build

Signed-off-by: Hugo Hromic <hhromic@gmail.com>

* update spell checker expect-list

---------

Signed-off-by: Hugo Hromic <hhromic@gmail.com>
  • Loading branch information
hhromic committed Sep 26, 2023
1 parent 3dab239 commit 4327776
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ copypasta'd
copypasted
copytruncate
corechecks
corepack
could've
counteraaaaaaaaaaa
cpf
Expand Down Expand Up @@ -740,6 +741,7 @@ noauth
nocapture
nochild
nodebuginfo
nodistro
nofield
nofree
nomac
Expand Down
63 changes: 52 additions & 11 deletions scripts/environment/bootstrap-ubuntu-20.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ export ACCEPT_EULA=Y

echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries

apt update --yes
apt-get update --yes

apt install --yes \
apt-get install --yes \
software-properties-common \
apt-utils \
apt-transport-https

apt upgrade --yes
apt-get upgrade --yes

# Deps
apt install --yes --no-install-recommends \
apt-get install --yes --no-install-recommends \
awscli \
build-essential \
ca-certificates \
Expand All @@ -40,8 +40,6 @@ apt install --yes --no-install-recommends \
libssl-dev \
llvm \
locales \
nodejs \
npm \
pkg-config \
python3-pip \
rename \
Expand All @@ -50,8 +48,7 @@ apt install --yes --no-install-recommends \
shellcheck \
sudo \
unzip \
wget \
yarn
wget

# Cue
TEMP=$(mktemp -d)
Expand All @@ -62,6 +59,7 @@ tar \
-xvf "${TEMP}/cue_v0.5.0_linux_amd64.tar.gz" \
-C "${TEMP}"
cp "${TEMP}/cue" /usr/bin/cue
rm -rf "$TEMP"

# Grease
# Grease is used for the `make release-github` task.
Expand All @@ -73,6 +71,7 @@ tar \
-xvf "${TEMP}/grease-1.0.1-linux-amd64.tar.gz" \
-C "${TEMP}"
cp "${TEMP}/grease/bin/grease" /usr/bin/grease
rm -rf "$TEMP"

# Locales
locale-gen en_US.UTF-8
Expand Down Expand Up @@ -102,8 +101,8 @@ if ! [ -x "$(command -v docker)" ]; then
xenial \
stable"
# Install those new things
apt update --yes
apt install --yes docker-ce docker-ce-cli containerd.io
apt-get update --yes
apt-get install --yes docker-ce docker-ce-cli containerd.io

# ubuntu user doesn't exist in scripts/environment/Dockerfile which runs this
usermod --append --groups docker ubuntu || true
Expand All @@ -117,8 +116,49 @@ fi

bash scripts/environment/install-protoc.sh

# Node.js, npm and yarn.
# Note: the current LTS for the Node.js toolchain is 18.x
if ! [ -x "$(command -v node)" ]; then
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | apt-key add -
add-apt-repository \
"deb [arch=$(dpkg --print-architecture)] https://deb.nodesource.com/node_18.x \
nodistro \
main"
# Install those new things
apt-get update --yes
apt-get install --yes nodejs

# enable corepack (enables the yarn and pnpm package managers)
# ref: https://nodejs.org/docs/latest-v18.x/api/corepack.html
corepack enable
fi

# Hugo (static site generator).
# Hugo is used to build the website content.
# Note: the installed version should match the version specified in 'netlify.toml'
TEMP=$(mktemp -d)
curl \
-L https://github.com/gohugoio/hugo/releases/download/v0.84.0/hugo_extended_0.84.0_Linux-64bit.tar.gz \
-o "${TEMP}/hugo_extended_0.84.0_Linux-64bit.tar.gz"
tar \
-xvf "${TEMP}/hugo_extended_0.84.0_Linux-64bit.tar.gz" \
-C "${TEMP}"
cp "${TEMP}/hugo" /usr/bin/hugo
rm -rf "$TEMP"

# htmltest (HTML checker for the website content)
TEMP=$(mktemp -d)
curl \
-L https://github.com/wjdp/htmltest/releases/download/v0.17.0/htmltest_0.17.0_linux_amd64.tar.gz \
-o "${TEMP}/htmltest_0.17.0_linux_amd64.tar.gz"
tar \
-xvf "${TEMP}/htmltest_0.17.0_linux_amd64.tar.gz" \
-C "${TEMP}"
cp "${TEMP}/htmltest" /usr/bin/htmltest
rm -rf "$TEMP"

# Apt cleanup
apt clean
apt-get clean

# Set up the default "deny all warnings" build flags
CARGO_OVERRIDE_DIR="${HOME}/.cargo"
Expand Down Expand Up @@ -146,6 +186,7 @@ if [ -z "${DISABLE_MOLD:-""}" ] ; then
-C "${TEMP}"
cp "${TEMP}/${MOLD_TARGET}/bin/mold" /usr/bin/mold
cp "${TEMP}/${MOLD_TARGET}/lib/mold/mold-wrapper.so" /usr/bin/mold-wrapper.so
rm -rf "$TEMP"

# Create our rustc wrapper script that we'll use to actually invoke `rustc` such that `mold` will wrap it and intercept
# anything linking calls to use `mold` instead of `ld`, etc.
Expand Down

0 comments on commit 4327776

Please sign in to comment.