mirror of
https://github.com/openoms/bitcoin-tutorials.git
synced 2025-12-19 04:54:18 +01:00
update k3d devenv
This commit is contained in:
@@ -48,8 +48,13 @@ HandleLidSwitchDocked=ignore" | sudo tee /etc/systemd/logind.conf.d/nosuspend.co
|
|||||||
|
|
||||||
function setup_devenv_k3d() {
|
function setup_devenv_k3d() {
|
||||||
# dedicated user
|
# dedicated user
|
||||||
sudo adduser --disabled-password --gecos "" k3d
|
USERNAME=k3d
|
||||||
sudo usermod -aG sudo k3d
|
echo "# add the user: ${USERNAME}"
|
||||||
|
sudo adduser --system --group --shell /bin/bash --home /home/${USERNAME} ${USERNAME}
|
||||||
|
echo "Copy the skeleton files for login"
|
||||||
|
sudo -u ${USERNAME} cp -r /etc/skel/. /home/${USERNAME}/
|
||||||
|
|
||||||
|
sudo adduser ${USERNAME} sudo
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -135,10 +140,10 @@ function setup_devenv_k3d() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# KUBE_CONFIG_PATH
|
# KUBE_CONFIG_PATH
|
||||||
echo 'export KUBE_CONFIG_PATH=~/.kube/config' \
|
echo 'export KUBE_CONFIG_PATH=~/.kube/config' |
|
||||||
| sudo -u k3d tee -a /home/k3d/.bashrc
|
sudo -u k3d tee -a /home/k3d/.bashrc
|
||||||
# aliases
|
# aliases
|
||||||
echo "\
|
echo "\
|
||||||
alias egrep='egrep --color=auto'
|
alias egrep='egrep --color=auto'
|
||||||
alias fgrep='fgrep --color=auto'
|
alias fgrep='fgrep --color=auto'
|
||||||
alias g='git'
|
alias g='git'
|
||||||
@@ -149,70 +154,70 @@ alias l='ls -CF'
|
|||||||
alias la='ls -A'
|
alias la='ls -A'
|
||||||
alias ll='ls -alF'
|
alias ll='ls -alF'
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
alias tf='terraform'" \
|
alias tf='terraform'" |
|
||||||
| sudo -u k3d tee -a /home/k3d/.bash_aliases
|
sudo -u k3d tee -a /home/k3d/.bash_aliases
|
||||||
|
|
||||||
if [ "${cpu}" = arm64 ]; then
|
if [ "${cpu}" = arm64 ]; then
|
||||||
# https://code.pinske.eu/k3d-raspi.html
|
# https://code.pinske.eu/k3d-raspi.html
|
||||||
if ! grep "cgroup_memory=1 cgroup_enable=memory" < /boot/cmdline.txt; then
|
if ! grep "cgroup_memory=1 cgroup_enable=memory" </boot/cmdline.txt; then
|
||||||
sudo sed -i s/$/ cgroup_memory=1 cgroup_enable=memory/ /boot/cmdline.txt
|
sudo sed -i s/$/ cgroup_memory=1 cgroup_enable=memory/ /boot/cmdline.txt
|
||||||
echo "# Will need to reboot to create a cluster successfully"
|
echo "# Will need to reboot to create a cluster successfully"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# PATH
|
# PATH
|
||||||
echo "PATH=$PATH:~/go/bin" | sudo -u k3d tee -a /home/k3d/.bashrc
|
echo "PATH=$PATH:~/go/bin" | sudo -u k3d tee -a /home/k3d/.bashrc
|
||||||
|
|
||||||
# for the smoketests
|
# for the smoketests
|
||||||
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
||||||
|
|
||||||
# open file limits
|
# open file limits
|
||||||
echo "# show current open file limits"
|
echo "# show current open file limits"
|
||||||
sysctl fs.inotify
|
sysctl fs.inotify
|
||||||
echo "# increase open file limits"
|
echo "# increase open file limits"
|
||||||
sudo sysctl -w fs.inotify.max_user_instances=1024
|
sudo sysctl -w fs.inotify.max_user_instances=1024
|
||||||
sudo sysctl -w fs.inotify.max_user_watches=524288
|
sudo sysctl -w fs.inotify.max_user_watches=524288
|
||||||
echo "\
|
echo "\
|
||||||
fs.inotify.max_user_instances=1024
|
fs.inotify.max_user_instances=1024
|
||||||
fs.inotify.max_user_watches=524288
|
fs.inotify.max_user_watches=524288
|
||||||
" | sudo tee -a /etc/sysctl.conf
|
" | sudo tee -a /etc/sysctl.conf
|
||||||
|
|
||||||
# ZFS # https://github.com/k3s-io/k3s/issues/1688#issuecomment-619570374
|
# ZFS # https://github.com/k3s-io/k3s/issues/1688#issuecomment-619570374
|
||||||
if [ $(df -T /var/lib/docker | grep -c zfs) -gt 0 ]; then
|
if [ $(df -T /var/lib/docker | grep -c zfs) -gt 0 ]; then
|
||||||
zfs create -s -V 750GB rpool/ROOT/docker
|
zfs create -s -V 750GB rpool/ROOT/docker
|
||||||
mkfs.ext4 /dev/zvol/rpool/ROOT/docker
|
mkfs.ext4 /dev/zvol/rpool/ROOT/docker
|
||||||
echo "/dev/zvol/rpool/ROOT/docker /var/lib/docker ext4 defaults 0 0" >> /etc/fstab
|
echo "/dev/zvol/rpool/ROOT/docker /var/lib/docker ext4 defaults 0 0" >>/etc/fstab
|
||||||
echo "# needs reboot"
|
echo "# needs reboot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# swap # https://github.com/lightningnetwork/lnd/issues/3612#issuecomment-1399208499
|
# swap # https://github.com/lightningnetwork/lnd/issues/3612#issuecomment-1399208499
|
||||||
if [ $(cat /proc/swaps | wc -l) -lt 2 ]; then
|
if [ $(cat /proc/swaps | wc -l) -lt 2 ]; then
|
||||||
sudo apt install zram-config
|
sudo apt install zram-config
|
||||||
echo "# needs reboot"
|
echo "# needs reboot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# gcloud
|
# gcloud
|
||||||
# https://cloud.google.com/sdk/docs/install#deb
|
# https://cloud.google.com/sdk/docs/install#deb
|
||||||
if ! which gcloud; then
|
if ! which gcloud; then
|
||||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
||||||
sudo apt-get update && sudo apt-get install google-cloud-cli
|
sudo apt-get update && sudo apt-get install google-cloud-cli
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#ytt
|
#ytt
|
||||||
|
|
||||||
#yq
|
#yq
|
||||||
|
|
||||||
# fly
|
# fly
|
||||||
wget https://github.com/concourse/concourse/releases/download/v7.9.1/fly-7.9.1-linux-amd64.tgz
|
wget https://github.com/concourse/concourse/releases/download/v7.9.1/fly-7.9.1-linux-amd64.tgz
|
||||||
tar -xvf fly-7.9.1-linux-amd64.tgz
|
tar -xvf fly-7.9.1-linux-amd64.tgz
|
||||||
sudo mv fly /usr/local/bin
|
sudo mv fly /usr/local/bin
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_dev_charts() {
|
function start_dev_charts() {
|
||||||
# starting the charts
|
# starting the charts
|
||||||
cd /home/k3d/
|
cd /home/k3d/
|
||||||
sudo -u k3d git clone https://github.com/GaloyMoney/charts
|
sudo -u k3d git clone https://github.com/GaloyMoney/charts
|
||||||
cd /home/k3d/charts/dev
|
cd /home/k3d/charts/dev
|
||||||
|
|
||||||
sudo -u k3d direnv allow
|
sudo -u k3d direnv allow
|
||||||
|
|||||||
Reference in New Issue
Block a user