Skip to content

Commit

Permalink
DEVXT-1781: Upgrade backstage backend (#189)
Browse files Browse the repository at this point in the history
* initial upgrade commit

* update to version 1.32.3

* changed to use ProxiedSignInPage

* removed code that was added but commented out

* Set zIndex on ExpandableTocAddon

* Upgrade to version 1.32.4

* removed knexConfig, it was something I was experimenting with, but don't think we need

* Updated README file and provided template app-config.local.yaml file

* Updated template file

---------

Co-authored-by: Galen Gray <103235538+oomIRL@users.noreply.github.com>
  • Loading branch information
MonicaG and oomIRL authored Nov 12, 2024
1 parent 4fd9d78 commit 9a7f4c5
Show file tree
Hide file tree
Showing 30 changed files with 7,229 additions and 7,187 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.yarn/install-state.gz
**/dist
**/node_modules
*.local.yaml
*.local.*
coverage
dist-types
examples
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ site
# Local configuration or documentation files
*.local.*

# Except template local file
!app-config.local.template.yaml

# bak up files
*.bak

Expand Down
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,38 @@
[![Package Status](https://github.com/bcgov/developer-portal/actions/workflows/update-gitops.yaml/badge.svg)](https://github.com/bcgov/developer-portal/actions/workflows/update-gitops.yaml)
[![CodeQL](https://github.com/bcgov/developer-portal/workflows/CodeQL/badge.svg)](https://github.com/bcgov/developer-portal/actions/workflows/github-code-scanning/codeql)

This is the [developer portal for the Province of British Columbia](https://developer.gov.bc.ca) built using [Backstage](https://backstage.io).
This is the [developer portal for the Province of British Columbia](https://developer.gov.bc.ca) built using [Backstage](https://backstage.io).

## Local Development

### Required Tools
* Node [long-term-support version](https://nodejs.dev/en/about/releases/) (i.e. lts/hydrogen)

- Node [long-term-support version](https://nodejs.dev/en/about/releases/) (i.e. lts/hydrogen)

### Setup
* For development purposes, the in memory SQLite database is sufficient (it is already configured)
* Alternativley, [Postgres](https://www.postgresql.org) can be configured
* Install [Postgres locally](https://www.postgresql.org/download/) or via [docker](https://hub.docker.com/_/postgres)
* Create an `app-config.local.yaml` file in the project's root directory and provide the following configurations:
```yaml
database:
client: pg
connection:
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
```

- For development purposes, the in memory SQLite database is sufficient (it is already configured)
- Alternativley, [Postgres](https://www.postgresql.org) can be configured
- Install [Postgres locally](https://www.postgresql.org/download/) or via [docker](https://hub.docker.com/_/postgres)
- Create an `app-config.local.yaml` file based off of the [app-config.local.template.yaml](app-config.local.template.yaml) file.

### Running

To run the project, use the following at the project's root directory

```
$ yarn install
$ yarn dev
```
### Dockerfile

### Dockerfile

Note: The dockerfile is based on the [Janus showcase project](https://github.com/janus-idp/backstage-showcase/)

### Deployment

### Deployment
See the [gitops repo](https://github.com/bcgov-c/tenant-gitops-f5ff48).

### More information

See the [Backstage.io documentation](https://backstage.io/docs/getting-started/)
65 changes: 65 additions & 0 deletions app-config.local.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Use this template to create your own app-config.local.yaml file
# See one of the devs on how to get the values for the env variables

# Uncomment to use POSTGRES. The below config assumes postgres is running locally.
# backend:
# database:
# client: pg
# connection:
# host: localhost
# port: 5432
# password: ${POSTGRES_PASSWORD}
# user: ${POSTGRES_USER}

integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}

stackoverflow:
baseUrl: https://stackoverflow.developer.gov.bc.ca/api/2.3
apiKey: ${STACK_OVERFLOW_API_KEY}
requestParams:
pagesize: 100
site: stackoverflow

auth:
environment: development
providers:
guest:
userEntityRef: user:default/guest
dangerouslyAllowOutsideDevelopment: true
github:
development:
clientId: ${AUTH_GITHUB_CLIENT_ID}
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
signIn:
resolvers:
- resolver: usernameMatchingUserEntityName

techdocs:
builder: 'external'
generator:
runIn: 'local'
publisher:
type: 'awsS3'
awsS3:
bucketName: backstage
bucketRootPath: dev
credentials:
accessKeyId: ${TECHDOCS_S3_ACCESS_KEY_ID}
secretAccessKey: ${TECHDOCS_S3_SECRET_ACCESS_KEY}
endpoint: ${TECHDOCS_S3_ENDPOINT}
region: ca-central-1
s3ForcePathStyle: true

catalog:
locations:
- type: url
target: https://github.com/bcgov/developer-experience-team/blob/main/developer-portal/catalog/catalog-seed-dev.yml
rules:
- allow: [Component]
- type: url
target: https://github.com/bcgov/developer-experience-team/blob/main/developer-portal/catalog/templates-seed-dev.yml
rules:
- allow: [Template]
65 changes: 44 additions & 21 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
backend:
# config options: https://node-postgres.com/apis/client
database:
client: pg
connection:
host: ${POSTGRES_HOST}
password: ${POSTGRES_PASSWORD}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
# config options: https://node-postgres.com/apis/client
database:
client: pg
connection:
host: ${POSTGRES_HOST}
password: ${POSTGRES_PASSWORD}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
catalog:
import:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [ Component, System, API, Resource, Location ]
locations:
- type: url
target: https://github.com/bcgov/developer-experience-team/blob/main/developer-portal/catalog/catalog-seed-production.yml
rules:
- allow: [ Component ]
import:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [Component, System, API, Resource, Location]
locations:
- type: url
target: https://github.com/bcgov/developer-experience-team/blob/main/developer-portal/catalog/catalog-seed-production.yml
rules:
- allow: [Component]
search:
collators:
catalog:
schedule: # same options as in SchedulerServiceTaskScheduleDefinition
# supports cron, ISO duration, "human duration" as used in code
initialDelay: { seconds: 3 }
frequency: { minutes: 10 }
timeout: { minutes: 15 }
filter:
kind: ['API', 'Component', 'Domain', 'Group', 'Resource', 'System', 'User']
kind:
['API', 'Component', 'Domain', 'Group', 'Resource', 'System', 'User']
stackoverflow:
baseUrl: ${STACK_OVERFLOW_URL}
apiKey: ${STACK_OVERFLOW_API_KEY}
baseUrl: ${STACK_OVERFLOW_URL}
apiKey: ${STACK_OVERFLOW_API_KEY}
requestParams:
pagesize: 100
site: stackoverflow

auth:
environment: default
providers:
guest:
userEntityRef: user:default/guest
dangerouslyAllowOutsideDevelopment: true
github:
default:
clientId: ${AUTH_GITHUB_CLIENT_ID}
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
signIn:
resolvers:
- resolver: usernameMatchingUserEntityName
139 changes: 78 additions & 61 deletions app-config.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
app:
title: B.C. government DevHub
baseUrl: http://localhost:3000
support:
url: 'https://github.com/bcgov/developer-portal/issues'
items:
- title: 'Something went wrong.'
links:
- url: 'https://github.com/bcgov/developer-portal/issues'
title: 'Our GitHub issues.'
analytics:
snowplow:
enabled: true
collectorUrl: https://spm.apps.gov.bc.ca
title: B.C. government DevHub
baseUrl: http://localhost:3000
support:
url: 'https://github.com/bcgov/developer-portal/issues'
items:
- title: 'Something went wrong.'
links:
- url: 'https://github.com/bcgov/developer-portal/issues'
title: 'Our GitHub issues.'
analytics:
snowplow:
enabled: true
collectorUrl: https://spm.apps.gov.bc.ca

organization:
name: BCDevExchange
name: BCDevExchange

backend:
# Used for enabling authentication, secret is shared by all backend plugins
# See https://backstage.io/docs/tutorials/backend-to-backend-auth for
# information on the format
# auth:
# keys:
# - secret: ${BACKEND_SECRET}
baseUrl: http://localhost:7007
listen:
port: 7007
# Uncomment the following host directive to bind to specific interfaces
# host: 127.0.0.1
csp:
connect-src: [ "'self'", 'http:', 'https:' ]
img-src: [ "'self'", "*.gov.bc.ca", "github.com", "bcgov.github.io", "img.shields.io", "data:" ]
frame-src: ["www.youtube.com", "miro.com"]
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
origin: http://localhost:3000
methods: [ GET, HEAD, PATCH, POST, PUT, DELETE ]
credentials: true
# This is for local development only, it is not recommended to use this in production
# The production database configuration is set via the helm settings yaml file.
database:
client: better-sqlite3
connection: ':memory:'
cache:
store: memory
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir
# Used for enabling authentication, secret is shared by all backend plugins
# See https://backstage.io/docs/tutorials/backend-to-backend-auth for
# information on the format
# auth:
# keys:
# - secret: ${BACKEND_SECRET}
baseUrl: http://localhost:7007
listen:
port: 7007
# Uncomment the following host directive to bind to specific interfaces
# host: 127.0.0.1
csp:
connect-src: ["'self'", 'http:', 'https:']
img-src:
[
"'self'",
'*.gov.bc.ca',
'github.com',
'bcgov.github.io',
'img.shields.io',
'data:',
]
frame-src: ['www.youtube.com', 'miro.com']
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
origin: http://localhost:3000
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
credentials: true
# This is for local development only, it is not recommended to use this in production
# The production database configuration is set via the helm settings yaml file.
database:
client: better-sqlite3
connection: ':memory:'
cache:
store: memory
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir

permission:
enabled: true
enabled: true

integrations:
# github:
Expand All @@ -65,32 +73,41 @@ integrations:
# apiKey: ${STACK_OVERFLOW_API_KEY}

proxy:
### Example for how to add a proxy endpoint for the frontend.
### A typical reason to do this is to handle HTTPS and CORS for internal services.
# '/test':
# target: 'https://example.com'
# changeOrigin: true
### Example for how to add a proxy endpoint for the frontend.
### A typical reason to do this is to handle HTTPS and CORS for internal services.
# '/test':
# target: 'https://example.com'
# changeOrigin: true
endpoints:
'/github-api':
target: https://api.github.com
target: https://api.github.com
allowedHeaders: ['Authorization', 'X-GitHub-Api-Version', 'Accept']
credentials: require
headers:
X-GitHub-Api-Version: "2022-11-28"
X-GitHub-Api-Version: '2022-11-28'
Accept: application/vnd.github+json


# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
# and an external cloud storage when deploying TechDocs for production use-case.
# https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-basic-to-recommended-deployment-approach
techdocs:
builder: 'local' # Alternatives - 'external'
generator:
runIn: 'docker' # Alternatives - 'local'
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
sanitizer:
allowedIframeHosts:
- www.youtube.com
- miro.com
builder: 'local' # Alternatives - 'external'
generator:
runIn: 'docker' # Alternatives - 'local'
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
sanitizer:
allowedIframeHosts:
- www.youtube.com
- miro.com

catalog:
providers:
githubOrg:
- id: production
githubUrl: 'https://github.com'
orgs: ['bcgov', 'bcgov-public']
schedule:
frequency: { minutes: 60 }
timeout: { minutes: 15 }
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.28.4"
"version": "1.32.4"
}
6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

Loading

0 comments on commit 9a7f4c5

Please sign in to comment.