2020-06-22 09:54:01 +00:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
|
|
|
set -e # exit on first error
|
|
|
|
|
|
|
|
# Install docker (cleans up old docker installation)
|
|
|
|
# sudo apt-get remove -y docker docker-engine docker.io containerd runc # fails if it is the first installation
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
|
|
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
|
|
|
docker --version # sanity check
|
|
|
|
|
2020-09-14 13:57:44 +00:00
|
|
|
# add user to docker group to avoid having to use sudo for every docker command
|
|
|
|
sudo usermod -aG docker user
|
|
|
|
|
2020-06-22 09:54:01 +00:00
|
|
|
# Install docker-compose
|
2021-09-15 10:50:22 +00:00
|
|
|
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
2020-06-22 09:54:01 +00:00
|
|
|
sudo chmod +x /usr/local/bin/docker-compose
|
|
|
|
docker-compose --version # sanity check
|
|
|
|
|
2020-08-19 16:14:55 +00:00
|
|
|
# Create dummy .env file for docker-compose usage with variables
|
2021-08-27 12:15:22 +00:00
|
|
|
# * PORTAL_DOMAIN - (required) is a skynet portal domain (ex. siasky.net)
|
|
|
|
# * SERVER_DOMAIN - (optional) is an optional direct server domain (ex. eu-ger-1.siasky.net) - leave blank unless it is different than PORTAL_DOMAIN
|
2020-07-08 12:09:54 +00:00
|
|
|
# * EMAIL_ADDRESS - this is the administrator contact email you need to supply for communication regarding SSL certification
|
|
|
|
# * HSD_API_KEY - this is auto generated secure key for your handshake service integration
|
2021-04-01 13:15:37 +00:00
|
|
|
# * CLOUDFLARE_AUTH_TOKEN - (optional) if using cloudflare as dns loadbalancer (need to change it in Caddyfile too)
|
2020-07-08 12:09:54 +00:00
|
|
|
# * AWS_ACCESS_KEY_ID - (optional) if using route53 as a dns loadbalancer
|
|
|
|
# * AWS_SECRET_ACCESS_KEY - (optional) if using route53 as a dns loadbalancer
|
2020-08-19 16:14:55 +00:00
|
|
|
# * API_PORT - (optional) the port on which siad is listening, defaults to 9980
|
2021-07-16 11:12:58 +00:00
|
|
|
# * DISCORD_WEBHOOK_URL - (required if using Discord notifications) discord webhook url (generate from discord app)
|
|
|
|
# * DISCORD_MENTION_USER_ID - (optional) add `/cc @user` mention to important messages from webhook (has to be id not user name)
|
|
|
|
# * DISCORD_MENTION_ROLE_ID - (optional) add `/cc @role` mention to important messages from webhook (has to be id not role name)
|
2021-04-01 13:15:37 +00:00
|
|
|
# * SKYNET_DB_USER - (optional) if using `accounts` this is the MongoDB username
|
|
|
|
# * SKYNET_DB_PASS - (optional) if using `accounts` this is the MongoDB password
|
|
|
|
# * SKYNET_DB_HOST - (optional) if using `accounts` this is the MongoDB address or container name
|
|
|
|
# * SKYNET_DB_PORT - (optional) if using `accounts` this is the MongoDB port
|
|
|
|
# * COOKIE_DOMAIN - (optional) if using `accounts` this is the domain to which your cookies will be issued
|
|
|
|
# * COOKIE_HASH_KEY - (optional) if using `accounts` hashing secret, at least 32 bytes
|
|
|
|
# * COOKIE_ENC_KEY - (optional) if using `accounts` encryption key, at least 32 bytes
|
2020-06-22 09:54:01 +00:00
|
|
|
if ! [ -f /home/user/skynet-webportal/.env ]; then
|
2020-07-27 09:30:55 +00:00
|
|
|
HSD_API_KEY=$(openssl rand -base64 32) # generate safe random key for handshake
|
2022-02-16 13:13:37 +00:00
|
|
|
printf "PORTAL_DOMAIN=siasky.net\nSERVER_DOMAIN=\nEMAIL_ADDRESS=email@example.com\nSIA_WALLET_PASSWORD=\nHSD_API_KEY=${HSD_API_KEY}\nCLOUDFLARE_AUTH_TOKEN=\nAWS_ACCESS_KEY_ID=\nAWS_SECRET_ACCESS_KEY=\nDISCORD_WEBHOOK_URL=\nDISCORD_MENTION_USER_ID=\nDISCORD_MENTION_ROLE_ID=\n" > /home/user/skynet-webportal/.env
|
2020-06-22 09:54:01 +00:00
|
|
|
fi
|
2020-07-08 12:49:06 +00:00
|
|
|
|
|
|
|
# Start docker container with nginx and client
|
2020-08-19 16:14:55 +00:00
|
|
|
docker-compose -f docker-compose.yml up --build -d
|