Skip to content

Commit c052a2c

Browse files
feat: toggleable backstage
1 parent ad8b8c9 commit c052a2c

24 files changed

+510
-533
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,5 @@ jobs:
3737
- name: Terraform Lint
3838
run: make lint
3939

40-
- name: Stub GitHub App credentials (required for validation)
41-
run: cd ./examples/with-backstage && docker run --rm -e STUB_FILE=1 -v $(pwd):/pwd ghcr.io/humanitec-architecture/create-gh-app
42-
4340
- name: Terraform Validate
4441
run: make validate

README.md

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ This plane is where the actual infrastructure exists including clusters, databas
5858

5959
## How to spin up your Humanitec AWS Reference Architecture
6060

61-
This repo contains an implementation of part of the Humanitec Reference Architecture for an Internal Developer Platform.
62-
63-
To install an implementation containing add-ons, follow the separate README. We currently feature these add-ons:
64-
65-
* [Base layer plus Backstage](examples/with-backstage/)
61+
This repo contains an implementation of part of the Humanitec Reference Architecture for an Internal Developer Platform, including Backstage as optional Portal solution.
6662

6763
This repo covers the base layer of the implementation for AWS.
6864

@@ -101,13 +97,13 @@ This reference architecture implementation uses Terraform. You will need to do t
10197

10298
For example:
10399

104-
```
100+
```shell
105101
export HUMANITEC_TOKEN="my-humanitec-api-token"
106102
```
107103

108104
5. Run terraform:
109105

110-
```
106+
```shell
111107
terraform init
112108
terraform plan
113109
terraform apply
@@ -125,34 +121,34 @@ Check for the existence of key elements of the reference architecture. This is a
125121

126122
1. Set the `HUMANITEC_ORG` environment variable to the ID of your Humanitec Organization (must be all lowercase):
127123

128-
```
124+
```shell
129125
export HUMANITEC_ORG="my-humanitec-org"
130126
```
131127

132128
2. Verify the existence of the Resource Definition for the EKS cluster in your Humanitec Organization:
133129

134-
```
130+
```shell
135131
curl -s https://api.humanitec.io/orgs/${HUMANITEC_ORG}/resources/defs/ref-arch \
136132
--header "Authorization: Bearer ${HUMANITEC_TOKEN}" \
137133
| jq .id,.type
138134
```
139135

140136
This should output:
141137

142-
```
138+
```shell
143139
"ref-arch"
144140
"k8s-cluster"
145141
```
146142

147143
3. Verify the existence of the newly created EKS cluster:
148144

149-
```
145+
```shell
150146
aws eks list-clusters --region <your-region>
151147
```
152148

153149
This should output:
154150

155-
```
151+
```json
156152
{
157153
"clusters": [
158154
"ref-arch",
@@ -161,17 +157,55 @@ Check for the existence of key elements of the reference architecture. This is a
161157
}
162158
```
163159

160+
### Enable a portal (optional)
161+
162+
#### Portal Prerequisites
163+
164+
Backstage requires a GitHub connection, which in turn needs:
165+
166+
* 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.
167+
* Create a classic github personal access token with `repo`, `workflow`, `delete_repo` and `admin:org` scope [here](https://github.com/settings/tokens).
168+
* Set the `GITHUB_TOKEN` environment variable to your token.
169+
170+
```shell
171+
export GITHUB_TOKEN="my-github-token"
172+
```
173+
174+
* Set the `GITHUB_ORG_ID` environment variable to your GitHub organization ID.
175+
176+
```shell
177+
export GITHUB_ORG_ID="my-github-org-id"
178+
```
179+
180+
* Install the GitHub App for Backstage into your GitHub organization
181+
* 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:
182+
* “All repositories” ~> Install
183+
* “Okay, [] was installed on the [] account.” ~> You can close the window and server.
184+
185+
#### Portal Usage
186+
187+
* Enable `with_backstage` inside your `terraform.tfvars` and configure the additional variables that a required for Backstage.
188+
* Perform another `terraform apply`
189+
190+
#### Verify portal setup
191+
192+
* [Fetch the DNS entry](https://developer.humanitec.com/score/getting-started/get-dns/) of the Humanitec Application `backstage`, Environment `development`.
193+
* Open the host in your browser.
194+
* Click the "Create" button and scaffold your first application.
195+
164196
### Cleaning up
165197

166198
Once you are finished with the reference architecture, you can remove all provisioned infrastructure and the resource definitions created in Humanitec with the following:
167199

168-
1. Ensure you are (still) logged in with `aws`.
200+
1. Delete all Humanitec Applications scaffolded using the Portal, if you used one, but not the `backstage` app itself.
169201

170-
2. Ensure you still have the `HUMANITEC_TOKEN` environment variable set to an appropriate Humanitec API token with the `Administrator` role on the Humanitec Organization.
202+
2. Ensure you are (still) logged in with `aws`.
171203

172-
3. Run terraform:
204+
3. Ensure you still have the `HUMANITEC_TOKEN` environment variable set to an appropriate Humanitec API token with the `Administrator` role on the Humanitec Organization.
173205

174-
```
206+
4. Run terraform:
207+
208+
```shell
175209
terraform destroy
176210
```
177211

@@ -184,25 +218,33 @@ Once you are finished with the reference architecture, you can remove all provis
184218
|------|---------|
185219
| terraform | >= 1.3.0 |
186220
| aws | ~> 5.17 |
221+
| github | ~> 5.38 |
187222
| helm | ~> 2.12 |
188223
| humanitec | ~> 1.0 |
189224
| kubernetes | ~> 2.25 |
225+
| random | ~> 3.5 |
190226

191227
### Modules
192228

193229
| Name | Source | Version |
194230
|------|--------|---------|
195231
| base | ./modules/base | n/a |
232+
| github | ./modules/github | n/a |
233+
| github\_app | github.com/humanitec-architecture/shared-terraform-modules | v2024-06-06//modules/github-app |
234+
| portal\_backstage | ./modules/portal-backstage | n/a |
196235

197236
### Inputs
198237

199238
| Name | Description | Type | Default | Required |
200239
|------|-------------|------|---------|:--------:|
201240
| aws\_account\_id | AWS Account (ID) to use | `string` | n/a | yes |
202-
| aws\_region | AWS Region to deploy into | `string` | n/a | yes |
203-
| humanitec\_org\_id | Humanitec Organization ID | `string` | n/a | yes |
241+
| aws\_region | AWS region | `string` | n/a | yes |
204242
| disk\_size | Disk size in GB to use for EKS nodes | `number` | `20` | no |
243+
| github\_org\_id | GitHub org id (required for Backstage) | `string` | `null` | no |
244+
| humanitec\_ci\_service\_user\_token | Humanitec CI Service User Token (required for Backstage) | `string` | `null` | no |
245+
| humanitec\_org\_id | Humanitec Organization ID (required for Backstage) | `string` | `null` | no |
205246
| instance\_types | List of EC2 instances types to use for EKS nodes | `list(string)` | <pre>[<br> "t3.large"<br>]</pre> | no |
247+
| with\_backstage | Deploy Backstage | `bool` | `false` | no |
206248
<!-- END_TF_DOCS -->
207249

208250
## Learn more

examples/with-backstage/README.md

Lines changed: 0 additions & 154 deletions
This file was deleted.

examples/with-backstage/backstage-aws.tf

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)