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
|
|
|
|
|
|
|
|
# Install docker-compose
|
|
|
|
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
|
|
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
|
2020-07-08 12:09:54 +00:00
|
|
|
# * DOMAIN_NAME - the domain name your server is using ie. example.com
|
|
|
|
# * 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
|
|
|
|
# * CLOUDFLARE_AUTH_TOKEN` - (optional) if using cloudflare as dns loadbalancer (need to change it in Caddyfile too)
|
|
|
|
# * 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
|
|
|
|
# * PORTAL_NAME - the name of the portal, required by the discord bot
|
|
|
|
# * DISCORD_BOT_TOKEN - required by the discord bot
|
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
|
2020-08-19 16:14:55 +00:00
|
|
|
printf "DOMAIN_NAME=example.com\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=\nPORTAL_NAME=\nDISCORD_BOT_TOKEN=\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
|