{"id":13708154,"url":"https://github.com/benc-uk/python-demoapp","last_synced_at":"2025-05-06T07:31:56.576Z","repository":{"id":37979520,"uuid":"224826253","full_name":"benc-uk/python-demoapp","owner":"benc-uk","description":"Simple Python Flask web application designed for running in containers for demos","archived":true,"fork":false,"pushed_at":"2023-10-26T12:21:24.000Z","size":16853,"stargazers_count":140,"open_issues_count":6,"forks_count":1101,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-13T17:45:51.832Z","etag":null,"topics":["docker","flask","kubernetes","python"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benc-uk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-29T09:55:53.000Z","updated_at":"2024-10-29T07:17:42.000Z","dependencies_parsed_at":"2024-11-13T17:44:47.307Z","dependency_job_id":null,"html_url":"https://github.com/benc-uk/python-demoapp","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Fpython-demoapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Fpython-demoapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Fpython-demoapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Fpython-demoapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benc-uk","download_url":"https://codeload.github.com/benc-uk/python-demoapp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252640102,"owners_count":21780871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","flask","kubernetes","python"],"created_at":"2024-08-02T22:01:57.647Z","updated_at":"2025-05-06T07:31:56.570Z","avatar_url":"https://github.com/benc-uk.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Python Flask - Demo Web Application\r\n\r\nThis is a simple Python Flask web application. The app provides system information and a realtime monitoring screen with dials showing CPU, memory, IO and process information.\r\n\r\nThe app has been designed with cloud native demos \u0026 containers in mind, in order to provide a real working application for deployment, something more than \"hello-world\" but with the minimum of pre-reqs. It is not intended as a complete example of a fully functioning architecture or complex software design.\r\n\r\nTypical uses would be deployment to Kubernetes, demos of Docker, CI/CD (build pipelines are provided), deployment to cloud (Azure) monitoring, auto-scaling\r\n\r\n## Screenshot\r\n\r\n![screen](https://user-images.githubusercontent.com/14982936/30533171-db17fccc-9c4f-11e7-8862-eb8c148fedea.png)\r\n\r\n# Status\r\n\r\n![](https://img.shields.io/github/last-commit/benc-uk/python-demoapp) ![](https://img.shields.io/github/release-date/benc-uk/python-demoapp) ![](https://img.shields.io/github/v/release/benc-uk/python-demoapp) ![](https://img.shields.io/github/commit-activity/y/benc-uk/python-demoapp)\r\n\r\nLive instances:\r\n\r\n[![](https://img.shields.io/website?label=Hosted%3A%20Azure%20App%20Service\u0026up_message=online\u0026url=https%3A%2F%2Fpython-demoapp.azurewebsites.net%2F)](https://python-demoapp.azurewebsites.net/)  \r\n[![](https://img.shields.io/website?label=Hosted%3A%20Kubernetes\u0026up_message=online\u0026url=https%3A%2F%2Fpython-demoapp.kube.benco.io%2F)](https://python-demoapp.kube.benco.io/)\r\n\r\n## Building \u0026 Running Locally\r\n\r\n### Pre-reqs\r\n\r\n- Be using Linux, WSL or MacOS, with bash, make etc\r\n- [Python 3.8+](https://www.python.org/downloads/) - for running locally, linting, running tests etc\r\n- [Docker](https://docs.docker.com/get-docker/) - for running as a container, or image build and push\r\n- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux) - for deployment to Azure\r\n\r\nClone the project to any directory where you do development work\r\n\r\n```\r\ngit clone https://github.com/benc-uk/python-demoapp.git\r\n```\r\n\r\n### Makefile\r\n\r\nA standard GNU Make file is provided to help with running and building locally.\r\n\r\n```text\r\nhelp                 💬 This help message\r\nlint                 🔎 Lint \u0026 format, will not fix but sets exit code on error\r\nlint-fix             📜 Lint \u0026 format, will try to fix errors and modify code\r\nimage                🔨 Build container image from Dockerfile\r\npush                 📤 Push container image to registry\r\nrun                  🏃 Run the server locally using Python \u0026 Flask\r\ndeploy               🚀 Deploy to Azure Web App\r\nundeploy             💀 Remove from Azure\r\ntest                 🎯 Unit tests for Flask app\r\ntest-report          🎯 Unit tests for Flask app (with report output)\r\ntest-api             🚦 Run integration API tests, server must be running\r\nclean                🧹 Clean up project\r\n```\r\n\r\nMake file variables and default values, pass these in when calling `make`, e.g. `make image IMAGE_REPO=blah/foo`\r\n\r\n| Makefile Variable | Default                |\r\n| ----------------- | ---------------------- |\r\n| IMAGE_REG         | ghcr\u003cspan\u003e.\u003c/span\u003eio   |\r\n| IMAGE_REPO        | benc-uk/python-demoapp |\r\n| IMAGE_TAG         | latest                 |\r\n| AZURE_RES_GROUP   | temp-demoapps          |\r\n| AZURE_REGION      | uksouth                |\r\n| AZURE_SITE_NAME   | pythonapp-{git-sha}    |\r\n\r\nThe app runs under Flask and listens on port 5000 by default, this can be changed with the `PORT` environmental variable.\r\n\r\n# Containers\r\n\r\nPublic container image is [available on GitHub Container Registry](https://github.com/users/benc-uk/packages/container/package/python-demoapp)\r\n\r\nRun in a container with:\r\n\r\n```bash\r\ndocker run --rm -it -p 5000:5000 ghcr.io/benc-uk/python-demoapp:latest\r\n```\r\n\r\nShould you want to build your own container, use `make image` and the above variables to customise the name \u0026 tag.\r\n\r\n## Kubernetes\r\n\r\nThe app can easily be deployed to Kubernetes using Helm, see [deploy/kubernetes/readme.md](deploy/kubernetes/readme.md) for details\r\n\r\n# GitHub Actions CI/CD\r\n\r\nA working set of CI and CD release GitHub Actions workflows are provided `.github/workflows/`, automated builds are run in GitHub hosted runners\r\n\r\n### [GitHub Actions](https://github.com/benc-uk/python-demoapp/actions)\r\n\r\n[![](https://img.shields.io/github/workflow/status/benc-uk/python-demoapp/CI%20Build%20App)](https://github.com/benc-uk/python-demoapp/actions?query=workflow%3A%22CI+Build+App%22)\r\n\r\n[![](https://img.shields.io/github/workflow/status/benc-uk/python-demoapp/CD%20Release%20-%20AKS?label=release-kubernetes)](https://github.com/benc-uk/python-demoapp/actions?query=workflow%3A%22CD+Release+-+AKS%22)\r\n\r\n[![](https://img.shields.io/github/workflow/status/benc-uk/python-demoapp/CD%20Release%20-%20Webapp?label=release-azure)](https://github.com/benc-uk/python-demoapp/actions?query=workflow%3A%22CD+Release+-+Webapp%22)\r\n\r\n[![](https://img.shields.io/github/last-commit/benc-uk/python-demoapp)](https://github.com/benc-uk/python-demoapp/commits/master)\r\n\r\n## Running in Azure App Service (Linux)\r\n\r\nIf you want to deploy to an Azure Web App as a container (aka Linux Web App), a Bicep template is provided in the [deploy](deploy/) directory\r\n\r\nFor a super quick deployment, use `make deploy` which will deploy to a resource group, temp-demoapps and use the git ref to create a unique site name\r\n\r\n```bash\r\nmake deploy\r\n```\r\n\r\n## Running in Azure App Service (Windows)\r\n\r\nJust don't, it's awful\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenc-uk%2Fpython-demoapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenc-uk%2Fpython-demoapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenc-uk%2Fpython-demoapp/lists"}