{"id":37662758,"url":"https://github.com/anomaly/lab-python-mock-server","last_synced_at":"2026-01-16T11:52:07.697Z","repository":{"id":40391335,"uuid":"507457296","full_name":"anomaly/lab-python-mock-server","owner":"anomaly","description":"A mock web server in Python for Anomaly labs used to demonstrate that our stack is functional and a web app has access to all the details it needs to function","archived":false,"fork":false,"pushed_at":"2023-07-19T02:42:16.000Z","size":76,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T08:36:18.194Z","etag":null,"topics":["docker","learning","python","showcase","testing"],"latest_commit_sha":null,"homepage":"https://github.com/anomaly/lab-python-mock-server/pkgs/container/lab-python-mock-server","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anomaly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-26T02:10:54.000Z","updated_at":"2023-06-20T23:37:46.000Z","dependencies_parsed_at":"2025-09-09T07:33:22.080Z","dependency_job_id":"38f3668b-385b-4810-a6d9-86bc4b6f2cac","html_url":"https://github.com/anomaly/lab-python-mock-server","commit_stats":null,"previous_names":[],"tags_count":4,"template":true,"template_full_name":null,"purl":"pkg:github/anomaly/lab-python-mock-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anomaly%2Flab-python-mock-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anomaly%2Flab-python-mock-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anomaly%2Flab-python-mock-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anomaly%2Flab-python-mock-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anomaly","download_url":"https://codeload.github.com/anomaly/lab-python-mock-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anomaly%2Flab-python-mock-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["docker","learning","python","showcase","testing"],"created_at":"2026-01-16T11:52:07.610Z","updated_at":"2026-01-16T11:52:07.672Z","avatar_url":"https://github.com/anomaly.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lab - Mock Python server\n![Docker Pulls](https://img.shields.io/docker/pulls/anomalyhq/lab-python-mock-server)\n\nAnomaly uses Python for all of their server side requirements. This lab providers a containerized version of the Python server that mocks the presence of a server and simply outputs a static page with a list of key value pairs that it obtains from the container's environment.\n\nThe purpose of this application is to test the fact that the container has access to the secrets passed into it via the Kubernetes secrets mechanism. This application serves as the test Python server for Anomaly's [Terraform lab for Linode](https://github.com/anomaly/lab-tf-linode).\n\n\u003e This application should never be used in production.\n\n## Configuring the environment variables\n\nThe application serves a single `root` entry point and can be configured in `src/lab_mock/__init__.py` which has a Python dictionary that resembles\n\n```python\n_ENV_LIST = [\n    {\n        \"name\": \"PostgreSQL\",\n        \"description\": \"Postgres database credentials\",\n        \"vars\": [\n            \"POSTGRES_USER\",\n            \"POSTGRES_PASSWORD\",\n            \"POSTGRES_HOST\",\n            \"POSTGRES_PORT\",\n            \"POSTGRES_DB\",\n        ]\n    },\n]\n```\n\nEach object of the array is contains:\n- `name`: The name of the environment variable group\n- `description`: A description of the environment variable group\n- `vars`: An array of environment variable names that are part of the group\n\nThe entry point will fetch the value of each environment variable and output it as a key value pair, outputting `None` if a value is not found.\n\n\u003e Please ensure this list is kept in sync with the Terraform lab, unless of course you are using it for other purposes.\n\n## Architecture\n\nThe application is built using the [Flask](https://flask.palletsprojects.com/en/1.1.x/) framework and uses Jinja2 for templating.\n\nIt uses `asgiref` to create an `ASGI` wrapper for the Flask application.\n\nTo make things look nice, we use [Tailwind CSS](https://tailwindcss.com/), delivered via their [CDN](https://tailwindcss.com/docs/installation/play-cdn).\n\n## Resources\n\n- [Deploying FastAPI apps with HTTPS powered by Traefik](https://traefik.io/resources/traefik-fastapi-kuberrnetes-ai-ml/) by Sebastián Ramírez\n- [How to Inspect a Docker Image’s Content Without Starting a Container](https://www.howtogeek.com/devops/how-to-inspect-a-docker-images-content-without-starting-a-container/) by James Walker\n- [Poetry sub packages](https://github.com/python-poetry/poetry/issues/2270), an open issue to support sub packages in Poetry, which will be handy in splitting up our code base further.\n- [Using find namespaces or find namespace package](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#using-find-namespace-or-find-namespace-packages)\n\n## License\nContents of this repository are licensed under the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanomaly%2Flab-python-mock-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanomaly%2Flab-python-mock-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanomaly%2Flab-python-mock-server/lists"}