This repo consists of an automated procedure for deploying and updating backstage.
This repo consists of an automated procedure for deploying and updating backstage using the following technologies:
- Kubernetes: As the container orchestrator, to manage the lifecycle of the containers and handling failures gracefully
- ArgoCD: To automate deployment of backstage via GitOps
- Renovate: To automate updates whenever a new version of backstage is published to the registry
This setup will make sure that Backstage is updated automatically via pull requests (or automatically merging PRs), and that the installation stays in a working state even if something wrong happens during an update.
The following tools need to be installed and configured:
In order to setup the kubernetes cluster (kind) and required tools use the bootstrap script.
-
Run script
./bootstrap.sh
-
Get ArgoCD admin password:
kubectl -n argo-cd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
-
Open ArgoCD: https://argocd.127.0.0.1.nip.io and wait for everything to sync.
-
Access backstage: https://backstage.127.0.0.1.nip.io
The bootstrap script will:
- Install kind cluster called
bs-cluster-01
- Deploy nginx ingress controller in the cluster for accessing apps
- Deploy ArgoCD in order to enable GitOps
Once the script has finished successfully, ArgoCD will manage all components and apps via GitOps.
To delete or start over again, delete the kind cluster:
kind delete cluster -n bs-cluster-01
An example PR for automated update of backstage has been created in this repo: Pull#4
In order to test update you can fork the repo and use the fork instead, before bootstrapping the environment:
- Fork the repository
- Replace references to the repository:
find . -name "*.yaml" -type f -exec sed -i '' 's|https://github.com/hazim1093/backstage-demo|<your-fork-url>|g' {} +; find . -name "*.yaml" -type f -exec sed -i '' 's|hazim1093/backstage-demo|<fork-user/backstage-demo>|g' {} +;
- Update
backstage.backstage.image.tag
in apps/backstage/values.yaml and commit, to update the version number - To configure renovate, create a secret with your Github Token:
kubectl create secret generic renovate-secrets -n renovate \ --from-literal=RENOVATE_TOKEN="<Github Access Token>" \ --from-literal=RENOVATE_GIT_AUTHOR="[email protected]"
- In order to test a "faulty" update, use the docker image:
hazim/backstage-demo:faulty
. This release should fail to start, but the previous one should still be available.
The following assumptions have been made in this setup:
- The Backstage docker images used is built from an existing community docker image by The Platformers, instead of building backstage from scratch for this demo. The Appconfig for backstage has some dummy catalog resources.
- The docker images can be found in images/backstage
- SSL Certificates are not configured
- All components are not deployed in HA fashion
- Backstage is configured without persistent storage and uses in-memory database for simplicity.