mirror of https://github.com/statping/statping
building
parent
abe05f7f3b
commit
8c11f873cf
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
|
||||||
|
|
||||||
## Domain for new SSL certificate
|
## Domain for new SSL certificate
|
||||||
LETSENCRYPT_HOST="status.balancebadge.io"
|
LETSENCRYPT_HOST="status.balancebadge.io"
|
||||||
|
@ -17,4 +18,4 @@ sudo printf "\nexport LETSENCRYPT_HOST=$LETSENCRYPT_HOST\n" >> /root/.profile
|
||||||
sudo printf "export LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL\n" >> /root/.profile
|
sudo printf "export LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL\n" >> /root/.profile
|
||||||
source /home/ubuntu/.profile
|
source /home/ubuntu/.profile
|
||||||
sudo /bin/bash -c "source /root/.profile"
|
sudo /bin/bash -c "source /root/.profile"
|
||||||
LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL ./startup.sh
|
LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL /home/ubuntu/init.sh
|
||||||
|
|
|
@ -1,19 +1,38 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cd /home/ubuntu
|
cd /home/ubuntu
|
||||||
sudo rm -rf startup.sh
|
source /home/ubuntu/.profile
|
||||||
sudo curl -o startup.sh -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/startup.sh
|
sudo rm -rf startup.sh > /dev/null
|
||||||
sudo chmod +x startup.sh
|
sudo curl -o startup.sh -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/startup.sh > /dev/null
|
||||||
|
sudo chmod +x startup.sh > /dev/null
|
||||||
|
sudo rm -f docker-compose.yml > /dev/null
|
||||||
|
|
||||||
|
EC2_ENDPOINT=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
|
||||||
|
EC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
|
||||||
|
|
||||||
sudo rm -f docker-compose.yml
|
|
||||||
if [ "$LETSENCRYPT_HOST" = "" ]
|
if [ "$LETSENCRYPT_HOST" = "" ]
|
||||||
then
|
then
|
||||||
sudo curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose.yml
|
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
|
else
|
||||||
sudo curl -o docker-compose.yml -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/hunterlong/statup/master/servers/docker-compose-ssl.yml
|
printf " \n\n\n\nDomain found for SSL certificate - $LETSENCRYPT_HOST\n"
|
||||||
|
printf "================================================================================================================\n"
|
||||||
|
printf "You must set the domains DNS records to point to this server!\n"
|
||||||
|
printf " EC2 Server IP: $EC_IP\n"
|
||||||
|
printf " EC2 Public DNS: $EC2_ENDPOINT\n"
|
||||||
|
printf "================================================================================================================\n"
|
||||||
|
printf " CNAME $LETSENCRYPT_HOST => $EC2_ENDPOINT (if not using Elastic IP)\n"
|
||||||
|
printf " A $LETSENCRYPT_HOST => $EC_IP (or use A record if you are using an Elastic IP)\n"
|
||||||
|
printf "================================================================================================================\n\n\n"
|
||||||
|
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
sudo service docker start
|
sudo service docker start
|
||||||
sudo docker system prune -af
|
|
||||||
|
|
||||||
if [ "$LETSENCRYPT_HOST" = "" ]
|
if [ "$LETSENCRYPT_HOST" = "" ]
|
||||||
then
|
then
|
||||||
|
@ -24,4 +43,13 @@ else
|
||||||
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d
|
sudo LETSENCRYPT_HOST=$LETSENCRYPT_HOST LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL docker-compose up -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sudo docker system prune -af
|
||||||
|
|
||||||
|
logger "Status Process complete. IP: $EC_IP | DNS: $EC2_ENDPOINT\n"
|
||||||
|
|
||||||
|
#sudo docker rm -f $(sudo docker ps -a -q)
|
||||||
|
#sudo docker rmi $(sudo docker images -q)
|
||||||
|
#rm -rf docker-compose.yml
|
||||||
|
#sudo rm -rf statup
|
||||||
|
#sudo rm startup.sh
|
||||||
|
#sudo service docker stop
|
||||||
|
|
Loading…
Reference in New Issue