This repository was archived by the owner on Aug 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontdoor.sh
63 lines (51 loc) · 2.47 KB
/
frontdoor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
while [ "$(hostname -I)" = "" ]; do
echo -e "\e[1A\e[KNo network: $(date)"
sleep 1
done
echo "I have network";
resource_group_name=${resource_group_name}
storage_account_name=${storage_account_name}
app1_ipaddress=${app1_ipaddress}
github_username=${github_username}
github_token=${github_token}
sudo -- sh -c -e "echo '$app1_ipaddress app1' >> /etc/hosts"
sudo apt-add-repository -y 'deb http://archive.ubuntu.com/ubuntu/ kinetic main restricted'
sudo apt-add-repository -y 'deb http://archive.ubuntu.com/ubuntu/ kinetic-updates main restricted'
sudo apt-add-repository -y 'deb http://archive.ubuntu.com/ubuntu/ kinetic universe'
sudo apt-add-repository -y 'deb http://archive.ubuntu.com/ubuntu/ kinetic-updates universe'
sudo apt-add-repository -y 'deb http://archive.ubuntu.com/ubuntu/ kinetic-backports main restricted universe multiverse'
sudo apt update
echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
sudo apt install -y podman
sudo apt-get update
sudo apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg
curl -sL https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
AZ_REPO="bullseye" # $(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update
sudo apt-get install -y azure-cli
az extension add --name storage-preview
az login --identity
podman login ghcr.io --tls-verify --username $github_username --password $github_password
# edge
sudo mkdir /var/edge/
sudo touch /var/edge/error.log
sudo touch /var/edge/access.log
sudo printf "
#!/bin/bash
az login --identity
podman login ghcr.io --tls-verify --username '$github_username' --password '$github_token'
sudo az storage blob directory download --container 'frontdoor' --account-name '$storage_account_name' --source-path '*' --destination-path '/var/edge/' --recursive
sudo podman run -p 443:443 --name edge --restart unless-stopped --replace --tls-verify --pull always -d -v /var/edge/nginx.conf:/etc/nginx/nginx.conf -v /var/edge/error.log:/var/log/nginx/error.log -v /var/edge/access.log:/var/log/nginx/access.log -v /var/edge/:/var/edge/ ghcr.io/gordonbeeming/devstarops-edge:main
" >> /var/edge/update.sh
cd /var/edge/
sudo chmod u+x update.sh
sudo ./update.sh
# Debug Things
# systemctl status nginx
# cat /etc/apt/sources.list
# cat /var/log/cloud-init-output.log