Skip to content

backstage scaffolded application with github and k8 plugins installed.

License

Notifications You must be signed in to change notification settings

lokeshrangineni/backstage-app-github-k8

Repository files navigation

backstage-app-github-k8

backstage scaffolded application with github and k8 plugins installed.

Database Configurations

First spin up the postgres on local using below command.

docker run --name some-postgres -e POSTGRES_PASSWORD=passw0rd! -d -p 5432:5432 postgres

The current configurations are updated in the .env file as below.

export POSTGRES_PASSWORD=passw0rd!
export POSTGRES_USER=postgres
export POSTGRES_HOST=localhost
export POSTGRES_PORT=5432

Backstage

To start the app, Update .env file with correct configurations and run:

yarn install
source .env && yarn dev

Configuring backstage github auth and insights plugins.

Please update .env file with correct client and secrets. Find more info to configure github here

If you run into any issues, please find the documentation to troubleshoot here.

export AUTH_GITHUB_CLIENT_ID=<UPDATE>
export AUTH_GITHUB_CLIENT_SECRET=<UPDATE>
export GITHUB_TOKEN=<UPDATE>

Configuring backstage kubernetes plugin.

You need to make sure have below configuration as part of the app-config.yaml. This configuration is already added.

kubernetes:
  serviceLocatorMethod:
    type: multiTenant
  clusterLocatorMethods:
    - type: config
      clusters:
        - url: ${K8S_MINIKUBE_URL}
          name: minikube
          authProvider: serviceAccount
          skipTLSVerify: true
          skipMetricsLookup: false
          serviceAccountToken: ${K8S_MINIKUBE_TOKEN}

Make sure you set the following environment variables.

K8S_MINIKUBE_URL - You can get the control plane url using kubectl cluster-info command. K8S_MINIKUBE_TOKEN - You can get the service account token using below command. Make sure that this service account is having cluster-admin permissions so that plugin get all the cluster information.

oc -n default get secret $(oc -n default get sa deployer -o=json \
| jq -r '.secrets[0].name') -o=json \
| jq -r '.data["token"]' \
| base64 --decode

oc -n default get secret $(oc -n default get sa deployer -o=json | jq -r '.secrets[0].name') -o=json | jq -r '.data["token"]' | base64 --decode

# careful if you are executing below command on production. You are giving admin permissions. 
kubectl create clusterrolebinding deployer --clusterrole=cluster-admin --serviceaccount=default:deployer 

Building docker image for the Openshift/Kubernetes deployment.

# Building the docker image from root directory.
podman image build . --tag backstage-sample-app-in-memory
podman image tag localhost/backstage-sample-app-in-memory:latest quay.io/lrangine/backstage-sample-app:1
podman image push quay.io/lrangine/backstage-sample-app:1
 
# Running the application from local docker image. 
podman run -it -p 7007:7007 -p 3000:3000 \
-e K8S_MINIKUBE_URL=<UPDATE> \
-e K8S_MINIKUBE_TOKEN=<UPDATE> \
-e AUTH_GITHUB_CLIENT_ID=<UPDATE> \
-e AUTH_GITHUB_CLIENT_SECRET=<UPDATE> \
-e GITHUB_TOKEN=<UPDATE> \
localhost/backstage-sample-app-in-memory:latest

About

backstage scaffolded application with github and k8 plugins installed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published