Skip to content

Commit

Permalink
chore: use packaged create-app script
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswuerbach committed Jun 5, 2024
1 parent 57ba430 commit 70ef17a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: make lint

- name: Stub GitHub App credentials (required for validation)
run: cd ./examples/with-backstage && STUB_FILE=1 node create-gh-app/index.js
run: cd ./examples/with-backstage && docker run --rm -e STUB_FILE=1 -v $(pwd):/pwd ghcr.io/humanitec-architecture/create-gh-app

- name: Terraform Validate
run: make validate
31 changes: 22 additions & 9 deletions examples/with-backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,30 @@ Provisions the AWS reference architecture connected to Humanitec and installs Ba
## Prerequisites

* The same prerequisites as the [base reference architecture](../../README.md#prerequisites), plus the following items.
* A GitHub organization and permission to create new repositories in it. Go to https://github.com/account/organizations/new to create a new org (the "Free" option is fine). Note: is has to be an organization, a free account is not sufficient.
* A GitHub organization and permission to create new repositories in it. Go to <https://github.com/account/organizations/new> to create a new org (the "Free" option is fine). Note: is has to be an organization, a free account is not sufficient.
* Create a classic github personal access token with `repo`, `workflow`, `delete_repo` and `admin:org` scope [here](https://github.com/settings/tokens).
* Set the `GITHUB_TOKEN` environment variable to your token.
```

```bash
export GITHUB_TOKEN="my-github-token"
```

* Set the `GITHUB_ORG_ID` environment variable to your GitHub organization ID.
```

```bash
export GITHUB_ORG_ID="my-github-org-id"
```

* [Node.js](https://nodejs.org) installed locally.
* Install the GitHub App for Backstage into your GitHub organization using `node create-gh-app/index.js`. Follow the instructions.
* “All repositories” ~> Install
* “Okay, [] was installed on the [] account.” ~> You can close the window and server.
* Install the GitHub App for Backstage into your GitHub organization
* Run `docker run --rm -it -e GITHUB_ORG_ID -v $(pwd):/pwd -p 127.0.0.1:3000:3000 ghcr.io/humanitec-architecture/create-gh-app` ([image source](https://github.com/humanitec-architecture/create-gh-app/)) and follow the instructions:
* “All repositories” ~> Install
* “Okay, […] was installed on the […] account.” ~> You can close the window and server.

## Usage

Follow the same steps as for the [base layer](../../README.md#usage), applying these modifications:

* Execute `cd ./examples/with-backstage` after cloning the repo. Execute all subsequent commands in this directory.
* In particular, use the `./examples/with-backstage/terraform.tfvars.example` file as the basis for your `terraform.tfvars` file. It defines additional variables needed to setup and configure Backstage.

Expand All @@ -32,31 +38,38 @@ Check for the existence of key elements of the backstage module. This is a subse

1. Perform the [verification steps of the base installation](../../README.md) if you have not already done so.
2. Verify the existence of the Backstage Application in your Humanitec Organization:

```
curl -s https://api.humanitec.io/orgs/${HUMANITEC_ORG}/apps/backstage \
--header "Authorization: Bearer ${HUMANITEC_TOKEN}"
```

This should output a JSON formatted representation of the Application like so:

```
{"id":"backstage","name":"backstage","created_at":"2023-10-02T13:44:27Z","created_by":"s-d3e94a0e-8b53-29f9-b666-27548b7e06e0","envs":[{"id":"development","name":"Development","type":"development"}]}
```

You can also check for the Application in the [Humanitec Platform Orchestrator UI](https://app.humanitec.io).

3. Connect to your EKS cluster via `kubectl`. See the [AWS documentation](https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html) or use this command:

```
aws eks update-kubeconfig --region <my-aws-region> --name ref-arch
```

4. Get the elements in the newly created Kubernetes namespace:

```
kubectl get all -n backstage-development
```

You should see
- a `deployment`, `replicaset`, running `pod`, and `service` for Backstage
- a `statefulset`, running `pod`, and `service` for PostgreSQL database used by Backstage.
* a `deployment`, `replicaset`, running `pod`, and `service` for Backstage
* a `statefulset`, running `pod`, and `service` for PostgreSQL database used by Backstage.

Note: it may take up to ten minutes after the `terraform apply` completed until you actually see those resources. The Backstage application needs to built and deployed via a GitHub action out of the newly created repository in your GitHub organization.


## Cleaning up

Once you are finished with the reference architecture, you can remove all provisioned infrastrcuture and the resource definitions created in Humanitec with the following:
Expand Down
153 changes: 0 additions & 153 deletions examples/with-backstage/create-gh-app/index.js

This file was deleted.

0 comments on commit 70ef17a

Please sign in to comment.