mirror of https://github.com/statping/statping
building
parent
5d071d8e6b
commit
535ee06414
|
@ -1,4 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
#
|
||||
# Statup Status Page Server
|
||||
# for EC2
|
||||
#
|
||||
# This script run everytime the EC2 is booted. It will maintain the most latest version of Statup
|
||||
# while removing old docker containers and images to reduce hard drive usage for long term use.
|
||||
#
|
||||
#
|
||||
|
||||
cd /home/ubuntu
|
||||
source /home/ubuntu/.profile
|
||||
sudo rm -rf startup.sh > /dev/null
|
||||
|
@ -11,12 +21,6 @@ EC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
|||
|
||||
if [ "$LETSENCRYPT_HOST" = "" ]
|
||||
then
|
||||
printf "\n Status Status Page on EC2\n"
|
||||
printf "================================================================================================================\n"
|
||||
printf "Point your domain's DNS records to one of these endpoints.\n"
|
||||
printf " A => EC2 Server IP: $EC_IP \n"
|
||||
printf "CNAME => EC2 Public DNS: $EC2_ENDPOINT\n"
|
||||
printf "================================================================================================================\n"
|
||||
sudo curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose.yml > /dev/null
|
||||
else
|
||||
printf " \n\n\n\nDomain found for SSL certificate - $LETSENCRYPT_HOST\n"
|
||||
|
@ -32,21 +36,49 @@ else
|
|||
sudo curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose-ssl.yml > /dev/null
|
||||
fi
|
||||
|
||||
sudo service docker start
|
||||
sudo service docker start > /dev/null
|
||||
|
||||
if [ "$LETSENCRYPT_HOST" = "" ]
|
||||
then
|
||||
sudo docker-compose pull
|
||||
sudo docker-compose up -d
|
||||
sudo docker-compose pull > /dev/null
|
||||
sudo docker-compose up -d > /dev/null
|
||||
else
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose pull
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose pull > /dev/null
|
||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d > /dev/null
|
||||
fi
|
||||
|
||||
sudo docker system prune -af
|
||||
sudo docker system prune -af > /dev/null
|
||||
|
||||
sudo curl https://raw.githubusercontent.com/hunterlong/statup/master/servers/init.sh > /home/ubuntu/init.sh
|
||||
sudo chmod +x /home/ubuntu/init.sh > /dev/null
|
||||
|
||||
printf "\n\n\n\n\n Status Status Page on EC2\n"
|
||||
printf "================================================================================================================\n"
|
||||
if [ "$LETSENCRYPT_HOST" = "" ]
|
||||
then
|
||||
printf "Point your domain's DNS records to one of these endpoints.\n"
|
||||
printf "A RECORD => $EC_IP \n"
|
||||
printf "CNAME RECORD => $EC2_ENDPOINT\n"
|
||||
printf "================================================================================================================\n"
|
||||
printf "Your Statup Server is ready! Go to the URL below to begin.\n"
|
||||
printf "Statup URL: $EC2_ENDPOINT\n"
|
||||
printf "================================================================================================================\n"
|
||||
else
|
||||
printf "Domain found for SSL certificate - $LETSENCRYPT_HOST\n"
|
||||
printf "================================================================================================================\n"
|
||||
printf "You must set the domains DNS records to point to this server!\n"
|
||||
printf "A RECORD => $EC_IP \n"
|
||||
printf "CNAME RECORD => $EC2_ENDPOINT\n"
|
||||
printf "================================================================================================================\n"
|
||||
printf "Once you set your DNS records, Lets Encrypt will automatically\n"
|
||||
printf "create a SSL certificate for you and redirect you to HTTPS\n\n"
|
||||
printf "================================================================================================================\n"
|
||||
printf "Your Statup Server is ready! Go to the URL below to begin.\n"
|
||||
printf "Statup URL: $EC2_ENDPOINT\n"
|
||||
printf "SSL Domain: $LETSENCRYPT_HOST\n"
|
||||
printf "================================================================================================================\n"
|
||||
fi
|
||||
|
||||
logger "Status Process complete. IP: $EC_IP | DNS: $EC2_ENDPOINT\n"
|
||||
printf "Status Process complete. IP: $EC_IP | DNS: $EC2_ENDPOINT\n"
|
||||
|
||||
# commands to reverse installation and only leave init.sh
|
||||
#sudo docker rm -f $(sudo docker ps -a -q)
|
||||
|
|
Loading…
Reference in New Issue