{"id":13289033,"url":"https://github.com/pamelafox/flask-surveys-container-app","last_synced_at":"2025-07-29T03:07:56.518Z","repository":{"id":65615347,"uuid":"592499662","full_name":"pamelafox/flask-surveys-container-app","owner":"pamelafox","description":"An example Flask app for public surveys (no user auth) designed to be run inside Docker and deployed to Azure Container Apps with the Azure Developer CLI.","archived":false,"fork":false,"pushed_at":"2025-07-21T19:53:37.000Z","size":320,"stargazers_count":11,"open_issues_count":7,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-21T21:38:53.028Z","etag":null,"topics":["azd-templates","devcontainer","docker","docker-compose","flask","python"],"latest_commit_sha":null,"homepage":"","language":"Bicep","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/pamelafox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2023-01-23T21:24:24.000Z","updated_at":"2025-07-21T19:53:41.000Z","dependencies_parsed_at":"2023-02-16T23:01:15.758Z","dependency_job_id":"2555aee3-6744-4e1a-a662-4287fb11d1bd","html_url":"https://github.com/pamelafox/flask-surveys-container-app","commit_stats":{"total_commits":114,"total_committers":2,"mean_commits":57.0,"dds":0.4122807017543859,"last_synced_commit":"376e0f2cf902ca11564458110b141f72fb40c319"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/pamelafox/flask-surveys-container-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamelafox%2Fflask-surveys-container-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamelafox%2Fflask-surveys-container-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamelafox%2Fflask-surveys-container-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamelafox%2Fflask-surveys-container-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pamelafox","download_url":"https://codeload.github.com/pamelafox/flask-surveys-container-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamelafox%2Fflask-surveys-container-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267621597,"owners_count":24116900,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["azd-templates","devcontainer","docker","docker-compose","flask","python"],"created_at":"2024-07-29T17:00:18.203Z","updated_at":"2025-07-29T03:07:56.500Z","avatar_url":"https://github.com/pamelafox.png","language":"Bicep","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Open in GitHub Codespaces](https://img.shields.io/static/v1?style=for-the-badge\u0026label=GitHub+Codespaces\u0026message=Open\u0026color=brightgreen\u0026logo=github)](https://github.com/codespaces/new?hide_repo_select=true\u0026ref=main\u0026repo=pamelafox%2Fflask-surveys-container-app\u0026machine=standardLinux32gb\u0026devcontainer_path=.devcontainer%2Fdevcontainer.json\u0026location=WestUs2)\n[![Open in Remote - Containers](https://img.shields.io/static/v1?style=for-the-badge\u0026label=Remote%20-%20Containers\u0026message=Open\u0026color=blue\u0026logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com%2Fpamelafox%2Fflask-surveys-container-app)\n\n# Flask surveys container app\n\nThis repository includes a Flask surveys app that uses [SQLAlchemy](https://www.sqlalchemy.org/)\n(via [Flask-SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/)\nand [Flask-Migrate](https://flask-migrate.readthedocs.io/en/latest/index.html))\nto interact with a PostgreSQL database.\n\n![Screenshot of surveys app, showing a survey about ice cream with four options and percentage bars](readme_screenshot.png)\n\nThe app is organized using [Flask Blueprints](https://flask.palletsprojects.com/en/2.2.x/blueprints/),\ntested with [pytest](https://docs.pytest.org/en/7.2.x/),\nlinted with [ruff](https://github.com/charliermarsh/ruff), and formatted with [black](https://black.readthedocs.io/en/stable/).\nCode quality issues are all checked with both [pre-commit](https://pre-commit.com/) and Github actions.\n\nThe repository is designed for use with [Docker containers](https://www.docker.com/), both for local development and deployment, and includes infrastructure files for deployment to [Azure Container Apps](https://learn.microsoft.com/azure/container-apps/overview). 🐳\n\n## Opening the project\n\nThis project has [Dev Container support](https://code.visualstudio.com/docs/devcontainers/containers), so it will be be setup automatically if you open it in Github Codespaces or in local VS Code with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).\n\nIf you're not using one of those options for opening the project, then you'll need to:\n\n1. Create a [Python virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) and activate it.\n\n2. Install requirements:\n\n    ```shell\n    python3 -m pip install --user -r requirements-dev.txt\n    ```\n\n3. Install the pre-commit hooks:\n\n    ```shell\n    pre-commit install\n    ```\n\n## Local development with Docker\n\nSince this app depends on a database, there's a `docker-compose.yaml` file that creates two containers\n(one for the app, one for the DB) as well as a volume to store the database data.\n\n1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/). If you opened this inside Github Codespaces or a Dev Container in VS Code, installation is not needed. ⚠️ If you're on an Apple M1/M2, you won't be able to run `docker` commands inside a Dev Container; either use Codespaces or do not open the Dev Container.\n\n2. Create an `.env` file by copying `.env.example`.\n\n3. Start the services with this command:\n\n    ```shell\n    docker-compose up --build\n    ```\n\n4. Try creating a new survey and answering your newly created survey. 📋 🎉\n\n## Deployment\n\nThis repo is set up for deployment on [Azure Container Apps](https://learn.microsoft.com/azure/container-apps/overview) with a [PostGreSQL server](https://learn.microsoft.com/azure/postgresql/flexible-server/overview) using the `Dockerfile` and the configuration files in the `infra` folder.\n\n![Architecture diagram for Azure Container Apps, Azure Container Registry, and PostgreSQL Flexible Server](readme_architecture.png)\n\nSteps for deployment:\n\n1. Sign up for a [free Azure account](https://azure.microsoft.com/free/) and create an Azure Subscription.\n2. Install the [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd). (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)\n3. Login to Azure:\n\n    ```shell\n    azd auth login\n    ```\n\n4. Provision and deploy all the resources:\n\n    ```shell\n    azd up\n    ```\n\n    It will prompt you to provide an `azd` environment name (like \"flask-app\"), select a subscription from your Azure account, and select a location (like \"eastus\"). Then it will provision the resources in your account and deploy the latest code. If you get an error with deployment, changing the location can help, as there may be availability constraints for some of the resources.\n\n5. When `azd` has finished deploying, you'll see an endpoint URI in the command output. Visit that URI, and you should see the front page of the app! 🎉\n\n6. When you've made any changes to the app code, you can just run:\n\n    ```shell\n    azd deploy\n    ```\n\n### CI/CD pipeline\n\nThis project includes a Github workflow for deploying the resources to Azure\non every push to main. That workflow requires several Azure-related authentication secrets\nto be stored as Github action secrets. To set that up, run:\n\n```shell\nazd pipeline config\n```\n\n### Costs\n\nPricing varies per region and usage, so it isn't possible to predict exact costs for your usage.\nSome of the Azure resources used in this infrastructure are on usage-based pricing tiers,\nbut the Azure Database for PostgreSQL flexible server and Container Registry have fixed hourly costs.\n\nYou can try the [Azure pricing calculator](https://azure.com/e/3a9a0464f7a4431d82ee859b53ebe179) for the resources:\n\n- Azure Container App: Consumption tier with 0.5 CPU, 1GiB memory/storage. Pricing is based on resource allocation, and each month allows for a certain amount of free usage. [Pricing](https://azure.microsoft.com/pricing/details/container-apps/)\n- Azure Container Registry: Basic tier. [Pricing](https://azure.microsoft.com/pricing/details/container-registry/)\n- Azure Database for PostgreSQL flexible server - Burstable tier (B1ms). [Pricing](https://azure.microsoft.com/pricing/details/postgresql/flexible-server/)\n- Key Vault - Standard tier. Pricing based on number of operations, only a few are used on each deploy. [Pricing](https://azure.microsoft.com/pricing/details/key-vault/)\n- Log analytics: Pay-as-you-go tier. Costs based on data ingested. [Pricing](https://azure.microsoft.com/pricing/details/monitor/)\n\n⚠️ To avoid unnecessary costs, remember to take down your app if it's no longer in use,\neither by deleting the resource group in the Portal or running `azd down`.\n\n\n## Getting help\n\nIf you're working with this project and running into issues, please post in [Discussions](/discussions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamelafox%2Fflask-surveys-container-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpamelafox%2Fflask-surveys-container-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamelafox%2Fflask-surveys-container-app/lists"}