Files
shpod/setup-tailhist.sh
Jérôme Petazzoni 65557d7e3d 🔧 Update tailhist.html URL
2023-04-11 10:20:04 +02:00

22 lines
709 B
Bash
Executable File

#!/bin/sh
set -ex
mkdir /tmp/tailhist
cd /tmp/tailhist
WEBSOCKETD_VERSION=0.4.1
wget https://github.com/joewalnes/websocketd/releases/download/v$WEBSOCKETD_VERSION/websocketd-$WEBSOCKETD_VERSION-linux_amd64.zip
unzip websocketd-$WEBSOCKETD_VERSION-linux_amd64.zip
curl https://raw.githubusercontent.com/jpetazzo/container.training/main/prepare-labs/lib/tailhist.html > index.html
kubectl patch service shpod --namespace shpod -p "
spec:
ports:
- name: tailhist
port: 1088
targetPort: 1088
nodePort: 30088
protocol: TCP
"
./websocketd --port=1088 --staticdir=. sh -c "
tail -n +1 -f $HOME/.history ||
echo 'Could not read history file. Perhaps you need to \"chmod +r .history\"?'
"