Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: README.md file describing PROD deployment process added #186

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions kubescripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Kubernetes PROD Deployment

This directory contains 3 shell scripts that are used when deploying the code to the production.

As with the DEV environment, it is necessary to first build Docker images using the command `docker-compose build`.
However, unlike the DEV environment where `docker-compose up -d` is used to start containers,
we need to run these scripts in specific order.

`k8-push-images.sh`

- This script contains only one for loop that goes through each of the builded Docker images.
- Each Docker image is first [tagged](https://docs.docker.com/engine/reference/commandline/tag/) as `localhost:32000/$image:latest`
and then [pushed](https://docs.docker.com/engine/reference/commandline/push/) to a `localhost:32000` registry.
- This script needs to be run every time a Docker image is rebuilt and can be started as:
```
./k8-push-images.sh
```

`k8s-full-delete.sh`

- This script is used for full delete and stop of everything which is currently running inside Kubernetes.
- This script needs to be run every time we want to re-deploy changes and can be started as:
```
./k8s-full-delete.sh
```

`k8-deploy.sh`

- Kubernetes pods are started/deployed after running this script.
- This script needs to be run right after we deleted everything using `k8s-full-delete.sh` script and can be started as:
```
./k8-deploy.sh
```
4 changes: 4 additions & 0 deletions kubescripts/k8s-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

microk8s helm3 install -f /home/yang/deployment/k8s/values.yaml /home/yang/deployment/k8s --generate-name
watch microk8s kubectl get pods
21 changes: 21 additions & 0 deletions kubescripts/k8s-full-delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

microk8s kubectl delete --all services
microk8s kubectl delete --all deployments
microk8s kubectl delete --all pods
microk8s kubectl delete --all jobs
microk8s kubectl delete --all networkpolicy
microk8s kubectl delete --all pvc
microk8s kubectl delete --all secret
microk8s kubectl delete --all ingress

microk8s kubectl delete pv run-pv
microk8s kubectl delete pv admin-webroot-pv
microk8s kubectl delete pv main-webroot-pv
microk8s kubectl delete pv nginx-conf-pv
microk8s kubectl delete pv downloadables-pv
microk8s kubectl delete pv docs-pv
microk8s kubectl delete pv confd-cache-pv

microk8s kubectl delete storageclass local-storage
SlavomirMazurPantheon marked this conversation as resolved.
Show resolved Hide resolved

7 changes: 7 additions & 0 deletions kubescripts/k8s-push-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

for image in yc_redis yc_module-compilation yc_admin-ui yc_frontend yangvalidator yc_yangre yc_yangcatalog-ui catalog_backend_api yc_confd yc_documentation; do
echo $image
docker tag $image:latest localhost:32000/$image:latest
docker push localhost:32000/$image:latest
done