{"id":16143196,"url":"https://github.com/johnbedeir/challenge-johnbedeir","last_synced_at":"2026-03-18T18:04:53.550Z","repository":{"id":154168030,"uuid":"631627381","full_name":"johnbedeir/challenge-johnbedeir","owner":"johnbedeir","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-11T21:31:39.000Z","size":49,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T19:27:57.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbedeir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-23T16:09:35.000Z","updated_at":"2024-01-12T16:27:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"baf8dfad-9b1a-4e33-b6d7-5dafc1540161","html_url":"https://github.com/johnbedeir/challenge-johnbedeir","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/johnbedeir/challenge-johnbedeir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fchallenge-johnbedeir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fchallenge-johnbedeir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fchallenge-johnbedeir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fchallenge-johnbedeir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbedeir","download_url":"https://codeload.github.com/johnbedeir/challenge-johnbedeir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fchallenge-johnbedeir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28549513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T19:22:41.102Z","status":"ssl_error","status_checked_at":"2026-01-18T19:22:26.310Z","response_time":98,"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":[],"created_at":"2024-10-10T00:08:51.382Z","updated_at":"2026-01-18T19:36:28.859Z","avatar_url":"https://github.com/johnbedeir.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Challenge-JohnBedeir\n\n**Description:** This project is built with Terraform that deploys a simple Python web page application using Flask and connects to a MySQL database where you can add data into the database and it appears on the webpage. The application is deployed on a scalable EKS cluster with minimum one node and maximum three nodes, along with other resources like ECR, S3 bucket, MySQL database, and nginx-ingress.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Deployment](#deployment)\n- [GitOps](#gitops)\n- [Another Approach](#another-approach)\n- [Built With](#built-with)\n- [The Reasons for Technology Stack Selection](#the-reasons-for-technology-stack-selection)\n\n## Getting Started\n\nTo get started with this project, you'll need to set up the required resources and configure your environment.\n\n### Prerequisites\n\nMake sure you have the following installed:\n\n- AWS CLI\n- Terraform\n- Docker\n- kubectl\n\nYou'll also need an AWS account and appropriate credentials.\n\n### Installation\n\nTo run this application locally, run the following command:\n\n```\ndocker-compose up --build\n```\n\nThis will build the existing Dockerfile, start the application and make it available on http://localhost:5000 and run MySQL database on PORT:3306.\n\n### Usage\n\nTo use the application, you can connect to the database using any application, personally I am using [Beekeeper Studio](https://www.beekeeperstudio.io/), use the following QUERY:\n\n```\nCREATE DATABASE IF NOT EXISTS myapp_db;\nUSE myapp_db;\n\nCREATE TABLE IF NOT EXISTS items (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(255) NOT NULL\n);\n\nINSERT INTO items (name) VALUES ('Python');\nINSERT INTO items (name) VALUES ('GoLang');\nINSERT INTO items (name) VALUES ('PHP');\n```\n\nThis will create a Database, Table and Insert the data that will be viewed by the application.\n\n## Deployment\n\n#### Add the following in your GitHub Secrets:\n\n- AWS_ACCESS_KEY_ID\n- AWS_SECRET_ACCESS_KEY\n\n`NOTE: Make sure you disable the` **backend.tf** `while you run the first deployment`\n\n### 1. Create the ECR:\n\n```\ncd terraform\nterraform -target=aws_ecr_repository.ecr_repo -auto-approve\n```\n\n### 2. Run the CI Workflow:\n\n`NOTE: To Run this command make sure you create a github access token and add it in a file that will be ignored by git also update the variables in the script`\n\n```\ncurl -X POST https://api.github.com/repos/$username/$reponame/actions/workflows/$workflow_id/dispatches \\\n-H \"Accept: application/vnd.github.v3+json\" \\\n-H \"Authorization: Bearer $github_token\" \\\n-d '{\"ref\": \"$branch\", \"inputs\": {}}'\n```\n\n### 3. Create EKS and Deploy the App:\n\n```\ncd terraform\nterraform apply -auto-approve\n```\n\nThis will create an EKS cluster, an S3 bucket to store the Terraform state file, Deploy the Application, MySQL database, and an nginx-ingress controller with the following domain:\n\n```\ncomforte.johnydev.com\n```\n\n### 4. Cluster Info:\n\nUpdate your **Kube Config**\n\n```\naws eks update-kubeconfig --region $region --name $cluster_name\n```\n\nReveal the **Ingress URL**\n\n```\nkubectl get svc nginx-ingress-ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\n```\n\nThis will display the hostname of the nginx-ingress controller, where you can access your application with your domain.\n\n`NOTE: You will need to add this URL in CNAME record for your domain`\n\n## GitOps\n\n### Using GitHub Actions Workflow\n\nFinally, to be able to run the CD Workflow, you need to do the following:\n\n`NOTE: Make sure the **backend.tf** is not commented`\n\n```\nterraform init\n```\n\nWhen you do that you will be asked to switch your **tfstate** file from **local** state to the **s3**\n\nNow you can run the **cd.yml** which will fetch the **tfstate** from the **s3**\n\n`NOTE: The CD workflow can be triggered manually, on push to the main branch or on a new release`\n\n### Another option by using ArgoCD:\n\n`This option is working but it is disabled since we are using GitHub Actions for CD`\n\nYou can check the code in **argo.tf** which will deploy ArgoCD\n\n## Another Approach:\n\nAnother and more easier approach is to deploy the Application, Database and Ingress using Kubernetes manifest files, which already exists in this project but disabled since we run everything using Terraform.\n\nIn that case we would run `terraform apply` then run the `CI-Workflow` that will build and push the Docker Image to the `ECR` then run the `CD-Workflow` after adjusting it to run `kubectl` commands instead of `terraform` that will deploy the application using the pushed Docker `Image`\n\n## Built With\n\n- Flask - Python web framework\n- MySQL - relational database management system\n- Terraform - infrastructure as code tool\n- AWS - cloud computing platform\n- GitHub Actions - continuous integration and delivery platform\n\n## The Reasons for Technology Stack Selection\n\nBeside that I have the most experience in those tools\n\n- Flask: For its simplicity and Faster development for smaller projects, the alternative approach is by using Django\n- MySQL: It is one of the most popular open-source databases, which ensures a large and active community, another approach I could use MongoDB, I have similar experience in\n- Terraform: as the IaC tool for its ability to manage and provision cloud resources in a declarative and version-controlled manner. With its support for multiple cloud providers, another approach I could use Pulumi but I have less experience in.\n- AWS: Because of its comprehensive range of services, global infrastructure, and strong support for scalability and security.\n- GitHub Actions: This was chosen as the continuous integration and continuous delivery (CI/CD) platform for its native integration with GitHub repositories and ease of use, another alternatives I could use Jenkins or Azure DevOps (similar experience)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fchallenge-johnbedeir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbedeir%2Fchallenge-johnbedeir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fchallenge-johnbedeir/lists"}