Description
Feature
Feature: system packages for Linux servers and workstations
There are so many times that I log into a server and install server software using a combination of curl and tar.
This provides the fastest way to install software, ensures the latest versions are available, something that package managers struggle to keep up with.
Generally, during scripting and automation, you'll find this kind of pattern. The popularity of arkade get
has shown that people are comfortable installing software in this way, and it makes CI - trivial - https://github.com/hopefulramen/k3sup-tester/blob/master/.github/workflows/build.yml
For example:
arkade system install go@v1.18.1
arkade system install node@v1.16
arkade system install firecracker@v1.0.0
arkade system install containerd@v1.16.1
arkade system install cni-plugins
This is present in openfaas/faasd, and on every Linux workstation I use, I tend to need these tools.
When a tool is already present, installation will be skipped, unless --force
is passed.
The version will be detected the same way as arkade get
without using the GitHub API, but using a HTTP HEAD request to the releases page, where no version is given that is.
A Go template will be used to form the URL, which will have a unit test for ARM32, ARM64 and AMD64.
Sometimes there are additional steps to run like systemd enable, or making a directory in a known location.
This would be a new command aimed at ARM32, ARM64 and AMD/Intel workstations and servers, and would save a lot of time for CI and setting up workstations.
I'd suggest we create a basic fluid SDK when adding the first app for Golang, for instance:
export ARCH=$(uname -p)
export GOPATH=$HOME/go/
export PATH=$PATH:/usr/local/go/bin/
install_go() {
DL_ARCH=$ARCH
if [ "$ARCH" == "x86_64" ]; then
DL_ARCH=amd64
else
if [ "$ARCH" == "aarch64" ]; then
DL_ARCH=arm64
fi
fi
if ! [ -e /usr/local/go/bin/go ]; then
curl -SLf https://go.dev/dl/go$GOVER.linux-$DL_ARCH.tar.gz > /tmp/go.tgz
sudo rm -rf /usr/local/go/
sudo mkdir -p /usr/local/go/
sudo tar -xvf /tmp/go.tgz -C /usr/local/go/ --strip-components=1
go version
echo "export GOPATH=\$HOME/go/" | tee -a $HOME/.bashrc
echo "export PATH=\$PATH:/usr/local/go/bin/" | tee -a $HOME/.bashrc
fi
}
Would become:
system.
WithTarget("/usr/local/go/).
WithArch("x86_64").
WithOverwrite(false).
WithVersion("v1.18.1")
WithMessageTemplate(`
# Add to your PATH variable or .bashrc:
export GOPATH=\$HOME/go/" | tee -a $HOME/.bashrc
echo "export PATH=\$PATH:/usr/local/go/bin/" | tee -a $HOME/.bashrc`)
Each command file would be added and populatet the Arch / Version etc in a similar way to how we do this for arkade get
Containerd is more involved:
export CONTAINERD_VERSION=1.6.1
install_containerd() {
DL_ARCH=$ARCH
if [ "$ARCH" == "x86_64" ]; then
DL_ARCH=amd64
else
if [ "$ARCH" == "aarch64" ]; then
DL_ARCH=arm64
fi
fi
mkdir -p /etc/containerd
if ! [ -e /etc/containerd/config.toml ]; then
cd $START_PWD
cp ./config.toml /etc/containerd/config.toml
fi
if ! [ -e /usr/local/bin/containerd ]; then
curl -sSL https://github.com/containerd/containerd/releases/download/v$CONTAINERD_VERSION/containerd-$CONTAINERD_VERSION-linux-$DL_ARCH.tar.gz > /tmp/containerd.tar.gz \
&& sudo tar -xvf /tmp/containerd.tar.gz -C /usr/local/bin/ --strip-components=1
containerd -version
curl -sLS https://raw.githubusercontent.com/containerd/containerd/v1.5.4/containerd.service > /tmp/containerd.service
echo "[Manager]" | tee -a /tmp/containerd.service
echo "DefaultTimeoutStartSec=3m" | tee -a /tmp/containerd.service
sudo cp /tmp/containerd.service /lib/systemd/system/
sudo systemctl enable containerd || echo "Failed to enable containerd, may be masked."
sudo systemctl daemon-reload
sudo systemctl restart containerd
fi
}
Therefore we'd want some additional SDK methods, as per the method we use for faasd: https://github.com/openfaas/faasd/blob/2885bb0c514a403d317b93e6d8add1ad52239a13/pkg/systemd/systemd.go
.WithFetch("https://raw.githubusercontent.com/containerd/containerd/v1.5.4/containerd.service", "/tmp/containerd.service")
.WithCp("/tmp/containerd.service", "/lib/systemd/system")
.WithDaemonReload().
.WithRestart("containerd")
I'm looking for someone to volunteer to add the first app, it needn't use an SDK for the first pass, we can extract this as we add apps.
An initial list of apps:
- Prometheus
- Golang
- containerd
- firecracker
- nodejs
- CNI plugins
I do not see this list becoming much larger than the above, but am open to suggestions from the community.
Activity