GAP Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Manual deployment/rollback

This document is relevant if ArgoCD is down for some reason and you MUST deploy to staging or production.

Context

The CI pipeline is independent of ArgoCD, so the part that builds your application, generates the deployment configurations (aka. manifests/yamls) and commits them into the GitOps repository is not affected by ArgoCD outage. However, the pipeline will fail, since the last step that tells ArgoCD to deploy the new version of your app will not succeed. That said, the configuration is in the GitOps repo, you just have to deploy it manually, if it’s urgent.

The methods described on this page are not recommended. If there is no ongoing incident that you can only fix by deploying a new version, please wait for ArgoCD to be restored.

Simple deployment to stage or prod cluster

Using this method, the pre/post-deploy commands will not be run in the expected order, but the pods executing them will be deployed together with all other resources. If the particular version you’re planning to deploy this way has an important pre/post deploy step (ex. a new migration to the DB has to be run before deploying the new version) please find the detailed guide for that case here.

Use the below guide if that is not the case.

  1. Go to the emartech/gap-applications.git repository.
  2. Either clone it to your local machine or browse online, navigate to your application folder: <your namespace/team name>/<application-name>/<environment(stage/prod)> (ex. cloud-platform/gap-docs/stage).
  3. Confirm that last commit is the one you want to deploy.
  4. If you’re browsing online, save the manifest.yaml file to your local machine.
  5. Make sure your kubectl context points to the right cluster. If unsure, use
kubectl config current-context
  1. Deploy the manifest bundle to the cluster:
kubectl apply -f ./manifests.yaml -n <your-namespace>
  1. Use k9s (or your favourite k8s tool) to observe the rollout of your deployments (in k9s use :deploy and wait until all deployments have replaced their replicas with the new version).

Deploy with pre/post-deploy

  1. Get your manifests.yaml file following steps 1-4 of the guide above and open it in a code editor.
  2. Find the pre-deploy pod: search for hookName: pre-deploy and cut the whole pod object (between ---) from the manifests.yaml file.
  3. Create a new file with the name pre-deploy.yaml and paste the pod’s code into it.
  4. Do the same with post-deploy if you have one, just look for the hookName: post-deploy label and name the file post-deploy.yaml.
  5. Make sure your kubectl context points to the right cluster. If unsure, use
kubectl config current-context
  1. Deploy the pre-deploy pod:
kubectl apply -f pre-deploy.yaml -n <your-namespace>
  1. Wait until the pod finishes execution:
kubectl wait --for=condition=Completed pod/<application-name>-pre-deploy -n <your-namespace>

(or use k9s -> :pod -> /pre-deploy and wait until the status is Completed).

  1. Deploy the manifests.yaml to the cluster:
kubectl apply -f ./manifests.yaml -n <your-namespace>
  1. Use k9s (or your favourite k8s tool) to observe the rollout of your deployments (in k9s use :deploy and wait until all deployments have replaced their replicas to the new version).
  2. If you have post-deploy, repeat the steps 6-7 with post-deploy.yaml.

Simple rollback

  1. Go to the emartech/gap-applications.git repository and clone it to your local machine.
  2. Check out your applicaton’s branch:
git checkout <your-namespace>-<your-application-name> # ex. cloud-platform-gap-docs
  1. Use git log to find the commit you want to rollback to (ex. 895cd7be0f35ef19bab858cdfdfb5969860f15d8)
  2. Check out that commit:
git checkout 895cd7be0f35ef19bab858cdfdfb5969860f15d8
  1. Navigate to your application folder: <your namespace/team name>/<application-name>/<environment(stage/prod)> (ex. cloud-platform/gap-docs/stage).
  2. Make sure your kubectl context points to the right cluster. If unsure, use
kubectl config current-context
  1. Deploy the manifest bundle to the cluster:
kubectl apply -f ./manifests.yaml -n <your-namespace>
  1. Use k9s (or your favourite k8s tool) to observe the rollout of your deployments (in k9s use :deploy and wait until all deployments have replaced their replicas to the new version).

Rollback with pre/post-deploy

  1. Follow the simple-guide steps 1-5 and open the manifests.yaml file in your editor.
  2. Find the pre-deploy pod: search for hookName: pre-deploy and cut it from the manifests.yaml file.
  3. Create a new file with the name pre-deploy.yaml and paste the pod’s code into it.
  4. Do the same with post-deploy if you have one, just look for the hookName: post-deploy label and name the file post-deploy.yaml.
  5. Make sure your kubectl context points to the right cluster. If unsure, use
kubectl config current-context
  1. Deploy the pre-deploy pod:
kubectl apply -f pre-deploy.yaml -n <your-namespace>
  1. Wait until the pod finishes execution:
kubectl wait --for=condition=Completed pod/<application-name>-pre-deploy -n <your-namespace>

(or use k9s -> :pod -> /pre-deploy and wait until the status is Completed).

  1. Deploy the manifests.yaml to the cluster:
kubectl apply -f ./manifests.yaml -n <your-namespace>
  1. Use k9s (or your favourite k8s tool) to observe the rollout of your deployments (in k9s use :deploy and wait until all deployments have replaced their replicas to the new version).
  2. If you have post-deploy, repeat the steps 6-7 with post-deploy.yaml.