{"id":16143190,"url":"https://github.com/johnbedeir/iac-challenge","last_synced_at":"2025-04-06T19:24:58.717Z","repository":{"id":103781903,"uuid":"380098978","full_name":"johnbedeir/iac-challenge","owner":"johnbedeir","description":"Using (Docker - Ansible - Terraform - Kubernetes - AWS) to build stateless \u0026 stateful app","archived":false,"fork":false,"pushed_at":"2022-02-20T00:22:38.000Z","size":453,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T01:29:30.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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":"2021-06-25T02:06:59.000Z","updated_at":"2022-02-20T00:22:42.000Z","dependencies_parsed_at":"2024-06-02T12:32:35.389Z","dependency_job_id":null,"html_url":"https://github.com/johnbedeir/iac-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fiac-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fiac-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fiac-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2Fiac-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbedeir","download_url":"https://codeload.github.com/johnbedeir/iac-challenge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247536946,"owners_count":20954853,"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":[],"created_at":"2024-10-10T00:08:50.095Z","updated_at":"2025-04-06T19:24:58.697Z","avatar_url":"https://github.com/johnbedeir.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### In this readme we build EKS cluster, Nginx-ingress, Postgres instance as well as the stateless application `hello-app`\n#\n# 1st Stage: Docker\n\n## 1. Docker Images \n### a) Nginx (for the stateless application)\n    docker pull triple3a/nginx-image\n### b) Laravel-ci (for the stateful application)\n    docker pull triple3a/laravel-ci \n### c) laravel (for the stateful application)\n    docker pull triple3a/laravel\n### d) Application image\n    docker pull triple3a/demo-app\n\n## 2. Dockerfile \n### a) Copy the project inside the container, install composer and run entrypoint `artisian migrate`\n\n    FROM triple3a/laravel-ci AS builder\n\n    COPY . /var/www/html\n    ENV COMPOSER_MEMORY_LIMIT=-1\n    RUN mkdir -p /var/www/html/storage/framework/sessions \\\n        \u0026\u0026 mkdir -p /var/www/html/storage/framework/views \\\n        \u0026\u0026 mkdir -p /var/www/html/storage/framework/cache \\\n        \u0026\u0026 mkdir -p /var/www/html/storage/framework/cache/data \\\n        \u0026\u0026 chmod -R 777 /var/www/html/storage/framework \\\n        \u0026\u0026 chown -R www-data:www-data /var/www/html/storage/framework \\\n        \u0026\u0026 composer update\n\n    FROM triple3a/laravel\n    COPY --from=builder /var/www/html /var/www/html\n    ENTRYPOINT /docker-entrypoint.sh\n#\n# 2nd Stage: Kubernetes `YML` files\n## 1. `configmap.yaml` to get the DB artifacts from the image and keep containerized applications portable\n    kind: ConfigMap\n    apiVersion: v1\n    metadata:\n    name: demo-app\n    namespace: development\n    data:\n    APP_NAME: Demo\n    APP_ENV: development\n    APP_KEY: base64:QJKvhZRjMbkFqmG93pYSH68IFSi1Th0lhLH3+PUL1Pc=\n    APP_DEBUG: \"true\"\n    APP_URL: http://localhost\n\n    LOG_CHANNEL: stack\n\n    DB_CONNECTION: pgsql\n    DB_HOST: app-postgresql-master.cbckp8nutrni.us-east-2.rds.amazonaws.com\n    DB_PORT: \"5432\"\n    DB_DATABASE: appPostgresql\n    DB_USERNAME: app_postgresql\n    DB_PASSWORD: \"YourPwdShouldBeLongAndSecure!\"\n\n    BROADCAST_DRIVER: log\n    CACHE_DRIVER: file\n    QUEUE_CONNECTION: sync\n    SESSION_DRIVER: file\n    SESSION_LIFETIME: \"120\"\n\n    MAIL_MAILER: smtp\n    MAIL_HOST: smtp.mailtrap.io\n    MAIL_PORT: \"2525\"\n    MAIL_USERNAME: \"null\"\n    MAIL_PASSWORD: \"null\"\n    MAIL_ENCRYPTION: \"null\"\n    MAIL_FROM_ADDRESS: \"null\"\n    MAIL_FROM_NAME: \"${APP_NAME}\"\n\n## 2. `deployment.yaml` to specify docker image and the needed resources\n    apiVersion: apps/v1\n    kind: Deployment\n    metadata:\n    labels:\n        app: demo-app\n    name: demo-app\n    namespace: development\n    spec:\n    selector:\n        matchLabels:\n        app: demo-app\n    strategy:\n        rollingUpdate:\n        maxSurge: 1\n        maxUnavailable: 0\n        type: RollingUpdate\n    template:\n        metadata:\n        labels:\n            app: demo-app\n        spec:\n        containers:\n            - envFrom:\n                - configMapRef:\n                    name: demo-app\n                    optional: true\n                - secretRef:\n                    name: demo-app\n                    optional: true\n            image: \"triple3a/demo-app:latest\"\n            imagePullPolicy: Always\n            name: demo-app\n            ports:\n                - containerPort: 8080\n                name: http\n            resources:\n                limits:\n                cpu: 250m\n                memory: 512Mi\n                requests:\n                cpu: 150m\n                memory: 128Mi\n## 3. `service.yaml` to enable network access to the pods\n    apiVersion: v1\n    kind: Service\n    metadata:\n    name: demo-app\n    namespace: development\n    spec:\n    ports:\n        - name: http\n        port: 8080\n        targetPort: 8080\n    selector:\n        app: demo-app\n    type: NodePort\n## 4. `ingress.yaml` to give service a reachable URL\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    metadata:\n    name: demo-app\n    namespace: development\n    spec:\n    ingressClassName: nginx\n    rules:\n        - host: demo.jb-host.net\n        http:\n            paths:\n            - backend:\n                service:\n                    name: demo-app\n                    port:\n                    number: 8080\n                path: /\n                pathType: ImplementationSpecific\n#\n# 3rd Stage: Terraform\n\n## 1. `db.tf` to create RDS instence\n\n## 2. `eks.tf` to create Cluster on Elastic Kubernetes Service\n\n## 3. `vpc.tf` to create the virtual private cloud and set the IP range\n\n## 4. `k8s-hello.tf` deploying stateless app\n\n## 5. `k8s-namespace.tf` create namespaces\n\n## 6. `providers.tf` aws access\n\n## 7. `variables.tf` set region, IAM role, autoscaling\n\n#\n# Last Stage: Makefile\n## 1. to `build image`, `push image` and `deploy` the `YML` files  \n\n    .PHONY : all\n\n    all: build push deploy\n\n    build:\n        docker build -t triple3a/demo-app demo-app\n\n    push:\n        docker push triple3a/demo-app\n\n    deploy:\n        kubectl apply -n development -f demo-app/k8s\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fiac-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbedeir%2Fiac-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fiac-challenge/lists"}