Last active
January 18, 2022 00:19
-
-
Save vfarcic/8b4d3350bb42d5d2b82f1b11786767c2 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/8b4d3350bb42d5d2b82f1b11786767c2 | |
#################################################################################################################### | |
# Combining Progressive Delivery With GitOps and Continuous Delivery Through Argo CD, Argo Rollouts, and Codefresh # | |
#################################################################################################################### | |
######################### | |
# Setting Up Production # | |
######################### | |
open https://github.com/vfarcic/argocd-production | |
# Fork it | |
# Replace `[...]` with your GitHub organization | |
export GH_ORG=[...] | |
git clone \ | |
https://github.com/$GH_ORG/argocd-production.git | |
cd argocd-production | |
git remote add upstream \ | |
https://github.com/vfarcic/argocd-production.git | |
git fetch upstream | |
git merge upstream/master | |
kubectl apply --filename project.yaml | |
cp orig/prometheus.yaml \ | |
helm/templates/. | |
cat helm/templates/prometheus.yaml | |
cp orig/argo-rollouts.yaml \ | |
helm/templates/. | |
cat helm/templates/argo-rollouts.yaml | |
cat orig/devops-toolkit-rollouts.yaml \ | |
| sed -e \ | |
"s@devopstoolkitseries.com@devops-toolkit.$ISTIO_HOST.xip.io@g" \ | |
| tee helm/templates/devops-toolkit.yaml | |
cat orig/apps.yaml \ | |
| sed -e "s@vfarcic@$GH_ORG@g" \ | |
| tee apps.yaml | |
git add . | |
git commit -m "Initial commit" | |
git push | |
kubectl apply --filename apps.yaml | |
ARGOCD_ADDR=$(kubectl \ | |
--namespace argocd \ | |
get ingress argocd-server \ | |
--output jsonpath="{.spec.rules[0].host}") | |
open http://$ARGOCD_ADDR | |
cd .. | |
############################ | |
# Defining The Application # | |
############################ | |
open https://github.com/vfarcic/devops-toolkit.git | |
# Fork it | |
git clone https://github.com/$GH_ORG/devops-toolkit.git | |
cd devops-toolkit | |
git remote add upstream \ | |
https://github.com/vfarcic/devops-toolkit.git | |
git fetch upstream | |
git merge upstream/master | |
cat orig/production-rollouts.yaml \ | |
| sed -e \ | |
"s@devopstoolkitseries.com@devops-toolkit.$ISTIO_HOST.xip.io@g" \ | |
| tee production.yaml | |
######################### | |
# Creating The Pipeline # | |
######################### | |
codefresh get contexts | |
# Replace `[...]` with the `git.github` context. Create it if there isn't one | |
export CF_GIT_CONTEXT=[...] | |
cat codefresh/codefresh-master.yml \ | |
| sed -e "s@repo: vfarcic@repo: $GH_ORG@g" \ | |
| sed -e "s@context: github@context: $CF_GIT_CONTEXT@g" \ | |
| sed -e "s@git: github@git: $CF_GIT_CONTEXT@g" \ | |
| tee codefresh-master.yml | |
git add . | |
git commit -m "Progressive" | |
git push | |
codefresh create pipeline \ | |
-f codefresh-master.yml | |
open https://g.codefresh.io/pipelines/edit/workflow?pipeline=devops-toolkit-master | |
#################################### | |
# Exploring The Initial Deployment # | |
#################################### | |
cat helm/templates/rollout.yaml | |
cat helm/values.yaml | |
kubectl argo rollouts \ | |
--namespace production \ | |
get rollout devops-toolkit-devops-toolkit | |
echo $ISTIO_HOST | |
# Open a second terminal session | |
# Replace `[...]` with the IP of the Istio Gateway Service | |
export ISTIO_HOST=[...] | |
while true; do | |
curl -I http://devops-toolkit.$ISTIO_HOST.xip.io/this-does-not-exist | |
sleep 1 | |
done | |
# Go back to the first terminal session | |
echo "Will it roll back?" \ | |
| tee README.md | |
git add . | |
git commit -m "A silly change" | |
git push | |
open https://g.codefresh.io/builds2 | |
open https://github.com/$GH_ORG/argocd-production/pulls | |
kubectl argo rollouts \ | |
--namespace production \ | |
get rollout devops-toolkit-devops-toolkit \ | |
--watch | |
# Go to the second terminal session | |
############################ | |
# Rolling Forward Releases # | |
############################ | |
while true; do | |
curl -I http://devops-toolkit.$ISTIO_HOST.xip.io | |
sleep 1 | |
done | |
# Go to the first terminal session | |
echo "Will it roll forward?" \ | |
| tee README.md | |
git add . | |
git commit -m "A silly change" | |
git push | |
open https://github.com/$GH_ORG/argocd-production/pulls | |
kubectl argo rollouts \ | |
--namespace production \ | |
get rollout devops-toolkit-devops-toolkit \ | |
--watch | |
######################## | |
# Cleaning Up The Mess # | |
######################## | |
# Make sure that you are in the first terminal session | |
cd .. | |
codefresh delete pipeline \ | |
devops-toolkit-master | |
cd argocd-production | |
gh repo view --web | |
# Delete the repo | |
cd .. | |
cd devops-toolkit | |
gh repo view --web | |
# Delete the repo | |
cd .. | |
rm -rf argocd-production \ | |
devops-toolkit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment