Coder Social home page Coder Social logo

0chonko / todo_sc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from selfoluap/software-containerization

0.0 0.0 0.0 836 KB

Containerized ToDo app to run locally or on cloud

Shell 2.98% JavaScript 32.62% Python 16.99% CSS 26.90% HTML 15.45% Dockerfile 5.05%

todo_sc's Introduction

Software-Containerization

P3 Project Master Computer Science (VU / UVA)

Project structure:

  • /backend - Flask implementation for the back end of application

    • server/
      • .env - for local dev
      • requirements.txt
      • server.py - main api and db connection
      • .dockerignore - exclude .env
      • Dockerfile
  • /frontend - React implementation for the front end of application

    • public/
    • src/
    • frontend-nginx-custon.conf
    • Dockerfile
  • /helm-charts - Helm files to deploy application on cluster

    • templates/
      • *.yaml - chart k8s components
    • Chart.yaml - the chart
    • values.yaml - chart's values
  • presentation/ - presentation contents

  • /kubernetes - Services, deployments, secrets, ingress etc.

Setup:

On GCP we use a Standard Mode Regional Cluster. Create a cluster on GCP and connect the shell to it

gcloud container clusters get-credentials $CLUSTER_NAME --zone $YOUR_ZONE --project $YOUR_PROJECT_NAME

Install the nginx ingress controller on GCP

Execute the following commands to install the nginx ingress controller

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx
kubectl get deploy

Wait a few moments while the load balancer gets deployed and then retrieve the EXTERNAL-IP associated with the nginx-ingress service

kubectl get service nginx-ingress-ingress-nginx-controller -ojson | jq -r '.status.loadBalancer.ingress[].ip'

The output should look like this 35.239.106.62. This IP address will later be used to set the correct hostname in the values.yaml of the helm chart.

Build and push docker images to Container Registry

docker build . -t gcr.io/$YOUR_PROJECT_NAME/backend:v1
docker push eu.gcr.io/$YOUR_PROJECT_NAME/backend:v1

docker build . -t gcr.io/$YOUR_PROJECT_NAME/frontend:v1
docker push eu.gcr.io/$YOUR_PROJECT_NAME/frontend:v1

Create TLS Certificate We already created the secrets, but with the following command new keys can be created.

openssl req -x509 -sha256 -nodes -newkey rsa:4090 -keyout key.pem -out cert.pem

Set up Artifact Registry on GCP

Package the helm chart and push it to Artifact Registry

helm package helm
helm push software-containerization-0.1.0.tgz oci://us-central1-docker.pkg.dev/$YOUR_PROJECT_NAME/$YOUR_ARTIFACT_REPO_NAME

Install helm chart on GKE

helm install $HELM_CHART oci://us-central1-docker.pkg.dev/$YOUR_PROJECT_NAME/$YOUR_ARTIFACT_REPO_NAME/$HELM_CHART --version 0.1.0

Overview and Comands

Kubernetes Architecture

Docker

Check permissions for roles created by RBAC

kubectl auth can-i get configmaps --as <gcloud-user-email>

The cluster setup provides 3 RBAC roles: admin, developer, and devops-engineer.

Changing values in the Chart example: change the replicaCount to 5 in values.yaml and version to 0.1.1 in charts.yaml

helm upgrade --install software-containerization -f software-containerization-values.yaml software-containerization-0.1.1.tgz --set software-containerization.backend-deployment.replicaCount=5

After a source code change, the application can be rebuilt with the following:

docker build . -t eu.gcr.io/<gloud-project-id>/<deployment>:<version>
docker push eu.gcr.io/<gloud-project-id>/<deployment>:<version>
kubectl set image deployment/software-containerization-frontend-deployment software-containerization-frontend-container=eu.gcr.io/<gcloud-project-id>/<deployment>:<version>

Show how you upgrade the running application in two ways:

To perform a deployment rollout use:

To perform a canary update use:

To uninstall the application use:

    helm uninstall software-containerization
    kubectl get all -n default

todo_sc's People

Contributors

0chonko avatar selfoluap avatar jezisvedtojemojzis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.