Created
December 31, 2021 16:02
-
-
Save vfarcic/dace06b8cf51f5ff0d3802d42f3306f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://gist.github.com/6039be2497217a555fba5eafea076ba3 | |
######################################################################### | |
# Werf: Glue Together Git, Docker, Helm, Kubernetes For CI/CD Pipelines # | |
# https://youtu.be/WM06S_ltcVs # | |
######################################################################### | |
# Additional Info: | |
# - werf: https://werf.io | |
# - GitHub CLI - How to manage repositories more efficiently: https://youtu.be/BII6ZY2Rnlc | |
######### | |
# Setup # | |
######### | |
# Watch https://youtu.be/BII6ZY2Rnlc if you are not familiar with GitHub CLI | |
gh repo fork vfarcic/werf-demo --clone | |
cd werf-demo | |
# Create a Kubernetes cluster | |
# Using Rancher Desktop for the demo, but it can be any other Kubernetes cluster with Ingress | |
# If not using Rancher Desktop, replace `127.0.0.1` with the base host accessible through NGINX Ingress | |
export INGRESS_HOST=127.0.0.1 | |
cat .helm/templates/003-ingress.yaml \ | |
| sed "s@host: .*@host: devops-toolkit.$INGRESS_HOST.nip.io@g" \ | |
| tee .helm/templates/003-ingress.yaml | |
git add . | |
git commit -m "Host" | |
git push | |
curl -sSLO https://werf.io/install.sh | |
chmod +x install.sh | |
./install.sh \ | |
--version 1.2 \ | |
--channel stable | |
# Follow the instructions from the output | |
# Replace `[...]` with your Docker Hub user | |
export DH_USER=[...] | |
##################################### | |
# Build, Push, And Deploy With werf # | |
##################################### | |
werf converge \ | |
--repo $DH_USER/werf-demo \ | |
--platform linux/amd64 | |
helm --namespace werf-demo ls | |
echo "https://hub.docker.com/r/$DH_USER/werf-demo" | |
# Open it in a browser | |
kubectl --namespace werf-demo \ | |
get all,ingresses | |
echo "http://devops-toolkit.$INGRESS_HOST.nip.io" | |
# Open it in a browser | |
################################## | |
# Upgrade Applications With werf # | |
################################## | |
# Open `frontend/config.toml` in an editor and change `The DevOps Toolkit Series` to `Should We Use werf?` | |
werf converge \ | |
--repo $DH_USER/werf-demo \ | |
--platform linux/amd64 | |
git add . | |
git commit -m "New release" | |
git push | |
werf converge \ | |
--repo $DH_USER/werf-demo \ | |
--platform linux/amd64 | |
#################### | |
# werf Definitions # | |
#################### | |
# Refresh the app in browser | |
cat werf.yaml | |
cat frontend/Dockerfile | |
cat backend/Dockerfile | |
ls -1 .helm/ | |
ls -1 .helm/templates/ | |
cat .helm/templates/001-frontend.yaml | |
##################################### | |
# Deploying To Production With werf # | |
##################################### | |
werf converge \ | |
--repo $DH_USER/werf-demo \ | |
--platform linux/amd64 \ | |
--env production | |
####################### | |
# Other werf Features # | |
####################### | |
werf dismiss --with-namespace | |
kubectl get namespaces | |
werf build ... | |
werf run ... | |
############################### | |
# Doing The Same Without Werf # | |
############################### | |
docker image build ... | |
docker image push ... | |
helm upgrade --install --set image.tag=... | |
########### | |
# Destroy # | |
########### | |
cat frontend/config.toml \ | |
| sed -e "s@Should We Use werf?@The DevOps Toolkit Series@g" \ | |
| tee frontend/config.toml | |
git add . | |
git commit -m "Revert" | |
git push | |
# Destroy or reset the cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment