Skip to content

Commit bc92d23

Browse files
committed
Merge branch 'master' of https://github.com/benc-uk/python-demoapp into master
2 parents f1169e3 + 7893512 commit bc92d23

13 files changed

Lines changed: 131 additions & 56 deletions

File tree

.github/workflows/cd-release-aks.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ on:
1616
# Note. Required secrets: CR_PAT & AZURE_CREDENTIALS
1717

1818
env:
19-
IMAGE_REG: ghcr.io
20-
IMAGE_REPO: benc-uk/python-demoapp
2119
AKS_NAME: benc
2220
AKS_RES_GROUP: aks
2321
HELM_RELEASE: python
@@ -57,12 +55,12 @@ jobs:
5755
5856
- name: "Helm release"
5957
run: |
60-
helm upgrade ${{ env.HELM_RELEASE }} \
61-
https://code.benco.io/helm-charts/webapp-1.2.0.tgz \
58+
helm repo add benc-uk https://benc-uk.github.io/helm-charts
59+
helm upgrade ${{ env.HELM_RELEASE }} benc-uk/webapp \
6260
--install \
6361
--namespace ${{ env.HELM_NAMESPACE }} \
6462
--values ./kubernetes/aks-live.yaml \
65-
--set image.tag=${{ github.event.inputs.IMAGE_TAG }},image.repository=${{ env.IMAGE_REG }}/${{ env.IMAGE_REPO }},env.AAD_REDIRECT_URL_BASE=https://${{ env.INGRESS_DNS_HOST }},ingress.host=${{ env.INGRESS_DNS_HOST }}
63+
--set image.tag=${{ github.event.inputs.IMAGE_TAG }},ingress.host=${{ env.INGRESS_DNS_HOST }}
6664
6765
- name: "End deployment - failure"
6866
if: ${{ failure() }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM python:3.8-buster
2-
LABEL Name="Python Flask Demo App" Version=1.3.0
2+
LABEL Name="Python Flask Demo App" Version=1.4.0
33

44
WORKDIR /demoapp
55
COPY requirements.txt .

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ A working set of CI and CD release GitHub Actions workflows are provided `.githu
3838

3939
If you want to deploy to an Azure Web App as a container (aka Linux Web App), a Bicep template is provided in the [infrastructure as code](infra/) directory
4040

41+
You can also very quickly deploy to Azure App Service directly with the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/) and `az webapp up`. Note. `<app-name>` must be globally unique. Change the sku to a larger size, e.g. `P1V2` for a much faster deployment
42+
```
43+
az webapp up --sku F1 --name <app-name>
44+
```
4145

4246
## Running in Azure App Service (Windows)
4347
Just don't, it's awful

app/static/css/main.css

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
body {
2-
padding-top: 70px;
3-
}
1+
42
h1 {
5-
padding-top: 0px !important;
6-
margin-top: -20px !important;
3+
padding-top: 1rem;
74
}
8-
.navbar, .navbar-brand {
5+
6+
.logotext {
97
font-size: 1.5em !important;
108
}
11-
.btn {
12-
font-size: 1.2em !important;
9+
.jumbotron {
10+
padding: 2rem !important;
1311
}
1412
.gauges {
1513
width: 100%;
1614
height: 25vw;
1715
margin: 0 auto;
1816
}
17+
1918
/* Sortable tables */
2019
table.sortable th {
2120
background-color: #eeeeee;
@@ -24,9 +23,20 @@ table.sortable th {
2423
cursor: pointer;
2524
padding: 10px;
2625
}
26+
2727
td {
2828
padding-right: 50px !important;
2929
font-size: 18px;
3030
border-bottom: 1px solid #dddddd;
3131
cursor: default;
32+
}
33+
34+
.icon {
35+
width: 40px;
36+
}
37+
38+
.dimmed-box {
39+
background-color: rgba(0,0,0,0.2);
40+
padding: 1rem;
41+
border-radius: 0.3rem;
3242
}

app/static/img/docker-whale.svg

Lines changed: 1 addition & 0 deletions
Loading

app/static/img/github-2.svg

Lines changed: 1 addition & 0 deletions
Loading

app/static/img/python.svg

Lines changed: 1 addition & 0 deletions
Loading

app/templates/base.html

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,48 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<link href="/static/css/main.css" rel="stylesheet" />
88
<link href="/static/img/favicon.ico" rel="icon" />
9-
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/united/bootstrap.min.css" rel="stylesheet">
9+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootswatch/4.5.2/united/bootstrap.min.css"
10+
integrity="sha384-JW3PJkbqVWtBhuV/gsuyVVt3m/ecRJjwXC3gCXlTzZZV+zIEEl6AnryAriT7GWYm" crossorigin="anonymous">
1011
</head>
1112

1213
<body>
14+
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
15+
<a class="navbar-brand logotext" href="/">
16+
<img src="static/img/python.svg" width="37" height="40">
17+
&nbsp; Python Demo
18+
</a>
1319

14-
<nav class="navbar navbar-default navbar-fixed-top">
15-
<div class="container-fluid">
16-
<div class="navbar-header">
17-
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
18-
<span class="sr-only">Toggle navigation</span>
19-
<span class="icon-bar"></span>
20-
<span class="icon-bar"></span>
21-
<span class="icon-bar"></span>
22-
</button>
23-
<a class="navbar-brand" href="/">Python Demo App</a>
24-
</div>
25-
26-
<div class="navbar-collapse collapse">
27-
<ul class="nav navbar-nav">
28-
<li><a href="/info"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>&nbsp; Sys Info</a>
29-
</li>
30-
<li><a href="/monitor"><span class="glyphicon glyphicon-dashboard" aria-hidden="true"></span>&nbsp; Realtime
31-
Monitor</a></li>
32-
</ul>
33-
</div>
20+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
21+
aria-controls="navbarNav" aria-expanded="true" aria-label="Toggle navigation">
22+
<span class="navbar-toggler-icon"></span>
23+
</button>
24+
25+
<div class="collapse navbar-collapse" id="navbarNav">
26+
<ul class="navbar-nav mr-auto">
27+
<li class="nav-item active">
28+
<a class="btn btn-success btn-lg" href="/info">🧾 Info</a>
29+
</li>
30+
&nbsp;
31+
<li class="nav-item active">
32+
<a class="btn btn-success btn-lg" href="/monitor">🚦 Monitor</a>
33+
</li>
34+
</ul>
3435
</div>
3536
</nav>
3637

37-
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
38-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
39-
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
38+
39+
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
40+
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
41+
42+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
43+
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
44+
crossorigin="anonymous"></script>
45+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
46+
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
4047
crossorigin="anonymous"></script>
4148

4249
<div class="container body-content">{% block content %}{% endblock %}</div>
43-
<span style="float:right">v1.3.0 [Ben Coleman, 2018-2020] &nbsp;&nbsp;&nbsp;</span>
50+
<span style="float:right">v1.4.0 [Ben Coleman, 2018-2020] &nbsp;&nbsp;&nbsp;</span>
4451
</body>
4552

4653
</html>

app/templates/index.html

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
11
{% extends "base.html" %}
22

33
{% block content %}
4-
4+
<br>
55
<div class="jumbotron">
6-
<h1><img src="/static/img/flask.png" height="80px"/> Python Flask Demo App</h1>
7-
<p>
8-
<br/>
9-
This is a simple Python Flask demo web app, to be used with Azure, Docker and other demos &amp; lab exercises. <br/>
10-
The <a href='https://github.com/benc-uk/python-demoapp'>source is on GitHub</a>, and pre-built Docker images are available <a href='https://hub.docker.com/r/bencuk/python-demoapp'></a>on Dockerhub</a>
11-
</p>
12-
<p>
13-
<a class="btn btn-success" href="/monitor">Realtime Monitor</a>
14-
</p>
6+
<h1><img src="/static/img/flask.png" height="80px" /> Python & Flask Demo App</h1>
7+
8+
<div class="lead">
9+
This is a simple web application written in Python and using Flask. It has been designed with cloud demos &amp;
10+
containers in mind. Demonstrating capabilities such as auto scaling, deployment to Azure or Kubernetes, or anytime
11+
you want something quick and lightweight to run & deploy.
12+
</div>
13+
<br>
14+
15+
<div class="dimmed-box">
16+
<p>
17+
<img src="static/img/github-2.svg" class="icon">
18+
<a href="https://github.com/benc-uk/python-demoapp" class="btn btn-info btn px-4">
19+
GitHub Project
20+
</a>
21+
22+
&nbsp;&nbsp;&nbsp;
23+
<img src="static/img/docker-whale.svg" class="icon">
24+
<a href="https://github.com/users/benc-uk/packages/container/package/python-demoapp" class="btn btn-info btn">
25+
Docker Images
26+
</a>
27+
</p>
28+
<hr>
29+
<p>
30+
<img src="static/img/python.svg" class="icon">
31+
<a class="btn btn-info btn" href="https://azure.microsoft.com/en-gb/develop/python/">
32+
Get started with Azure &amp; Python
33+
</a>
34+
</p>
35+
36+
<br>
37+
<p>Microsoft ❤ Open Source</p>
38+
</div>
39+
1540
</div>
16-
{% endblock %}
41+
{% endblock %}

app/templates/info.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
{% block content %}
44

5-
<div class="jumbotron">
5+
<div class="">
6+
<h1>🛠 System Information</h1>
67
<table class="table table-striped table-hover" style="font-size:1.5em">
78
<tbody>
89
<tr>

0 commit comments

Comments
 (0)