k3d: use blitz.docker.sh if present, add tmux, fzf

This commit is contained in:
openoms
2022-06-15 08:58:47 +01:00
parent c486252898
commit a4fca3fd95

View File

@@ -12,26 +12,13 @@ function setup_devenv_k3d() {
# dedicated user
sudo adduser --disabled-password --gecos "" k3d
sudo usermod -aG sudo k3d
# aliases and fzf
echo '\
/usr/share/doc/fzf/examples/key-bindings.bashrc
/usr/share/doc/fzf/examples/completion.bash
export KUBE_CONFIG_PATH=~/.kube/config' \
| sudo -u k3d tee -a /home/k3d/.bashrc
echo "\
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias g='git'
alias grep='grep --color=auto'
alias gs='git status'
alias k='kubectl'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias tf='terraform'" \
| sudo -u k3d tee -a /home/k3d/.bash_aliases
# tools
sudo apt update
sudo apt install -y git tmux
# fzf
sudo -u k3d sh -c 'git clone --depth 1 https://github.com/junegunn/fzf.git /home/k3d/.fzf; /home/k3d/.fzf/install'
# kubectl
kubectl_version="1.24.1"
@@ -46,15 +33,40 @@ wget https://bitcoincore.org/bin/bitcoin-core-${bitcoin_version}/bitcoin-${bitco
&& sudo mv bitcoin-${bitcoin_version}/bin/* /usr/local/bin
# docker
# look for raspiblitz install script
if [ -f /home/admin/config.scripts/blitz.docker.sh ]; then
/home/admin/config.scripts/blitz.docker.sh on
else
# https://docs.docker.com/desktop/linux/install/debian/
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
fi
sudo groupadd docker
sudo usermod -aG docker k3d
# k3d
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
# KUBE_CONFIG_PATH
echo 'export KUBE_CONFIG_PATH=~/.kube/config' \
| sudo -u k3d tee -a /home/k3d/.bashrc
# aliases
echo "\
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias g='git'
alias grep='grep --color=auto'
alias gs='git status'
alias k='kubectl'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias tf='terraform'" \
| sudo -u k3d tee -a /home/k3d/.bash_aliases
}
function start_dev_charts() {
# starting the charts
cd /home/k3d/
sudo -u k3d git clone https://github.com/GaloyMoney/charts
@@ -74,9 +86,10 @@ function delete_cluster() {
# k3d cluster delete && rm terraform.tfstate
}
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
if [ "$1" = "on" ]; then
setup_devenv_k3d
elif [ "$1" = "0" ] || [ "$1" = "off" ]; then
start_dev_charts
elif [ "$1" = "off" ]; then
delete_cluster
else
help