{"id":19816994,"url":"https://github.com/geoadmin/template-service-flask","last_synced_at":"2026-06-13T15:31:26.778Z","repository":{"id":44795708,"uuid":"277840508","full_name":"geoadmin/template-service-flask","owner":"geoadmin","description":"Basic template for almost all Flask services developed by the geoadmin team.","archived":false,"fork":false,"pushed_at":"2023-10-25T19:35:20.000Z","size":223,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-01-11T08:08:32.143Z","etag":null,"topics":["managed-by-tf"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geoadmin.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}},"created_at":"2020-07-07T14:34:14.000Z","updated_at":"2024-06-26T11:35:57.000Z","dependencies_parsed_at":"2024-11-12T10:11:36.255Z","dependency_job_id":"d478d558-0671-4d12-9588-e050f84de53f","html_url":"https://github.com/geoadmin/template-service-flask","commit_stats":null,"previous_names":[],"tags_count":30,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoadmin%2Ftemplate-service-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoadmin%2Ftemplate-service-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoadmin%2Ftemplate-service-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geoadmin%2Ftemplate-service-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geoadmin","download_url":"https://codeload.github.com/geoadmin/template-service-flask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241170258,"owners_count":19921572,"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":["managed-by-tf"],"created_at":"2024-11-12T10:11:23.966Z","updated_at":"2026-06-13T15:31:26.773Z","avatar_url":"https://github.com/geoadmin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# service-name\n\n| Branch | Status |\n|--------|-----------|\n| develop | ![Build Status](\u003ccodebuild-badge\u003e) |\n| master | ![Build Status](\u003ccodebuild-badge\u003e) |\n\n## Table of content\n\n- [Table of content](#table-of-content)\n- [Description](#description)\n- [Versioning](#versioning)\n- [Local Development](#local-development)\n  - [Make Dependencies](#make-dependencies)\n  - [Setting up to work](#setting-up-to-work)\n  - [Linting and formatting your work](#linting-and-formatting-your-work)\n  - [Test your work](#test-your-work)\n  - [Updating Packages](#updating-packages)\n- [Docker](#docker)\n- [Deployment](#deployment)\n  - [Deployment configuration](#deployment-configuration)\n\n## Description\n\nA simple description of the service should go here\nA detailed descriptions of the endpoints can be found in the [OpenAPI Spec](openapi.yaml).\n\n## Versioning\n\nThis service uses [SemVer](https://semver.org/) as versioning scheme. The versioning is automatically handled by `.github/workflows/main.yml` file.\n\nSee also [Git Flow - Versioning](https://github.com/geoadmin/doc-guidelines/blob/master/GIT_FLOW.md#versioning) for more information on the versioning guidelines.\n\n## Local Development\n\n### Make Dependencies\n\nThe **Make** targets assume you have **python3.13**, **pipenv**, **bash**, **curl**, **tar**, **docker** and **docker-compose** installed.\n\n### Setting up to work\n\nFirst, you'll need to clone the repo\n\n```bash\ngit clone git@github.com:geoadmin/service-name\n```\n\nThen, you can run the setup target to ensure you have everything needed to develop, test and serve locally\n\n```bash\nmake setup\n```\n\nThat's it, you're ready to work.\n\n### Linting and formatting your work\n\nIn order to have a consistent code style the code should be formatted using `yapf`. Also to avoid syntax errors and non\npythonic idioms code, the project uses the `pylint` linter. Both formatting and linter can be manually run using the\nfollowing command:\n\n```bash\nmake format-lint\n```\n\n**Formatting and linting should be at best integrated inside the IDE, for this look at\n[Integrate yapf and pylint into IDE](https://github.com/geoadmin/doc-guidelines/blob/master/PYTHON.md#yapf-and-pylint-ide-integration)**\n\n### Test your work\n\nTesting if what you developed work is made simple. You have four targets at your disposal. **test, serve, gunicornserve, dockerrun**\n\n```bash\nmake test\n```\n\nThis command run the integration and unit tests.\n\n```bash\nmake serve\n```\n\nThis will serve the application through Flask without any wsgi in front.\n\n```bash\nmake gunicornserve\n```\n\nThis will serve the application with the Gunicorn layer in front of the application\n\n```bash\nmake dockerrun\n```\n\nThis will serve the application with the wsgi server, inside a container.\n\n### Updating Packages\n\nAll packages used in production are pinned to a major version. Automatically updating these packages\nwill use the latest minor (or patch) version available. Packages used for development, on the other\nhand, are not pinned unless they need to be used with a specific version of a production package\n(for example, boto3-stubs for boto3).\n\nTo update the packages to the latest minor/compatible versions, run:\n\n```bash\npipenv update --dev\n```\n\nTo see what major/incompatible releases would be available, run:\n\n```bash\npipenv update --dev --outdated\n```\n\nTo update packages to a new major release, run:\n\n```bash\npipenv install logging-utilities~=5.0\n```\n\n## Docker\n\nThe service is encapsulated in a Docker image. Images are pushed on the `swisstopo-bgdi-builder` account of [AWS ECR](https://eu-central-1.console.aws.amazon.com/ecr/repositories?region=eu-central-1) registry. From each github PR that is merged into develop branch, one Docker image is built and pushed with the following tags:\n\n- `develop.latest`\n- `CURRENT_VERSION-beta.INCREMENTAL_NUMBER`\n\nFrom each github PR that is merged into master, one Docker image is built an pushed with the following tag:\n\n- `VERSION`\n\nEach image contains the following metadata:\n\n- author\n- git.branch\n- git.hash\n- git.dirty\n- version\n\nThese metadata can be seen directly on the dockerhub registry in the image layers or can be read with the following command\n\n```bash\n# NOTE: jq is only used for pretty printing the json output,\n# you can install it with `apt install jq` or simply enter the command without it\ndocker image inspect --format='{{json .Config.Labels}}' 974517877189.dkr.ecr.eu-central-1.amazonaws.com/service-name:develop.latest | jq\n```\n\nYou can also check these metadata on a running container as follows\n\n```bash\ndocker ps --format=\"table {{.ID}}\\t{{.Image}}\\t{{.Labels}}\"\n```\n\n## Deployment\n\n### Deployment configuration\n\nThe service is configured by Environment Variable:\n\n| Env         | Default               | Description                |\n| ----------- | --------------------- | -------------------------- |\n| LOGGING_CFG | logging-cfg-local.yml | Logging configuration file |\n| FORWARED_ALLOW_IPS | `*` | Sets the gunicorn `forwarded_allow_ips` (see https://docs.gunicorn.org/en/stable/settings.html#forwarded-allow-ips). This is required in order to `secure_scheme_headers` to works. |\n| FORWARDED_PROTO_HEADER_NAME | `X-Forwarded-Proto` | Sets gunicorn `secure_scheme_headers` parameter to `{FORWARDED_PROTO_HEADER_NAME: 'https'}`, see https://docs.gunicorn.org/en/stable/settings.html#secure-scheme-headers. |\n| SCRIPT_NAME | `''` | If the service is behind a reverse proxy and not served at the root, the route prefix must be set in `SCRIPT_NAME`. |\n| WSGI_WORKERS | `2` | WSGI service number of workers. 0 or negative value means that the number of worker are computed from the number of cpu. |\n| WSGI_TIMEOUT | `30`| WSGI timeout. |\n| GUNICORN_KEEPALIVE | `2` | The [`keepalive`](https://docs.gunicorn.org/en/stable/settings.html#keepalive) setting passed to gunicorn. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoadmin%2Ftemplate-service-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeoadmin%2Ftemplate-service-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoadmin%2Ftemplate-service-flask/lists"}