This is a template used to scaffold a toolchain to host and deploy a fully functional frontend App (FireworksApp).
This Template implements the following steps:
- Create an empty Github repository (on github.com) - link
- Push the code from the skeleton to the previously create repository - link
- A Continuous Integration pipeline (GitHub workflow) will build the Dockerfile of the frontend app and the resulting image will be published as a Docker image on the GitHub Package registry
- An ArgoCD Application will be deployed to listen to the Helm Chart of the FireworksApp application and deploy the chart on the same Kubernetes cluster where ArgoCD is hosted
- The FireworksApp will be deployed with a Service type of NodePort kind exposed on the chosen port.
- Install argo CLI: https://argo-cd.readthedocs.io/en/stable/cli_installation/
- Have Krateo PlatformOps installed: https://docs.krateo.io/
helm repo add krateo https://charts.krateo.io
helm repo update krateo
helm install github-provider krateo/github-provider --namespace krateo-system --create-namespace
helm install git-provider krateo/git-provider --namespace krateo-system --create-namespace
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update argo
helm install argocd argo/argo-cd --namespace krateo-system --create-namespace --wait
kubectl patch configmap argocd-cm -n krateo-system --patch '{"data": {"accounts.krateo-account": "apiKey, login"}}'
kubectl patch configmap argocd-rbac-cm -n krateo-system --patch '{"data": {"policy.default": "role:readonly"}}'
In order to generate a token, follow this instructions:
kubectl port-forward service/argocd-server -n krateo-system 8443:443
Open a new terminal and execute the following commands:
PASSWORD=$(kubectl -n krateo-system get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d)
argocd login localhost:8443 --insecure --username admin --password $PASSWORD
argocd account list
TOKEN=$(argocd account generate-token --account krateo-account)
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: argocd-endpoint
namespace: krateo-system
stringData:
insecure: "true"
server-url: https://argocd-server.krateo-system.svc:443
token: $TOKEN
EOF
In order to generate a token, follow this instructions: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
Give the following permissions: delete:packages, delete_repo, repo, workflow, write:packages
Substitute the value with the generated token:
cat <<EOF | kubectl apply -f -
apiVersion: v1
stringData:
token: <PAT>
kind: Secret
metadata:
name: github-repo-creds
namespace: krateo-system
type: Opaque
EOF
cat <<EOL > values.yaml
chart:
# when helm is in a registry
url: https://charts.krateo.io
version: 1.1.3
repo: fireworks-app
card:
icon: fa-cubes
title: FireworksApp
color: blue
content: This is a card for FireworksApp template
EOL
helm repo add krateo https://charts.krateo.io
helm repo update krateo
helm install fireworksapp krateo/compositiondefinition -n fireworksapp-system --create-namespace -f values.yaml
cat <<EOF | kubectl apply -f -
apiVersion: core.krateo.io/v1alpha1
kind: CompositionDefinition
metadata:
name: fireworksapp
namespace: krateo-system
spec:
chart:
repo: fireworks-app
served: true
url: https://charts.krateo.io
version: 1.1.3
EOF