Press "Enter" to skip to content

VPS Seedbox Script 2020

Last updated on May 28, 2020

I made a script for seedbox creation.

#!/bin/bash

echo "  >> removing old dockers"
sudo apt-get remove docker docker-engine docker.io containerd runc

echo "  >> updating"
sudo apt-get update

echo "  >> installing deps"
sudo apt-get -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

echo "  > adding docker gpg key"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

echo "  >> adding apt repo"
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

echo "  >> updating"
sudo apt-get -y update

echo "  >> installing docker"
sudo apt-get -y install docker-ce docker-ce-cli containerd.io


echo "  >> testing docker"
sudo docker run hello-world

echo "  >> downloading pibox"
sudo apt-get -y install git jq
cd ~/
git clone https://github.com/seedboxes/pibox

echo "  >> installing pibox"
~/pibox/bin/start

echo "  >> notifying admin of installation"
username="$(sed -n -r 's/.*user : (.+)/\1/p' /tmp/firstboot.log)"
password="$(sed -n -r 's/.*password : (.+)/\1/p' /tmp/firstboot.log)"
ip="$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}')"
content="Address: https://${ip}/\n username: ${username}\n password: ${password}"

generate_post_data() {
  cat <<EOF
{
  "personalizations": [{
    "to": [{
      "email": "chris@grimtech.net"
    }]
  }],
  "from": {
    "email": "chris@grimtech.net"
  },
  "subject": "Seedbox Launched!",
  "content": [{
    "type": "text/plain",
    "value": "${content}"
  }]
}
EOF
}
export SENDGRID_API_KEY='<API_KEY>'

curl --request POST \
  --url https://api.sendgrid.com/v3/mail/send \
  --header "Authorization: Bearer $SENDGRID_API_KEY" \
  --header 'Content-Type: application/json' \
  --data "$(generate_post_data)"

Looking for VOCALOID trading cards?

Check out Sakura Blossom Trading Post

Leave a Reply

Your email address will not be published.