{"id":16372173,"url":"https://github.com/abhisheksr01/zero-2-hero-python-flask-microservice","last_synced_at":"2025-07-12T18:37:13.354Z","repository":{"id":37897472,"uuid":"349372870","full_name":"abhisheksr01/zero-2-hero-python-flask-microservice","owner":"abhisheksr01","description":"This repository contains a very basic flask get API \u0026 deploy it to the EKS flavour of Kubernetes using Concourse Pipeline.","archived":false,"fork":false,"pushed_at":"2025-03-31T02:58:56.000Z","size":2179,"stargazers_count":7,"open_issues_count":2,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T03:28:56.077Z","etag":null,"topics":["bdd","behave","concourse-pipeline","eks","flask","kubernetes","pytest","python","python-behave","python-microservices","python-unittest","tdd"],"latest_commit_sha":null,"homepage":"","language":"Python","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/abhisheksr01.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":"2021-03-19T09:47:01.000Z","updated_at":"2025-03-31T02:58:54.000Z","dependencies_parsed_at":"2024-02-26T03:29:44.251Z","dependency_job_id":"7edbaf43-31ee-4c0f-942f-e03c8f91073f","html_url":"https://github.com/abhisheksr01/zero-2-hero-python-flask-microservice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abhisheksr01/zero-2-hero-python-flask-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhisheksr01%2Fzero-2-hero-python-flask-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhisheksr01%2Fzero-2-hero-python-flask-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhisheksr01%2Fzero-2-hero-python-flask-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhisheksr01%2Fzero-2-hero-python-flask-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhisheksr01","download_url":"https://codeload.github.com/abhisheksr01/zero-2-hero-python-flask-microservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhisheksr01%2Fzero-2-hero-python-flask-microservice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265033716,"owners_count":23701084,"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":["bdd","behave","concourse-pipeline","eks","flask","kubernetes","pytest","python","python-behave","python-microservices","python-unittest","tdd"],"created_at":"2024-10-11T03:10:39.932Z","updated_at":"2025-07-12T18:37:13.314Z","avatar_url":"https://github.com/abhisheksr01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zero-2-hero-python-flask-microservice\n\n## Introduction\n\n**Instruction on how to use this repo is still a work in progress.**\n\nThis repository is developed to demonstrate how a typical business requirement transforms into software code by following the cloud-native practices.\n\nThe app exposes a get endpoint with a very simple logic as described below in Gherkins syntax:\n\n```\nFeature: Based on the current time the API will greet the invoker\n\nScenario: When user passes their name to the API\n    Given the user \"Abhishek\" wants to be greeted\n    When the user invokes the API\n    And Morning time is between \"4\" and \"12\"\n    And Afternoon time is between \"12\" and \"17\"\n    And Evening time is between \"17\" and \"20\"\n    And Night time is between \"20\" and \"4\"\n    Then the user should be greeted with either \"Hi Abhishek, Good Morning.\" or \"Hi Abhishek, Good Afternoon.\" or \"Hi Abhishek, Good Evening.\" or \"Hi Abhishek, Good Night.\"\n```\n\nThe codebase can be better visualized as below:\n\n![Visualization of the codebase](./diagram.svg)\n\n## Pre-requisite\n\n* Python 3.11 or higher\n* Poetry\n* Docker\n* FLY CLI (For the CI/CD hands-on)\n* Docker Hub Credentials (CI/CD pipeline requires it for pushing the image to docker hub)\n* AWS EKS Cluster \u0026 credentials(For deploying this application using the CI/CD pipeline)\n\nNote: If you running behind a corporate proxy you or the pipeline may not be able to pull some of the dependencies from the internet.\n\nGithub Action pipeline status for tests and dependency vulnerabilities: [![Execute unit and bdd tests](https://github.com/abhisheksr01/zero-2-hero-python-flask-microservice/actions/workflows/pipeline.yml/badge.svg)](https://github.com/abhisheksr01/zero-2-hero-python-flask-microservice/actions/workflows/pipeline.yml)\n## Local Execution\n\nFrom the root of this directory execute below commands:\n\n#### Activating Poetry shell env\n```\nmake activate\n\nor\n\npoetry shell\n```\n\n#### Installing dependencies required for running the app\n```\nmake install\n\nor\n\npoetry install\n```\n#### Start Application\n\n```\nmake start\n\nor\n\npython3 run.py\n```\n\nOnce the app has started you should be able to access the app Endpoint at http://127.0.0.1:5001/greetings/[YOUR_NAME]\n\n![](resources/app-start.png)\n\n---\n\nIf your system doesn't support make commands, look into the [Makefile here](./Makefile) \u0026 get the raw commands to execute the tasks.\n\n---\n\nYou can execute commands to execute operations like unit test, e2e test, vulnerability scanning etc.\n![](resources/make-code-instructions.png)\n\n## Local Docker Execution\n\nIf you wish to use docker for running the app locally the execute below commands:\n\nBuild docker image:\n```\ndocker build -t greetings-app .\n```\n\nRun docker image:\n```\ndocker run --rm -it -p 5001:5001 greetings-app\n```\n\nNow your app should be accessible at http://127.0.0.1:5001/greetings/[YOUR_NAME]\n\n## Local Concourse Pipeline\n[Concourse](https://concourse-ci.org/) is an open-source continuous thing-doer.\n\nBuilt on the simple mechanics of resources, tasks, and jobs, Concourse presents a general approach to automation that makes it great for CI/CD.\n\nLet us quickly spin a concourse pipeline locally and before proceeding make sure you have Docker installed.\n\nFrom the root of the project change the directory:\n```\ncd concourse-ci\n```\nExecute the below command to spin a local concourse tool:\n```\nmake spin-concourse\n```\nIf you use a macOS M1 the above command will not work, use this command for m1:\n```\nmake spin-concourse-m1\n```\nor if Make is not supported\n```\ncd local-concourse\n\ndocker compose up -d\n```\n\nAccess the local concourse using the URL http://127.0.0.1:8080/ and then download the FLY CLI utility from the concourse home page.\n\n---\n\u003e **_For Windows:_**\n\n- Execute the fly.exe as Administrator \u0026 then add \"C:\\Program Files\\concourse\\fly.exe\" to the PATH environment variable.\n- You will have to replace the \"/\" with \"\\\" appropriately and \".\" from the front of any path references.\n\n---\n\nUpdate the credentials in the [secrets/vars.yml](./concourse-ci/secrets/vars.yml)\n\nFrom concourse-ci directory execute the below command to configure the pipeline job.\n```\nmake set-pipeline\n```\nor if Make is not supported\n```\nfly -t main set-pipeline -p zero-2-hero-python-flask-microservice -c pipeline.yml -l ./secrets/vars.yml\n```\nIf you have fly installed and the make set-pipeline returns an error, make sure you \"allow\" it to run within Privacy and Security setting of your mac system setting.\n\nAuthenticate the pipeline by clicking the link highlighted in CLI with **USERNAME/PASSWORD as admin/admin**.\n\nThen approve the pipeline configuration by typing \"y\" and hit enter.\n\nYou might get an error related to the fly version is not sync, if so execute the command recommended in CLI to do so.\n\nBy default, all the pipelines in the concourse are paused, execute the below command to unpause the same.\n\n```\nfly -t main unpause-pipeline -p zero-2-hero-python-flask-microservice\n```\nThe pipeline can be accessed using the URL http://127.0.0.1:8080/teams/main/pipelines/zero-2-hero-python-flask-microservice\n\nYour pipeline should look something like this:\n![](resources/concourse-pipeline.png)\n\nAdditionally, you can perform below make commands concerning the concourse CI/CD pipeline.\n![](resources/make-pipeline-instructions.png)\n\nExecute the below command to destroy the pipeline:\n```\nmake destroy-pipeline\n```\nor if Make is not supported\n```\nfly -t main destroy-pipeline -p zero-2-hero-python-flask-microservice\n```\n\nExecute the below command to tear off the local concourse:\n```\nmake destroy-concourse\n```\nor if Make is not supported\n```\ncd local-concourse\n\ndocker compose down\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhisheksr01%2Fzero-2-hero-python-flask-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhisheksr01%2Fzero-2-hero-python-flask-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhisheksr01%2Fzero-2-hero-python-flask-microservice/lists"}