Skip to content

Commit 22cf752

Browse files
author
Kevin Reynolds
committed
test uodate
1 parent 3cc591b commit 22cf752

File tree

2 files changed

+83
-9
lines changed

2 files changed

+83
-9
lines changed

labapp/app/markdown/lb.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,33 @@ Build an origin pool and load balancer based on the following criteria:
2020

2121

2222
<div class="form-check">
23-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
23+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
2424
<label class="form-check-label" for="flexCheckDefault">
2525
The URL for the cloud app hosted in AWS is <a href="https://aws-cloud-app.mcn-lab.f5demos.com">https://aws-cloud-app.mcn-lab.f5demos.com</a>
2626
</label>
2727
</div>
2828
<div class="form-check">
29-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
29+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
3030
<label class="form-check-label" for="flexCheckCDefault">
3131
The cloud app is only reachable from the "student-awsnet" site.
3232
</label>
3333
</div>
3434
<div class="form-check">
35-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
35+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
3636
<label class="form-check-label" for="flexCheckCDefault">
3737
The cloud app is TLS enabled.
3838
</label>
3939
</div>
4040
<div class="form-check">
41-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
41+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
4242
<label class="form-check-label" for="flexCheckCDefault">
4343
Use the wildcard cert provided in the shared NS, "mcn-lab-wildcard", to enable TLS on the LB.
4444
</label>
4545
</div>
4646
<div class="form-check">
47-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
47+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
4848
<label class="form-check-label" for="flexCheckCDefault">
49-
The load balancer should only be advertised from your CE in UDF. Do not advertise this service on the Internet.
49+
The load balancer should only be advertised from your CE in UDF. <b>Do not advertise this service on the Internet.</b>
5050
</label>
5151
</div>
5252

@@ -118,19 +118,19 @@ For the second exercise, make the cloud application running in Azure available t
118118
Create a new origin pool for the Azure cloud app. Reuse your load balancer.
119119

120120
<div class="form-check">
121-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
121+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
122122
<label class="form-check-label" for="flexCheckDefault">
123123
The URL for the cloud app hosted in Azure is <a href="https://azure-cloud-app.mcn-lab.f5demos.com">https://aws-cloud-app.mcn-lab.f5demos.com</a>
124124
</label>
125125
</div>
126126
<div class="form-check">
127-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
127+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
128128
<label class="form-check-label" for="flexCheckCDefault">
129129
The cloud app is only reachable from the "student-azurenet" site.
130130
</label>
131131
</div>
132132
<div class="form-check">
133-
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
133+
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault" checked>
134134
<label class="form-check-label" for="flexCheckCDefault">
135135
The cloud app is TLS enabled.
136136
</label>

labapp/labapp_installer.sh

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
# Update apt
4+
sudo DEBIAN_FRONTEND=noninteractive apt-get update --yes
5+
6+
# Check if Docker is installed, install it if it's not
7+
if ! command -v pip &> /dev/null
8+
then
9+
echo "Docker could not be found, installing..."
10+
sudo apt-get install -y python3-pip
11+
fi
12+
13+
# Variable Declarations
14+
IMAGE=ghcr.io/f5devcentral/f5xc-lab-mcn-practical/labapp:latest
15+
SERVICE=mcn-practical-labapp.service
16+
APPDIR=/opt/mcn-practical-labapp/app
17+
SCRIPTDIR=/opt/mcn-practical-labapp/script
18+
REPO_URL=https://github.com/f5devcentral/f5xc-lab-mcn-practical.git
19+
BRANCH=dev
20+
21+
# Create directories
22+
mkdir -p $SCRIPTDIR
23+
mkdir -p $APPDIR
24+
25+
# Create the start_labapp.sh script
26+
cat <<EOF >$SCRIPTDIR/start_app.sh
27+
#!/bin/bash
28+
29+
30+
if [ ! -d "$APPDIR/..git" ]; then
31+
git clone -b $BRANCH $REPO_URL $APPDIR
32+
else
33+
# Discard any local changes (including untracked files)
34+
cd $APPDIR
35+
git checkout $BRANCH
36+
git reset --hard origin/$BRANCH
37+
git clean -fdx
38+
# Pull the latest code from the specified branch
39+
git pull origin $BRANCH
40+
fi
41+
42+
43+
# Install required Python packages
44+
cd $APPDIR/labapp/app
45+
pip install -r requirements.txt
46+
47+
# Start the Gunicorn server
48+
gunicorn --workers 4 --bind 0.0.0.0:1337 app:app
49+
EOF
50+
51+
# Make the script executable
52+
chmod +x $SCRIPTDIR/start_app.sh
53+
54+
# Create systemd service file
55+
cat <<EOF >/etc/systemd/system/$SERVICE
56+
[Unit]
57+
Description=MCN Practical Lab App
58+
After=network.target
59+
60+
[Service]
61+
WorkingDirectory=$APPDIR
62+
ExecStart=/bin/bash $SCRIPTDIR/start_app.sh
63+
Restart=always
64+
65+
[Install]
66+
WantedBy=multi-user.target
67+
EOF
68+
69+
# Reload systemd, enable and start the service
70+
systemctl daemon-reload
71+
systemctl enable $SERVICE
72+
systemctl start $SERVICE
73+
74+
echo "$SERVICE has been installed and started as a systemd service."

0 commit comments

Comments
 (0)