diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-autosuggestions b/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-autosuggestions deleted file mode 160000 index a411ef3..0000000 --- a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-autosuggestions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-history-substring-search b/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-history-substring-search deleted file mode 160000 index 4abed97..0000000 --- a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-history-substring-search +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4abed97b6e67eb5590b39bcd59080aa23192f25d diff --git a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting b/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting deleted file mode 160000 index c7caf57..0000000 --- a/hasql.nixc.us/echo/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7caf57ca805abd54f11f756fda6395dd4187f8a diff --git a/hasql.nixc.us/user-data.sh b/hasql.nixc.us/user-data.sh deleted file mode 100644 index 817c0f0..0000000 --- a/hasql.nixc.us/user-data.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -set -e -# export SENTRY_DSN=https://d7eb76933ae046c9a4fd3d29572b1462:3aba191d95a648118e78cc5f81cbd92c@sentry.adventuresinnewmedia.com/43 -# eval "$(sentry-cli bash-hook)" - -## digitalocean-user-data sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns -## digitalocean-user-data@nixc.us -## #!/usr/bin/env bash -## source <(curl -s https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/do-userdata/raw/branch/master/hasql.nixc.us/user-data.sh) - -# curl -sL https://sentry.io/get-cli/ | bash - -## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## -export HOSTNAME=$(curl -s http://169.254.169.254/metadata/v1/hostname) -echo $HOSTNAME > /etc/hostname -hostname -F /etc/hostname -hostname -f -export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) -export PUBLIC_IPV6=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address) -## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## - -## Installing Salt for Ubuntu 20.04 -curl -fsSL -o /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest/salt-archive-keyring.gpg -echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest focal main" | sudo tee /etc/apt/sources.list.d/salt.list -mkdir -p /etc/salt/minion.d/ -echo 'master: nacl.nixc.us' > /etc/salt/minion.d/99-master-address.conf - -## Installing Glusterfs-7 https://www.digitalocean.com/community/tutorials/how-to-create-a-redundant-storage-pool-using-glusterfs-on-ubuntu-20-04 -# echo |add-apt-repository ppa:gluster/glusterfs-7 - -## Install Container Top ctop -echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list -wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add - - -## Installing packages -apt-get update -DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::='--force-confold' --force-yes -fuy dist-upgrade -DEBIAN_FRONTEND=noninteractive apt-get install -y asciinema iftop htop glances zsh salt-minion docker-ctop asciinema git -# DEBIAN_FRONTEND=noninteractive apt-get install -y glusterfs-server glusterfs-client - -## Install docker-compose and docker using convenience scripts -curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -chmod +x /usr/local/bin/docker-compose -curl -fsSL https://get.docker.com -o get-docker.sh -sh get-docker.sh - -## Install CTOP Container Top -wget https://github.com/bcicen/ctop/releases/download/0.7.6/ctop-0.7.6-linux-amd64 -O /usr/local/bin/ctop -chmod +x /usr/local/bin/ctop - -## Force install ohmyzsh on first login -curl -o /root/zsh-setup.sh https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/do-userdata/raw/branch/master/hasql.nixc.us/zsh-setup.sh -echo bash ~/zsh-setup.sh >> ~/.profile -# source ~/.profile diff --git a/scripts/ bootstrap.sh b/scripts/ bootstrap.sh new file mode 100644 index 0000000..ac675aa --- /dev/null +++ b/scripts/ bootstrap.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +set -e + +echo 'export SENTRY_DSN=https://4d089076433c4a7aa31bbb2741f053fe@sentry.aenow.com/3' +eval "$(sentry-cli bash-hook)" + +## Determine in the future why these were here. https://docs.digitalocean.com/products/droplets/how-to/provide-user-data/ +## digitalocean-user-data sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns +## digitalocean-user-data@nixc.us + +# curl -sL https://sentry.io/get-cli/ | bash + +## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## +export HOSTNAME=$(curl -s http://169.254.169.254/metadata/v1/hostname) +echo $HOSTNAME > /etc/hostname +hostname -F /etc/hostname +hostname -f +export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) +export PUBLIC_IPV6=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address) +## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## + +function install_salt() { + ## Installing Salt for Ubuntu 20.04 + curl -fsSL -o /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest/salt-archive-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest focal main" | sudo tee /etc/apt/sources.list.d/salt.list + mkdir -p /etc/salt/minion.d/ + echo 'master: nacl.nixc.us' > /etc/salt/minion.d/99-master-address.conf +} + +function install_gluster_pre() { + ## Installing Glusterfs-7 https://www.digitalocean.com/community/tutorials/how-to-create-a-redundant-storage-pool-using-glusterfs-on-ubuntu-20-04 + apt-get update && apt-get -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates + echo |add-apt-repository ppa:gluster/glusterfs-7 +} +function install_gluster_post() { + DEBIAN_FRONTEND=noninteractive apt-get install -y glusterfs-server glusterfs-client +} + +## Install Container Top ctop +echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list +wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add - + +## Install Gluster Pre +case $1 in + gluster ) + install_gluster_pre + ;; + nogluster ) + echo not installing gluster. + ;; + * ) + echo no gluster instructions received. + echo options are: + echo ./user-data.sh gluster + echo ./user-data.sh nogluster + ;; +esac + +## Installing packages +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::='--force-confold' --force-yes -fuy dist-upgrade +DEBIAN_FRONTEND=noninteractive apt-get install -y asciinema docker-ctop docker-compose-plugin git glances htop iftop salt-minion zsh + +## Install docker-compose and docker using convenience scripts +curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose +curl -fsSL https://get.docker.com -o get-docker.sh +sh get-docker.sh + +## Install CTOP Container Top +wget https://github.com/bcicen/ctop/releases/download/0.7.6/ctop-0.7.6-linux-amd64 -O /usr/local/bin/ctop +chmod +x /usr/local/bin/ctop + +## Force install ohmyzsh on first login +# curl -o /root/zsh-setup.sh https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/do-userdata/raw/branch/main/scripts/zsh-setup.sh +echo zsh-setup >> ~/.profile +# source ~/.profile diff --git a/hasql.nixc.us/zsh-setup.sh b/scripts/zsh-setup.sh similarity index 55% rename from hasql.nixc.us/zsh-setup.sh rename to scripts/zsh-setup.sh index 0f03da1..c88cf9b 100644 --- a/hasql.nixc.us/zsh-setup.sh +++ b/scripts/zsh-setup.sh @@ -5,11 +5,62 @@ USRDIR=$(echo ~) sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended # echo y|sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sed -i'' -e 's@ZSH_THEME="robbyrussell"@ZSH_THEME="pygmalion"@' $USRDIR/.zshrc -## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## -echo 'export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)' >> $USRDIR/.zshrc -echo 'export PUBLIC_IPV6=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address)' >> $USRDIR/.zshrc -echo 'export SENTRY_DSN=https://d7eb76933ae046c9a4fd3d29572b1462:3aba191d95a648118e78cc5f81cbd92c@sentry.adventuresinnewmedia.com/43' >> $USRDIR/.zshrc -## BLOCK THIS OUT IF NOT DEPLOYING TO DIGITALOCEAN ## + +## Just install sentry DSN server info here. +function ae_sentry() { + # https://4d089076433c4a7aa31bbb2741f053fe@sentry.aenow.com/3 + echo 'export SENTRY_DSN=https://4d089076433c4a7aa31bbb2741f053fe@sentry.aenow.com/3' >> $USRDIR/.zshrc +} + +## DigitalOcean's API for obtaining server metadata. +function digitalocean() { + echo 'export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)' >> $USRDIR/.zshrc + echo 'export PUBLIC_IPV6=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address)' >> $USRDIR/.zshrc +} + +## Add anything for OVH here. +function ovh() { + echo Nothing to see here at the moment. +} + +## Choose which DC provider sepecifics need installed. +case $1 in + digitalocean ) + digitalocean + ;; + ovh ) + ovh + ;; + none ) + echo Nothing special going to be done here. + ;; + * ) + echo zsh-setup.sh options are: + echo zsh-setup.sh ovh + echo zsh-setup.sh digitalocean + echo zsh-setup.sh none + ;; +esac + +case $2 in + ae-sentry ) + ae_sentry + ;; + my-sentry ) + echo "buy a server for this you poor old sodd" + ;; + none ) + echo You have elected to not add a Sentry server. + ;; + * ) + echo No sentry option chosen however one must be chosen. The options are: + echo "zsh-setup.sh hosting-provider ae-sentry" + echo "zsh-setup.sh hosting-provider my-sentry" + echo "zsh-setup.sh hosting-provider none" + ;; +esac + +## Docker build fast export DOCKER_BUILDKIT=1 # or configure in daemon.json export COMPOSE_DOCKER_CLI_BUILD=1 @@ -38,7 +89,7 @@ export COMPOSE_DOCKER_CLI_BUILD=1 EOF ## Enable plugins -sed -i'' -e 's@plugins=(git)@plugins=(git cp colored-man-pages docker docker-compose extract iterm2 python rsync safe-paste transfer ubuntu zsh-navigation-tools zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search command-time)@' $USRDIR/.zshrc +sed -i'' -e 's@plugins=(git)@plugins=(git cp colored-man-pages docker docker-compose extract iterm2 python rsync safe-paste transfer ubuntu zsh-navigation-tools zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search command-time universalarchive)@' $USRDIR/.zshrc ## Cleanup diff --git a/strap.sh b/strap.sh new file mode 100644 index 0000000..fd3f752 --- /dev/null +++ b/strap.sh @@ -0,0 +1,8 @@ +## #!/usr/bin/env bash +set -e +## source <(curl -s https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/bootstrap-scripts/raw/branch/main/strap.sh) +curl -sL https://sentry.io/get-cli/ | bash +echo 'export SENTRY_DSN=https://4d089076433c4a7aa31bbb2741f053fe@sentry.aenow.com/3' +eval "$(sentry-cli bash-hook)" +curl -o /usr/local/sbin/zsh-setup https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/bootstrap-scripts/raw/branch/main/scripts/zsh-setup.sh && chmod +x /usr/local/sbin/zsh-setup +curl -o /usr/local/sbin/bootstrap https://digitalocean-user-data:sHEG3NTC6og8pCJDTF6EPYb8jLmbskx5Ns@git.nixc.us/Colin_/bootstrap-scripts/raw/branch/main/scripts/bootstrap.sh && chmod +x /usr/local/sbin/bootstrap