Merge branch 'master' of github.com:spotify/backstage into shmidt-i/universal-file-github-actions

* 'master' of github.com:spotify/backstage: (536 commits)
  fix(catalog-backend): make addProcessor work (#3132)
  use cost insights changeset prefix
  fix(deps): yarn.lock changes missed (#3128)
  Disable yarn update check
  removed transformErrors function
  feat: make entity not found page responsive (#3125)
  Add changeset
  Loosen up the type some more
  Updated types and moved defaulting logic
  Move working directory config to backend
  Add missing config to create-app
  Add testing for working directory config
  Add workdir config support to scaffolder
  fix unbumped packages and bump changelog
  v0.1.1-alpha.26
  chore(docs): more docs around proxy setup
  techdocs-backend: remove duplicate log tagging
  catalog-backend: remove data parsing processing step
  scaffolder-backend: fix review nit
  docs: fix copy and paste error
  ...
This commit is contained in:
blam
2020-10-28 10:04:46 +01:00
923 changed files with 18068 additions and 9726 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-catalog-backend': minor
---
Use the new `UrlReader` in `PlaceholderProcessor`.
This allows to use the placeholder processor to include API definitions in API entities.
Previously it was only possible to do this if the definition comes from the same location type as the entity itself.
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/core': minor
'@backstage/core-api': minor
---
Updated the `GithubAuth.create` method to configure the default scope of the Github Auth Api. As a result the
default scope is configurable when overwriting the Core Api in the app.
```
GithubAuth.create({
discoveryApi,
oauthRequestApi,
defaultScopes: ['read:user', 'repo'],
}),
```
+26
View File
@@ -0,0 +1,26 @@
---
'@backstage/plugin-catalog-backend': minor
---
Remove the backstage.io/definition-at-location annotation.
The annotation was superseded by the placeholder processor.
```yaml
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: spotify
description: The Spotify web API
tags:
- spotify
- rest
annotations:
# Don't use this annotation, but the placeholder $text instead (see below).
backstage.io/definition-at-location: 'url:https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/spotify.com/v1/swagger.yaml'
spec:
type: openapi
lifecycle: production
owner: spotify@example.com
definition:
$text: https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/spotify.com/v1/swagger.yaml
```
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/plugin-proxy-backend': minor
---
Limit the http headers that are forwarded from the request to a safe set of defaults.
A user can configure additional headers that should be forwarded if the specific applications needs that.
```yaml
proxy:
'/my-api':
target: 'https://my-api.com/get'
allowedHeaders:
# We need to forward the Authorization header that was provided by the caller
- Authorization
```
+20
View File
@@ -0,0 +1,20 @@
---
'example-app': minor
'@backstage/core': minor
'@backstage/create-app': minor
'@backstage/plugin-catalog': minor
'@backstage/plugin-github-actions': minor
'@backstage/plugin-jenkins': minor
'@backstage/plugin-lighthouse': minor
---
The InfoCard variant `'height100'` is deprecated. Use variant `'gridItem'` instead.
When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.
Set to the `'gridItem'` variant to display the InfoCard with full height suitable for Grid:
`<InfoCard variant="gridItem">...</InfoCard>`
Changed the InfoCards in '@backstage/plugin-github-actions', '@backstage/plugin-jenkins', '@backstage/plugin-lighthouse'
to pass an optional variant to the corresponding card of the plugin.
As a result the overview content of the EntityPage shows cards with full height suitable for Grid.
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/plugin-catalog-backend': minor
---
The way that wiring together a catalog happens, has changed drastically. Now
there is a new class `CatalogBuilder` that does almost all of the heavy lifting
of how to augment/replace pieces of catalog functionality, such as adding
support for custom entities or adding additional processors.
As the builder was added, a lot of the static methods and builders for default
setups have been removed from classes deep in the hierarchy. Instead, the
builder contains the knowledge of what the defaults are.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': minor
---
Add the ability to import components from Bitbucket Server to the service catalog
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/plugin-catalog-backend': minor
---
Filters passed to the `/entities` endpoint of the catalog has changed format.
The old way was to pass things on the form `?a=b&c=d`; the new way is to pass
things on the form `?filter=a=b,c=d`. See discussion in
[#2910](https://github.com/spotify/backstage/issues/2910) for details.
The comma separated items within a single filter have an AND between them. If
multiple such filters are passed, they have an OR between those item groups.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fix `CatalogBuilder#addProcessor`.
+5
View File
@@ -0,0 +1,5 @@
---
'example-app': patch
---
Add Pull Request tab to components view.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Add client side paging for catalog table
+13
View File
@@ -0,0 +1,13 @@
---
'@backstage/plugin-catalog-backend': minor
---
- The `CatalogProcessor` API was updated to have `preProcessEntity` and
`postProcessEntity` methods, instead of just one `processEntity`. This makes
it easier to make processors that have several stages in one, and to make
different processors more position independent in the list of processors.
- The `EntityPolicy` is now given directly to the `LocationReaders`, instead of
being enforced inside a policy. We have decided to separate out the act of
validating an entity to be outside of the processing flow, to make it
possible to apply more liberally and to evolve it as a separate concept.
- Because of the above, the `EntityPolicyProcessor` has been removed.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Added .fromConfig static factories for Preparers and Publishers + read integrations config to support url location types
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
export test utilities for mocking context
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/cli': minor
---
Adds a new `BACKSTAGE_CLI_BUILD_PARELLEL` environment variable to control
parallelism for some build steps.
This is useful in CI to help avoid out of memory issues when using `terser`. The
`BACKSTAGE_CLI_BUILD_PARELLEL` environment variable can be set to
`true | false | [integer]` to override the default behaviour. See
[terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin#parallel)
for more details.
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': minor
---
Use the new `UrlReader` in the `CodeOwnersProcessor`.
+1 -49
View File
@@ -2,55 +2,7 @@
"$schema": "https://unpkg.com/@changesets/config@1.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [
[
"example-app",
"@backstage/backend-common",
"example-backend",
"@backstage/catalog-model",
"@backstage/cli-common",
"@backstage/cli",
"@backstage/config-loader",
"@backstage/config",
"@backstage/core-api",
"@backstage/core",
"@backstage/create-app",
"@backstage/dev-utils",
"docgen",
"e2e-test",
"storybook",
"@techdocs/cli",
"@backstage/test-utils-core",
"@backstage/test-utils",
"@backstage/theme",
"@backstage/plugin-api-docs",
"@backstage/plugin-app-backend",
"@backstage/plugin-auth-backend",
"@backstage/plugin-catalog-backend",
"@backstage/plugin-catalog",
"@backstage/plugin-circleci",
"@backstage/plugin-gcp-projects",
"@backstage/plugin-github-actions",
"@backstage/plugin-gitops-profiles",
"@backstage/plugin-graphiql",
"@backstage/plugin-graphql-backend",
"@backstage/plugin-jenkins",
"@backstage/plugin-lighthouse",
"@backstage/plugin-newrelic",
"@backstage/plugin-proxy-backend",
"@backstage/plugin-register-component",
"@backstage/plugin-rollbar-backend",
"@backstage/plugin-rollbar",
"@backstage/plugin-scaffolder-backend",
"@backstage/plugin-scaffolder",
"@backstage/plugin-sentry-backend",
"@backstage/plugin-sentry",
"@backstage/plugin-tech-radar",
"@backstage/plugin-techdocs-backend",
"@backstage/plugin-techdocs",
"@backstage/plugin-welcome"
]
],
"linked": [["*"]],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': minor
---
Added getLastCompleteBillingDate to the CostInsightsApi to reason about completeness of billing data
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
prefer named exports
+5
View File
@@ -0,0 +1,5 @@
---
'example-backend': patch
---
Pass GitHub token into Scaffolder GitHub Preparer
+21
View File
@@ -0,0 +1,21 @@
---
'@backstage/backend-common': minor
'@backstage/cli': minor
'@backstage/config-loader': minor
'example-backend': patch
'@backstage/create-app': patch
---
**BREAKING CHANGE**
The existing loading of additional config files like `app-config.development.yaml` using APP_ENV or NODE_ENV has been removed.
Instead, the CLI and backend process now accept one or more `--config` flags to load config files.
Without passing any flags, `app-config.yaml` and, if it exists, `app-config.local.yaml` will be loaded.
If passing any `--config <path>` flags, only those files will be loaded, **NOT** the default `app-config.yaml` one.
The old behaviour of for example `APP_ENV=development` can be replicated using the following flags:
```bash
--config ../../app-config.yaml --config ../../app-config.development.yaml
```
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
handle the case where no entities are available to show
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
Add forwardRef to the SidebarItem
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/core': patch
'@backstage/plugin-graphiql': patch
'@backstage/plugin-tech-radar': patch
'@backstage/plugin-techdocs': patch
---
add test case for Progress component
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
fix the accordion details design when job stage fail
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
fix the warning of all the core components test cases
+5
View File
@@ -0,0 +1,5 @@
---
'e2e-test': minor
---
Converted into a CLI, use `yarn e2e-test run` to run
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': minor
---
Enable custom alert types in Cost Insights
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fix CodeOwnersProcessor to handle non team users
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Allow templates to be located on non-default branch
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
Update ItemCard headers to pass color contrast standards.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
rename stories folder top Chip
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Remove "in default" in component name
+57
View File
@@ -0,0 +1,57 @@
---
'@backstage/plugin-techdocs-backend': minor
'@backstage/create-app': patch
---
Updated naming of environment variables. New pattern [NAME]\_TOKEN for Github, Gitlab, Azure & Github enterprise access tokens.
### Detail:
- Previously we have to export same token for both, catalog & scaffolder
```bash
export GITHUB_ACCESS_TOKEN=foo
export GITHUB_PRIVATE_TOKEN=foo
```
with latest changes, only single export is sufficient.
```bash
export GITHUB_TOKEN=foo
export GITLAB_TOKEN=foo
export GHE_TOKEN=foo
export AZURE_TOKEN=foo
```
### list:
<table>
<tr>
<th>Old name</th>
<th>New name</th>
</tr>
<tr>
<td>GITHUB_ACCESS_TOKEN</td>
<td>GITHUB_TOKEN</td>
</tr>
<tr>
<td>GITHUB_PRIVATE_TOKEN</td>
<td>GITHUB_TOKEN</td>
</tr>
<tr>
<td>GITLAB_ACCESS_TOKEN</td>
<td>GITLAB_TOKEN</td>
</tr>
<tr>
<td>GITLAB_PRIVATE_TOKEN</td>
<td>GITLAB_TOKEN</td>
</tr>
<tr>
<td>AZURE_PRIVATE_TOKEN</td>
<td>AZURE_TOKEN</td>
</tr>
<tr>
<td>GHE_PRIVATE_TOKEN</td>
<td>GHE_TOKEN</td>
</tr>
</table>
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Including source maps with all packages
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
update the test cases of CodeSnippet component
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': minor
---
Removed the parseData step from catalog processors. Locations readers should emit full entities instead.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/create-app': patch
---
Fix for configured templates using 'url' locations even though it's not supported yet
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/backend-common': minor
'@backstage/cli': minor
---
Use APP_ENV before NODE_ENV for determining what config to load
+25
View File
@@ -0,0 +1,25 @@
---
'@backstage/plugin-newrelic': minor
---
The New Relic plugin now uses the Backstage proxy to communicate with New Relic's API.
Please update your `app-config.yaml` as follows:
```yaml
# Old Config
newrelic:
api:
baseUrl: 'https://api.newrelic.com/v2'
key: NEW_RELIC_REST_API_KEY
```
```yaml
# New Config
proxy:
'/newrelic/apm/api':
target: https://api.newrelic.com/v2
headers:
X-Api-Key:
$env: NEW_RELIC_REST_API_KEY
```
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
add test cases for Status components
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-backend': patch
---
Replacing the hard coded `baseApiUrl` by reading the value from configuration to enable private GitHub setup for TechDocs.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': minor
---
Removed support for deprecated `catalog.providers` config that have been moved to `integrations`
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
update ItemCard component and it's story
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/catalog-model': minor
---
Enable adding locations for config files that does not yet exist by adding a flag to api request
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Add authentication token to Scaffolder GitHub Preparer
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Fixed duplicate help output, and print help on invalid command
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-catalog-backend': minor
---
Renamed the `LocationProcessor` class to `CatalogProcessor`.
Likewise, renamed `LocationProcessorResult`, `LocationProcessorLocationResult`,
`LocationProcessorDataResult`, `LocationProcessorEntityResult`,
`LocationProcessorErrorResult`, and `LocationProcessorEmit` to their `Catalog*`
counterparts.
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-cost-insights': minor
---
- getProjectDailyCost and getGroupDailyCost no longer accept a metric as a parameter
- getDailyMetricData added to API for fetching daily metric data for given interval
- dailyCost removed as configurable metric
- default field added to metric configuration for displaying comparison metric data in top panel
- Metric.kind can no longer be null
- MetricData type added
@@ -0,0 +1,6 @@
---
'@backstage/plugin-catalog-backend': minor
---
Remove the `read` argument of `LocationProcessor.processEntity`.
Instead, pass the `UrlReader` into the constructor of your `LocationProcessor`.
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-scaffolder-backend': patch
---
The new `scaffolder.github.baseUrl` config property allows to specify a custom base url for GitHub enterprise instances
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': minor
---
Remove product filters from query parameters
+9
View File
@@ -0,0 +1,9 @@
---
'example-app': patch
'@backstage/core-api': patch
'@backstage/plugin-cost-insights': patch
---
Remove cost insights example client from demo app and export from plugin
Create cost insights dev plugin using example client
Make PluginConfig and dependent types public
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
update the EntityNotFound component
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-tech-radar': patch
---
fix the horizontal scrolling issue in the RadarPage component
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
make ErrorPage responsive + fix the test case
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Added support for configuring the working directory of the Scaffolder:
```yaml
backend:
workingDirectory: /some-dir # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir
```
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
Better presentation of authentication errors
+5
View File
@@ -0,0 +1,5 @@
---
'example-app': patch
---
cleaning up because external plugins have already implemented new api for creating
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
give aria-label attribute to Status Ok, Warning and Error
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core': patch
---
fix the responsive of page story
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/backend-common': minor
'example-backend': patch
'@backstage/cli': patch
'@backstage/create-app': patch
---
Change loadBackendConfig to return the config directly
+1
View File
@@ -14,3 +14,4 @@
/packages/techdocs-container @spotify/techdocs-core
/.github/workflows/techdocs.yml @spotify/techdocs-core
/.github/workflows/techdocs-pypi.yml @spotify/techdocs-core
/.changeset/cost-insights-* @spotify/silver-lining
+4 -6
View File
@@ -5,11 +5,9 @@
#### :heavy_check_mark: Checklist
<!--- Put an `x` in all the boxes that apply: -->
<!--- Please include the following in your Pull Request when applicable: -->
- [ ] All tests are passing `yarn test`
- [ ] A changeset describing the change and affected packages. ([more info](https://github.com/spotify/backstage/blob/master/CONTRIBUTING.md#creating-changesets))
- [ ] Added or updated documentation
- [ ] Tests for new functionality and regression tests for bug fixes
- [ ] Screenshots attached (for UI changes)
- [ ] Relevant documentation updated
- [ ] Prettier run on changed files
- [ ] Tests added for new functionality
- [ ] Regression tests added for bug fixes
+1
View File
@@ -6,6 +6,7 @@ coverage:
default:
threshold: 0% # Ref: https://docs.codecov.io/docs/codecovyml-reference#coveragestatus
target: auto
informational: true # Don't block PRs
# Since Backstage is a mono repo, flags here help in getting the code coverage of individual packages.
# Documentation: https://docs.codecov.io/docs/flags
+6
View File
@@ -68,6 +68,7 @@ graphviz
Hackathons
haproxy
heroku
Heroku
horizontalpodautoscalers
Hostname
http
@@ -105,6 +106,7 @@ Monorepo
monorepos
msw
namespace
namespaces
Namespaces
neuro
newrelic
@@ -141,6 +143,7 @@ Raghunandan
rankdir
readme
Readme
Recharts
Redash
replicasets
repo
@@ -195,6 +198,7 @@ validators
Voi
Wealthsimple
Weaveworks
Webpack
xyz
yaml
Zalando
@@ -204,3 +208,5 @@ cloudbuild
Grafana
Iain
Snyk
www
WWW
+1 -1
View File
@@ -97,7 +97,7 @@ jobs:
if: ${{ steps.yarn-lock.outcome == 'failure' }}
run: |
yarn lerna -- run test -- --coverage
bash <(curl -s https://codecov.io/bash)
bash <(curl -s https://codecov.io/bash) -N $(git rev-parse FETCH_HEAD)
- name: verify plugin template
run: yarn lerna -- run diff -- --check
+1 -1
View File
@@ -40,4 +40,4 @@ jobs:
- name: yarn build
run: yarn build --ignore example-app --ignore example-backend --ignore @techdocs/cli
- name: run E2E test
run: yarn workspace e2e-test start
run: yarn e2e-test run
+1 -1
View File
@@ -70,7 +70,7 @@ jobs:
- name: run E2E test
run: |
sudo sysctl fs.inotify.max_user_watches=524288
yarn workspace e2e-test start
yarn e2e-test run
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
+7 -1
View File
@@ -1,5 +1,11 @@
.idea/
# macOS
.DS_Store
# IntelliJ
.idea/
*.iml
# Visual Studio Code
.vscode/
.vsls.json
+1
View File
@@ -6,3 +6,4 @@ coverage
templates
plugins/scaffolder-backend/sample-templates
.vscode
dist-types
+1
View File
@@ -3,6 +3,7 @@
registry "https://registry.npmjs.org/"
disable-self-update-check true
lastUpdateCheck 1580389148099
yarn-path ".yarn/releases/yarn-1.22.1.js"
network-timeout 600000
+20
View File
@@ -8,6 +8,26 @@ If you encounter issues while upgrading to a newer version, don't hesitate to re
> Collect changes for the next release below
## v0.1.1-alpha.26
### @backstage/cli
- Configuration files are no longer selected through `APP_ENV` or `NODE_ENV`. The default configuration files are `app-config.yaml` and, fix it exists, `app-config.local.yaml` in the repo root. To load a different set of files, use `--config <path>` arguments.
### @backstage/backend-common
- Configuration files are no longer selected through `APP_ENV` or `NODE_ENV`. The default configuration files are `app-config.yaml` and, fix it exists, `app-config.local.yaml` in the repo root. To load a different set of files, use `--config <path>` arguments.
## v0.1.1-alpha.25
### @backstage/cli
- The recommended way to set the configuration environment is now to use `APP_ENV` instead of `NODE_ENV`.
### Backend (example-backend, or backends created with @backstage/create-app)
- A plugin database manager has been created, and plugins can now accept that interface as an argument during initialisation. Notably, the `auth` plugin has a [`createRouter` signature change](./plugins/auth-backend/src/service/router.ts). See [packages/backend/src/index.ts](./packages/backend/src/index.ts) on how to set it up. [#2697](https://github.com/spotify/backstage/pull/2697)
## v0.1.1-alpha.24
### Backend (example-backend, or backends created with @backstage/create-app)
+1 -1
View File
@@ -87,7 +87,7 @@ We use [changesets](https://github.com/atlassian/changesets) to help us prepare
1. Run `yarn changeset`
2. Select which packages you want to include a changeset for
3. Select impact of change that you're introducing (minor, major or patch)
4. Add generated changset to Git
4. Add generated changeset to Git
5. Push the commit with your changeset to the branch associated with your PR
6. Accept our gratitude for making the release process easier on the maintainer
-27
View File
@@ -1,27 +0,0 @@
# Deploying Backstage
## Heroku
Deploying to heroku is relatively easy following these steps.
First, make sure you have the [heroku CLI installed](https://devcenter.heroku.com/articles/heroku-cli) and log into it as well as login into Heroku's [container registry](https://devcenter.heroku.com/articles/container-registry-and-runtime).
```bash
$ heroku login
$ heroku container:login
```
You _might_ also need to set your Heroku app's stack to `container`
```bash
$ heroku stack:set container -a <your-app>
```
We can now build/push the Docker image to Heroku's container registry and release it to the `web` worker.
```bash
$ heroku container:push web -a <your-app>
$ heroku container:release web -a <your-app>
```
With that, you should have Backstage up and running!
+4 -5
View File
@@ -3,7 +3,8 @@
# [Backstage](https://backstage.io)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![](https://github.com/spotify/backstage/workflows/Frontend%20CI/badge.svg)
[![CNCF Status](https://img.shields.io/badge/cncf%20status-sandbox-blue.svg)](https://www.cncf.io/projects)
[![Main CI Build](https://github.com/spotify/backstage/workflows/Main%20Master%20Build/badge.svg)](https://github.com/spotify/backstage/actions?query=workflow%3A%22Main+Master+Build%22)
[![Discord](https://img.shields.io/discord/687207715902193673)](https://discord.gg/EBHEGzX)
![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)
[![Codecov](https://img.shields.io/codecov/c/github/spotify/backstage)](https://codecov.io/gh/spotify/backstage)
@@ -24,9 +25,7 @@ Out of the box, Backstage includes:
- [Backstage TechDocs](https://backstage.io/docs/features/techdocs/techdocs-overview) for making it easy to create, maintain, find, and use technical documentation, using a "docs like code" approach
- Plus, a growing ecosystem of [open source plugins](https://github.com/spotify/backstage/tree/master/plugins) that further expand Backstages customizability and functionality
For more information go to [backstage.io](https://backstage.io) or join our [Discord chatroom](https://discord.gg/EBHEGzX).
🎉 Backstage is a CNCF Sandbox project. Read the announcement [here](https://backstage.io/blog/2020/09/23/backstage-cncf-sandbox).
Backstage was created by Spotify but is now hosted by the [Cloud Native Computing Foundation (CNCF)](https://www.cncf.io) as a Sandbox level project. Read the announcement [here](https://backstage.io/blog/2020/09/23/backstage-cncf-sandbox).
## Project roadmap
@@ -58,6 +57,6 @@ Check out [the documentation](https://backstage.io/docs/getting-started) on how
## License
Copyright 2020 Spotify AB.
Copyright 2020 © Backstage Project Authors. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page: https://www.linuxfoundation.org/trademark-usage
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
-13
View File
@@ -1,13 +0,0 @@
app:
baseUrl: http://localhost:3000
backend:
baseUrl: http://localhost:7000
listen:
port: 7000
cors:
origin: http://localhost:3000
methods: [GET, POST, PUT, DELETE]
credentials: true
csp:
connect-src: ["'self'", 'http:', 'https:']
+37 -24
View File
@@ -1,6 +1,7 @@
app:
title: Backstage Example App
baseUrl: http://localhost:7000
baseUrl: http://localhost:3000
googleAnalyticsTrackingId: # UA-000000-0
backend:
baseUrl: http://localhost:7000
@@ -9,8 +10,13 @@ backend:
database:
client: sqlite3
connection: ':memory:'
cors:
origin: http://localhost:3000
methods: [GET, POST, PUT, DELETE]
credentials: true
csp:
connect-src: ["'self'", 'https:']
connect-src: ["'self'", 'http:', 'https:']
# workingDirectory: /tmp # Use this to configure a working direcotry for the scaffolder, defaults to the OS temp-dir
# See README.md in the proxy-backend plugin for information on the configuration format
proxy:
@@ -34,8 +40,14 @@ proxy:
$env: TRAVISCI_AUTH_TOKEN
travis-api-version: 3
'/newrelic/apm/api':
target: https://api.newrelic.com/v2
headers:
X-Api-Key:
$env: NEW_RELIC_REST_API_KEY
organization:
name: Spotify
name: My Company
techdocs:
storageUrl: http://localhost:7000/api/techdocs/static/docs
@@ -44,44 +56,41 @@ techdocs:
techdocs: 'docker'
sentry:
organization: spotify
organization: my-company
rollbar:
organization: spotify
organization: my-company
accountToken:
$env: ROLLBAR_ACCOUNT_TOKEN
newrelic:
api:
baseUrl: 'https://api.newrelic.com/v2'
key: NEW_RELIC_REST_API_KEY
lighthouse:
baseUrl: http://localhost:3003
kubernetes:
clusterLocatorMethod: 'configMultiTenant'
serviceLocatorMethod: 'multiTenant'
clusterLocatorMethods:
- 'config'
clusters: []
integrations:
github:
- host: github.com
token:
$env: GITHUB_PRIVATE_TOKEN
$env: GITHUB_TOKEN
### Example for how to add your GitHub Enterprise instance using the API:
# - host: ghe.example.net
# apiBaseUrl: https://ghe.example.net/api/v3
# token:
# $env: GHE_PRIVATE_TOKEN
# $env: GHE_TOKEN
### Example for how to add your GitHub Enterprise instance using raw HTTP fetches (token is optional):
# - host: ghe.example.net
# rawBaseUrl: https://ghe.example.net/raw
# token:
# $env: GHE_PRIVATE_TOKEN
# $env: GHE_TOKEN
gitlab:
- host: gitlab.com
token:
$env: GITLAB_PRIVATE_TOKEN
$env: GITLAB_TOKEN
bitbucket:
- host: bitbucket.org
username:
@@ -91,7 +100,7 @@ integrations:
azure:
- host: dev.azure.com
token:
$env: AZURE_PRIVATE_TOKEN
$env: AZURE_TOKEN
catalog:
rules:
@@ -102,12 +111,12 @@ catalog:
providers:
- target: https://github.com
token:
$env: GITHUB_PRIVATE_TOKEN
$env: GITHUB_TOKEN
#### Example for how to add your GitHub Enterprise instance using the API:
# - target: https://ghe.example.net
# apiBaseUrl: https://ghe.example.net/api/v3
# token:
# $env: GHE_PRIVATE_TOKEN
# $env: GHE_TOKEN
ldapOrg:
### Example for how to add your enterprise LDAP server
# providers:
@@ -142,22 +151,25 @@ catalog:
# Backstage example templates
- type: url
target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml
# Backstage example groups and users
- type: url
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
scaffolder:
github:
token:
$env: GITHUB_ACCESS_TOKEN
$env: GITHUB_TOKEN
visibility: public # or 'internal' or 'private'
gitlab:
api:
baseUrl: https://gitlab.com
token:
$env: GITLAB_ACCESS_TOKEN
$env: GITLAB_TOKEN
azure:
baseUrl: https://dev.azure.com/{your-organization}
api:
token:
$env: AZURE_PRIVATE_TOKEN
$env: AZURE_TOKEN
auth:
providers:
@@ -236,10 +248,11 @@ costInsights:
name: Big Query
icon: search
metrics:
dailyCost:
name: Your Company's Daily Cost
DAU:
name: Cost Per DAU
name: Daily Active Users
default: true
MSC:
name: Monthly Subscribers
homepage:
clocks:
- label: UTC
+1
View File
@@ -7,6 +7,7 @@ metadata:
annotations:
github.com/project-slug: spotify/backstage
backstage.io/techdocs-ref: github:https://github.com/spotify/backstage.git
lighthouse.com/website-url: https://backstage.io
spec:
type: library
owner: Spotify
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 9.4.1
digest: sha256:f949ec0fe7d146610ce2ee78fbfb4e52d235883a797968b0a1e61aa88ada2786
generated: "2020-09-25T08:59:54.255582519+02:00"
+30
View File
@@ -0,0 +1,30 @@
apiVersion: v2
name: backstage
description: A Helm chart for Spotify Backstage
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v0.1.1-alpha.23
sources:
- https://github.com/spotify/backstage
- https://github.com/spotify/lighthouse-audit-service
dependencies:
- name: postgresql
condition: postgresql.enabled
version: 9.4.1
repository: https://charts.bitnami.com/bitnami
maintainers:
- name: Martina Iglesias Fernández
email: martina@roadie.io
url: https://roadie.io
- name: David Tuite
email: david@roadie.io
url: https://roadie.io
+235
View File
@@ -0,0 +1,235 @@
# Backstage demo helm charts
This folder contains Helm charts that can easily create a Kubernetes deployment of a demo Backstage app.
### Pre-requisites
These charts depend on the `nginx-ingress` controller being present in the cluster. If it's not already installed you
can run:
```
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install nginx-ingress ingress-nginx/ingress-nginx
```
### Installing the charts
After choosing a DNS name where backstage will be hosted create a yaml file for your custom configuration.
```
appConfig:
app:
baseUrl: https://backstage.mydomain.com
title: Backstage
backend:
baseUrl: https://backstage.mydomain.com
cors:
origin: https://backstage.mydomain.com
lighthouse:
baseUrl: https://backstage.mydomain.com/lighthouse-api
techdocs:
storageUrl: https://backstage.mydomain.com/api/techdocs/static/docs
requestUrl: https://backstage.mydomain.com/api/techdocs
```
Then use it to run:
```
git clone https://github.com/spotify/backstage.git
cd contrib/chart/backstage
helm dependency update
helm install -f backstage-mydomain.yaml backstage .
```
This command will deploy the following pieces:
- Backstage frontend
- Backstage backend with scaffolder and auth plugins
- (optional) a PostgreSQL instance
- lighthouse plugin
- ingress
After a few minutes Backstage should be up and running in your cluster under the DNS specified earlier.
Make sure to create the appropriate DNS entry in your infrastructure. To find the public IP address run:
```bash
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
backstage-ingress * 123.1.2.3 80 17m
```
> **NOTE**: this is not a production ready deployment.
## Customization
### Issue certificates
These charts can install or reuse a `clusterIssuer` to generate certificates for the backstage `ingress`. To do that:
1. [Install][install-cert-manager] or make sure [cert-manager][cert-manager] is installed in the cluster.
2. Enable the issuer in the charts. This will first check if there is a `letsencrypt` issuer already deployed in your
cluster and deploy one if it doesn't exist.
To enable it you need to provide a valid email address in the chart's values:
```
issuer:
email: me@example.com
clusterIssuer: "letsencrypt-prod"
```
By default, the charts use `letsencrypt-staging` so in the above example we instruct helm to use the production issuer
instead.
[cert-manager]: https://cert-manager.io/docs/
[install-cert-manager]: https://cert-manager.io/docs/installation/kubernetes/#installing-with-helm
### Custom PostgreSQL instance
Configuring a connection to an existing PostgreSQL instance is possible through the chart's values.
First create a yaml file with the configuration you want to override, for example `backstage-prod.yaml`:
```bash
postgresql:
enabled: false
appConfig:
app:
baseUrl: https://backstage-demo.mydomain.com
title: Backstage
backend:
baseUrl: https://backstage-demo.mydomain.com
cors:
origin: https://backstage-demo.mydomain.com
database:
client: pg
connection:
database: backstage_plugin_catalog
host: <host>
user: <pg user>
password: <password>
lighthouse:
baseUrl: https://backstage-demo.mydomain.com/lighthouse-api
lighthouse:
database:
client: pg
connection:
host: <host>
user: <pg user>
password: <password>
database: lighthouse_audit_service
```
For the CA, create a `configMap` named `<helm_release_name>-postgres-ca` with a file called `ca.crt`:
```
kubectl create configmap my-backstage --from-file=ca.crt"
```
Now install the helm chart:
```
cd contrib/chart/backstage
helm install -f backstage-prod.yaml my-backstage .
```
### Use your own docker images
The docker images used for the deployment can be configured through the charts values:
```
frontend:
image:
repository: <image-name>
tag: <image-tag>
backend:
image:
repository: <image-name>
tag: <image-tag>
lighthouse:
image:
repository: <image-name
tag: <image-tag>
```
### Different namespace
To install the charts a specific namespace use `--namespace <ns>`:
```
helm install -f my_values.yaml --namespace demos backstage .
```
### Disable loading of demo data
To deploy backstage with the pre-loaded demo data disable `backend.demoData`:
```
helm install -f my_values.yaml --set backend.demoData=false backstage .
```
### Other options
For more customization options take a look at the [values.yaml](/contrib/chart/backstage/values.yaml) file.
## Troubleshooting
Some resources created by these charts are meant to survive after upgrades and even after uninstalls. When
troubleshooting these charts it can be useful to delete these resources between re-installs.
Secrets:
```
<release-name>-postgresql-certs -- contains the certificates used by the deployed PostgreSQL
```
Persistent volumes:
```
data-<release-name>-postgresql-0 -- this is the data volume used by PostgreSQL to store data and configuration
```
> **NOTE**: this volume also stores the configuration for PostgreSQL which includes things like the password for the
> `postgres` user. This means that uninstalling and re-installing the charts with `postgres.enabled` set to `true` and
> auto generated passwords will fail. The solution is to delete this volume with
> `kubectl delete pvc data-<release-name>-postgresql-0`
ConfigMaps:
```
<release-name>-postgres-ca -- contains the generated CA certificate for PostgreSQL when `postgres` is enabled
```
#### Unable to verify signature
```
Backend failed to start up Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:936:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
```
This error happens in the backend when it tries to connect to the configured PostgreSQL database and the specified CA is not correct. The solution is to make sure that the contents of the `configMap` that holds the certificate match the CA for the PostgreSQL instance. A workaround is to set `appConfig.backend.database.connection.ssl.rejectUnauthorized` to `false` in the chart's values.
<!-- TODO Add example command when we know the final name of the charts -->
## Uninstalling Backstage
To uninstall Backstage simply run:
```
RELEASE_NAME=<release-name> # use `helm list` to find out the name
helm uninstall ${RELEASE_NAME}
kubectl delete pvc data-${RELEASE_NAME}-postgresql-0
kubectl delete secret ${RELEASE_NAME}-postgresql-certs
kubectl delete configMap ${RELEASE_NAME}-postgres-ca
```
@@ -0,0 +1,51 @@
backend:
lighthouseHostname: {{ include "lighthouse.serviceName" . | quote }}
listen:
port: {{ .Values.appConfig.backend.listen.port | default 7000 }}
database:
client: {{ .Values.appConfig.backend.database.client | quote }}
connection:
host: {{ include "backend.postgresql.host" . | quote }}
port: {{ include "backend.postgresql.port" . | quote }}
user: {{ include "backend.postgresql.user" . | quote }}
database: {{ .Values.appConfig.backend.database.connection.database | quote }}
ssl:
rejectUnauthorized: {{ .Values.appConfig.backend.database.connection.ssl.rejectUnauthorized | quote }}
ca: {{ include "backstage.backend.postgresCaFilename" . | quote }}
catalog:
{{- if .Values.backend.demoData }}
locations:
# Backstage example components
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/all-components.yaml
# Example component for github-actions
- type: github
target: https://github.com/spotify/backstage/blob/master/plugins/github-actions/examples/sample.yaml
# Example component for techdocs
- type: github
target: https://github.com/spotify/backstage/blob/master/plugins/techdocs-backend/examples/documented-component/documented-component.yaml
# Backstage example APIs
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/all-apis.yaml
# Backstage example templates
- type: github
target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml
{{- else }}
locations: []
{{- end }}
auth:
providers:
microsoft: null
scaffolder:
azure: null
sentry:
organization: {{ .Values.appConfig.sentry.organization | quote }}
techdocs:
generators:
techdocs: 'local'
@@ -0,0 +1,13 @@
{{ $backendDb := .Values.appConfig.backend.database.connection.database }}
{{ $lighthouseDb := .Values.lighthouse.database.connection.database }}
{{ $user := .Values.global.postgresql.postgresqlUsername }}
grant all privileges on database {{ $backendDb }} to {{ $user }};
create database backstage_plugin_auth;
grant all privileges on database backstage_plugin_auth to {{ $user }};
{{ if not (eq $backendDb $lighthouseDb) }}
create database {{ $lighthouseDb }};
grant all privileges on database {{ $lighthouseDb }} to {{ $user }};
{{ end }}
@@ -0,0 +1,286 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "backstage.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "backstage.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "backstage.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common App labels
*/}}
{{- define "backstage.app.labels" -}}
app.kubernetes.io/name: {{ include "backstage.name" . }}-app
helm.sh/chart: {{ include "backstage.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Common Backend labels
*/}}
{{- define "backstage.backend.labels" -}}
app.kubernetes.io/name: {{ include "backstage.name" . }}-backend
helm.sh/chart: {{ include "backstage.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Name for postgresql dependency
See https://github.com/helm/helm/issues/3920#issuecomment-686913512
*/}}
{{- define "backstage.postgresql.fullname" -}}
{{ printf "%s-%s" .Release.Name .Values.postgresql.nameOverride }}
{{- end -}}
{{/*
Create the name of the service account to use for the app
*/}}
{{- define "backstage.app.serviceAccountName" -}}
{{- if .Values.app.serviceAccount.create -}}
{{ default "default" .Values.app.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.app.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use for the backend
*/}}
{{- define "backstage.backend.serviceAccountName" -}}
{{- if .Values.backend.serviceAccount.create -}}
{{ default default .Values.backend.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.backend.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Path to the CA certificate file in the backend
*/}}
{{- define "backstage.backend.postgresCaFilename" -}}
{{ include "backstage.backend.postgresCaDir" . }}/{{- required "The name for the CA certificate file for postgresql is required" .Values.global.postgresql.caFilename }}
{{- end -}}
{{/*
{{/*
Directory path to the CA certificate file in the backend
*/}}
{{- define "backstage.backend.postgresCaDir" -}}
{{- if .Values.appConfig.backend.database.connection.ssl.ca -}}
{{ .Values.appConfig.backend.database.connection.ssl.ca }}
{{- else -}}
/etc/postgresql
{{- end -}}
{{- end -}}
{{/*
Path to the CA certificate file in lighthouse
*/}}
{{- define "backstage.lighthouse.postgresCaFilename" -}}
{{ include "backstage.lighthouse.postgresCaDir" . }}/{{- required "The name for the CA certificate file for postgresql is required" .Values.global.postgresql.caFilename }}
{{- end -}}
{{/*
Directory path to the CA certificate file in lighthouse
*/}}
{{- define "backstage.lighthouse.postgresCaDir" -}}
{{- if .Values.lighthouse.database.pathToDatabaseCa -}}
{{ .Values.lighthouse.database.pathToDatabaseCa }}
{{- else -}}
/etc/postgresql
{{- end -}}
{{- end -}}
{{/*
{{/*
Generate ca for postgresql
*/}}
{{- define "backstage.postgresql.generateCA" -}}
{{- $ca := .ca | default (genCA (include "backstage.postgresql.fullname" .) 365) -}}
{{- $_ := set . "ca" $ca -}}
{{- $ca.Cert -}}
{{- end -}}
{{/*
Generate certificates for postgresql
*/}}
{{- define "generateCerts" -}}
{{- $postgresName := (include "backstage.postgresql.fullname" .) }}
{{- $altNames := list $postgresName ( printf "%s.%s" $postgresName .Release.Namespace ) ( printf "%s.%s.svc" ( $postgresName ) .Release.Namespace ) -}}
{{- $ca := .ca | default (genCA (include "backstage.postgresql.fullname" .) 365) -}}
{{- $_ := set . "ca" $ca -}}
{{- $cert := genSignedCert ( $postgresName ) nil $altNames 365 $ca -}}
tls.crt: {{ $cert.Cert | b64enc }}
tls.key: {{ $cert.Key | b64enc }}
{{- end -}}
{{/*
Generate a password for the postgres user used for the connections from the backend and lighthouse
*/}}
{{- define "postgresql.generateUserPassword" -}}
{{- $pgPassword := .pgPassword | default ( randAlphaNum 12 ) -}}
{{- $_ := set . "pgPassword" $pgPassword -}}
{{ $pgPassword}}
{{- end -}}
{{/*
Name of the backend service
*/}}
{{- define "backend.serviceName" -}}
{{ include "backstage.fullname" . }}-backend
{{- end -}}
{{/*
Name of the frontend service
*/}}
{{- define "frontend.serviceName" -}}
{{ include "backstage.fullname" . }}-frontend
{{- end -}}
{{/*
Name of the lighthouse backend service
*/}}
{{- define "lighthouse.serviceName" -}}
{{ include "backstage.fullname" . }}-lighthouse
{{- end -}}
{{/*
Name of the postgresql service
*/}}
{{- define "postgresql.serviceName" -}}
{{- include "backstage.postgresql.fullname" . }}
{{- end -}}
{{/*
Postgres host for lighthouse
*/}}
{{- define "lighthouse.postgresql.host" -}}
{{- if .Values.postgresql.enabled }}
{{- include "postgresql.serviceName" . }}
{{- else -}}
{{- required "A valid .Values.lighthouse.database.connection.host is required when postgresql is not enabled" .Values.lighthouse.database.connection.host -}}
{{- end -}}
{{- end -}}
{{/*
Postgres host for the backend
*/}}
{{- define "backend.postgresql.host" -}}
{{- if .Values.postgresql.enabled }}
{{- include "postgresql.serviceName" . }}
{{- else -}}
{{- required "A valid .Values.appConfig.backend.database.connection.host is required when postgresql is not enabled" .Values.appConfig.backend.database.connection.host -}}
{{- end -}}
{{- end -}}
{{/*
Postgres port for the backend
*/}}
{{- define "backend.postgresql.port" -}}
{{- if .Values.postgresql.enabled }}
{{- .Values.postgresql.service.port }}
{{- else if .Values.appConfig.backend.database.connection.port -}}
{{- .Values.appConfig.backend.database.connection.port }}
{{ else }}
5432
{{- end -}}
{{- end -}}
{{/*
Postgres port for lighthouse
*/}}
{{- define "lighthouse.postgresql.port" -}}
{{- if .Values.postgresql.enabled }}
{{- .Values.postgresql.service.port }}
{{- else if .Values.lighthouse.database.connection.port -}}
{{- .Values.lighthouse.database.connection.port }}
{{- else -}}
5432
{{- end -}}
{{- end -}}
{{/*
Postgres user for backend
*/}}
{{- define "backend.postgresql.user" -}}
{{- if .Values.postgresql.enabled }}
{{- .Values.global.postgresql.postgresqlUsername }}
{{- else -}}
{{- required "A valid .Values.appConfig.backend.database.connection.user is required when postgresql is not enabled" .Values.appConfig.backend.database.connection.user -}}
{{- end -}}
{{- end -}}
{{/*
Postgres user for lighthouse
*/}}
{{- define "lighthouse.postgresql.user" -}}
{{- if .Values.postgresql.enabled }}
{{- .Values.global.postgresql.postgresqlUsername }}
{{- else -}}
{{- required "A valid .Values.lighthouse.database.connection.user is required when postgresql is not enabled" .Values.lighthouse.database.connection.user -}}
{{- end -}}
{{- end -}}
{{/*
Postgres password secret for backend
*/}}
{{- define "backend.postgresql.passwordSecret" -}}
{{- if .Values.postgresql.enabled }}
{{- template "backstage.postgresql.fullname" . }}
{{- else -}}
{{ $secretName := (printf "%s-backend-postgres" (include "backstage.fullname" . )) }}
{{- required "A valid .Values.appConfig.backend.database.connection.password is required when postgresql is not enabled" $secretName -}}
{{- end -}}
{{- end -}}
{{/*
Postgres password for lighthouse
*/}}
{{- define "lighthouse.postgresql.passwordSecret" -}}
{{- if .Values.postgresql.enabled }}
{{- template "backstage.postgresql.fullname" . }}
{{- else -}}
{{ $secretName := (printf "%s-lighthouse-postgres" (include "backstage.fullname" . )) }}
{{- required "A valid .Values.lighthouse.database.connection.password is required when postgresql is not enabled" $secretName -}}
{{- end -}}
{{- end -}}
{{/*
app-config file name
*/}}
{{- define "backstage.appConfigFilename" -}}
{{- "app-config.development.yaml" -}}
{{- end -}}
@@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "backstage.fullname" . }}-backend
spec:
replicas: {{ .Values.backend.replicaCount }}
selector:
matchLabels:
app: backstage
component: backend
template:
metadata:
annotations:
ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"backend"}]'
labels:
app: backstage
component: backend
spec:
containers:
- name: {{ .Chart.Name }}-backend
image: {{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
ports:
- containerPort: {{ .Values.backend.containerPort }}
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
envFrom:
- secretRef:
name: {{ include "backstage.fullname" . }}-backend
- configMapRef:
name: {{ include "backstage.fullname" . }}-app-env
- configMapRef:
name: {{ include "backstage.fullname" . }}-auth
env:
- name: NODE_ENV
value: {{ .Values.backend.nodeEnv | default "development" }}
- name: APP_CONFIG_backend_database_connection_password
valueFrom:
secretKeyRef:
name: {{ include "backend.postgresql.passwordSecret" .}}
key: postgresql-password
volumeMounts:
- name: postgres-ca
mountPath: {{ include "backstage.backend.postgresCaDir" . }}
- name: app-config
mountPath: {{ printf "/usr/src/app/%s" (include "backstage.appConfigFilename" .) }}
subPath: {{ include "backstage.appConfigFilename" . }}
volumes:
- name: postgres-ca
configMap:
name: {{ include "backstage.fullname" . }}-postgres-ca
- name: app-config
configMap:
name: {{ include "backstage.fullname" . }}-app-config
{{- if .Values.backend.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "backend.serviceName" . }}
spec:
ports:
- port: 80
targetPort: {{ .Values.backend.containerPort }}
selector:
app: backstage
component: backend
type: ClusterIP
{{- end }}
@@ -0,0 +1,23 @@
{{- if .Values.backend.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "backstage.fullname" . }}-backend
type: Opaque
stringData:
AUTH_GOOGLE_CLIENT_SECRET: {{ .Values.auth.google.clientSecret }}
AUTH_GITHUB_CLIENT_SECRET: {{ .Values.auth.github.clientSecret }}
AUTH_GITLAB_CLIENT_SECRET: {{ .Values.auth.gitlab.clientSecret }}
AUTH_OKTA_CLIENT_SECRET: {{ .Values.auth.okta.clientSecret }}
AUTH_OAUTH2_CLIENT_SECRET: {{ .Values.auth.oauth2.clientSecret }}
AUTH_AUTH0_CLIENT_SECRET: {{ .Values.auth.auth0.clientSecret }}
AUTH_MICROSOFT_CLIENT_SECRET: {{ .Values.auth.microsoft.clientSecret }}
SENTRY_TOKEN: {{ .Values.auth.sentryToken }}
ROLLBAR_ACCOUNT_TOKEN: {{ .Values.auth.rollbarAccountToken }}
CIRCLECI_AUTH_TOKEN: {{ .Values.auth.circleciAuthToken }}
GITHUB_TOKEN: {{ .Values.auth.githubToken }}
GITLAB_TOKEN: {{ .Values.auth.gitlabToken }}
AZURE_TOKEN: {{ .Values.auth.azure.api.token }}
NEW_RELIC_REST_API_KEY: {{ .Values.auth.newRelicRestApiKey }}
TRAVISCI_AUTH_TOKEN: {{ .Values.auth.travisciAuthToken }}
{{- end }}
@@ -0,0 +1,28 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backstage.fullname" . }}-app-config
data:
{{ include "backstage.appConfigFilename" . | indent 2 }}: |
{{ tpl (.Files.Get "files/app-config.development.yaml.tpl") . | indent 4 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backstage.fullname" . }}-app-env
data:
APP_CONFIG_app_baseUrl: {{ .Values.appConfig.app.baseUrl | quote | quote }}
APP_CONFIG_app_title: {{ .Values.appConfig.app.title | quote | quote }}
APP_CONFIG_app_googleAnalyticsTrackingId: {{ .Values.appConfig.app.googleAnalyticsTrackingId | quote | quote }}
APP_CONFIG_backend_baseUrl: {{ .Values.appConfig.backend.baseUrl | quote | quote }}
APP_CONFIG_backend_cors_origin: {{ .Values.appConfig.backend.cors.origin | quote | quote }}
APP_CONFIG_techdocs_storageUrl: {{ .Values.appConfig.techdocs.storageUrl | quote | quote }}
APP_CONFIG_techdocs_requestUrl: {{ .Values.appConfig.techdocs.requestUrl | quote | quote }}
APP_CONFIG_lighthouse_baseUrl: {{ .Values.appConfig.lighthouse.baseUrl | quote | quote }}
APP_CONFIG_backend_database_connection_ssl_rejectUnauthorized: "false"
APP_CONFIG_auth_providers_github_development_appOrigin: {{ .Values.appConfig.auth.providers.github.development.appOrigin | quote | quote }}
APP_CONFIG_auth_providers_google_development_appOrigin: {{ .Values.appConfig.auth.providers.google.development.appOrigin | quote | quote }}
APP_CONFIG_auth_providers_gitlab_development_appOrigin: {{ .Values.appConfig.auth.providers.gitlab.development.appOrigin | quote | quote }}
APP_CONFIG_auth_providers_okta_development_appOrigin: {{ .Values.appConfig.auth.providers.okta.development.appOrigin | quote | quote }}
APP_CONFIG_auth_providers_oauth2_development_appOrigin: {{ .Values.appConfig.auth.providers.oauth2.development.appOrigin | quote | quote }}
@@ -0,0 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backstage.fullname" . }}-auth
data:
AUTH_GOOGLE_CLIENT_ID: {{ .Values.auth.google.clientId }}
AUTH_GITHUB_CLIENT_ID: {{ .Values.auth.github.clientId }}
AUTH_GITLAB_CLIENT_ID: {{ .Values.auth.gitlab.clientId }}
# This should not be prefixed with AUTH_. This could be a typo in the Backstage app config.
# Regardless, it is not decided by me.
GITLAB_BASE_URL: {{ .Values.auth.gitlab.baseUrl }}
AUTH_OKTA_CLIENT_ID: {{ .Values.auth.okta.clientId }}
AUTH_OKTA_AUDIENCE: {{ .Values.auth.okta.audience }}
AUTH_OAUTH2_CLIENT_ID: {{ .Values.auth.oauth2.clientId }}
AUTH_OAUTH2_AUTH_URL: {{ .Values.auth.oauth2.authUrl }}
AUTH_OAUTH2_TOKEN_URL: {{ .Values.auth.oauth2.tokenUrl }}
AUTH_AUTH0_CLIENT_ID: {{ .Values.auth.auth0.clientId }}
AUTH_AUTH0_DOMAIN: {{ .Values.auth.auth0.domain }}
AUTH_MICROSOFT_CLIENT_ID: {{ .Values.auth.microsoft.clientId }}
AUTH_MICROSOFT_TENANT_ID: {{ .Values.auth.microsoft.tenantId }}
@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "backstage.fullname" . }}-frontend
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app: backstage
component: frontend
template:
metadata:
annotations:
ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"frontend"}]'
labels:
app: backstage
component: frontend
spec:
containers:
- name: {{ .Chart.Name }}-frontend
image: {{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- containerPort: {{ .Values.frontend.containerPort }}
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "backstage.fullname" . }}-app-env
volumeMounts:
- name: app-config
mountPath: {{ printf "/usr/share/nginx/html/static/%s" (include "backstage.appConfigFilename" .) }}
subPath: {{ include "backstage.appConfigFilename" . }}
volumes:
- name: app-config
configMap:
name: {{ include "backstage.fullname" . }}-app-config
{{- if .Values.frontend.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "frontend.serviceName" . }}
spec:
ports:
- port: 80
targetPort: {{ .Values.frontend.containerPort }}
selector:
app: backstage
component: frontend
type: ClusterIP
{{- end }}
@@ -0,0 +1,92 @@
{{- $frontendUrl := urlParse .Values.appConfig.app.baseUrl}}
{{- $backendUrl := urlParse .Values.appConfig.backend.baseUrl}}
{{- $lighthouseUrl := urlParse .Values.appConfig.lighthouse.baseUrl}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "backstage.fullname" . }}-ingress
annotations:
{{- if .Values.issuer.email }}
cert-manager.io/cluster-issuer: {{ .Values.issuer.clusterIssuer }}
{{- end }}
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
tls:
- secretName: {{ include "backstage.fullname" . }}-tls
hosts:
- {{ $frontendUrl.host }}
- {{ $backendUrl.host }}
- {{ $lighthouseUrl.host }}
rules:
- host: {{ $frontendUrl.host }}
http:
paths:
- path: /
backend:
serviceName: {{ include "frontend.serviceName" . }}
servicePort: 80
{{/* Route the backend inside the same hostname as the frontend when they are the same */}}
{{- if eq $frontendUrl.host $backendUrl.host}}
- path: /api
backend:
serviceName: {{ include "backend.serviceName" . }}
servicePort: 80
{{/* Route the backend through a different host */}}
{{- else -}}
- host: {{ $backendUrl.host }}
http:
paths:
- path: {{ $backendUrl.path | default "/" }}
backend:
serviceName: {{ include "backend.serviceName" . }}
servicePort: 80
{{- end }}
{{/* Route lighthouse through a different host */}}
{{- if not ( eq $frontendUrl.host $lighthouseUrl.host ) }}
- host: {{ $lighthouseUrl.host }}
http:
paths:
- path: {{ $lighthouseUrl.path | default "/" }}
backend:
serviceName: {{ include "lighthouse.serviceName" . }}
servicePort: 80
{{- else }}
{{/* Route lighthouse by path with re-write rules when it is hosted under the same hostname */}}
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "backstage.fullname" . }}-ingress-lighthouse
annotations:
{{- if .Values.issuer.email }}
cert-manager.io/cluster-issuer: {{ .Values.issuer.clusterIssuer }}
{{- end }}
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
tls:
- secretName: {{ include "backstage.fullname" . }}-tls
hosts:
- {{ $lighthouseUrl.host }}
rules:
- host: {{ $frontendUrl.host }}
http:
paths:
- path: {{$lighthouseUrl.path}}(/|$)(.*)
backend:
serviceName: {{ include "lighthouse.serviceName" . }}
servicePort: 80
{{- end }}
@@ -0,0 +1,19 @@
{{- if (and (.Capabilities.APIVersions.Has "cert-manager.io/v1alpha2") .Values.issuer.email ) -}}
{{/* Only install issuer if it doesn't already exist in the cluster */}}
{{- if not ( lookup "cert-manager.io/v1alpha2" "ClusterIssuer" "" .Values.issuer.clusterIssuer ) }}
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
name: {{ .Values.issuer.clusterIssuer }}
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: {{ required "expected a valid .Values.issuer.email to enable ClusterIssuer" .Values.issuer.email }}
privateKeySecretRef:
name: {{ required "expected .Values.issuer.cluster-issuer to not be empty (letsencrypt-prod | letsencrypt-staging)" .Values.issuer.clusterIssuer }}
solvers:
- http01:
ingress:
class: nginx
{{- end -}}
{{- end -}}
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backstage.fullname" . -}}-lighthouse
data:
PGDATABASE: {{ .Values.lighthouse.database.connection.database | quote }}
PGUSER: {{ include "lighthouse.postgresql.user" . | quote }}
PGPORT: {{ include "lighthouse.postgresql.port" . | quote }}
PGHOST: {{ include "lighthouse.postgresql.host" . | quote }}
PGPATH_TO_CA: {{ include "backstage.lighthouse.postgresCaFilename" . | quote }}
@@ -0,0 +1,74 @@
{{- if .Values.lighthouse.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "backstage.fullname" . }}-lighthouse
spec:
replicas: {{ .Values.lighthouse.replicaCount }}
selector:
matchLabels:
app: backstage
component: lighthouse-audit-service
template:
metadata:
annotations:
ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"lighthouse"}]'
labels:
app: backstage
component: lighthouse-audit-service
spec:
containers:
- name: lighthouse-audit-service
image: {{ .Values.lighthouse.image.repository }}:{{ .Values.lighthouse.image.tag }}
imagePullPolicy: {{ .Values.lighthouse.image.pullPolicy }}
ports:
- containerPort: {{ .Values.lighthouse.containerPort }}
resources:
{{- toYaml .Values.lighthouse.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "backstage.fullname" . -}}-lighthouse
- configMapRef:
name: {{ include "backstage.fullname" . }}-app-env
env:
- name: LAS_PORT
value: {{ .Values.lighthouse.containerPort | quote }}
- name: LAS_CORS
value: "true"
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lighthouse.postgresql.passwordSecret" . }}
key: postgresql-password
volumeMounts:
- name: postgres-ca
mountPath: {{ include "backstage.lighthouse.postgresCaDir" . }}
volumes:
- name: postgres-ca
configMap:
name: {{ include "backstage.fullname" . }}-postgres-ca
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "lighthouse.serviceName" . }}
spec:
ports:
- port: 80
targetPort: {{ .Values.lighthouse.containerPort }}
selector:
app: backstage
component: lighthouse-audit-service
type: ClusterIP
{{- end }}
@@ -0,0 +1,21 @@
{{- if .Values.postgresql.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backstage.fullname" . }}-postgres-ca
labels:
app: {{ include "backstage.postgresql.fullname" . }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
data:
{{ .Values.global.postgresql.caFilename }}: |
{{ include "backstage.postgresql.generateCA" . | indent 4}}
{{- else }}
{{- $caConfig := printf "%s-postgres-ca" (include "backstage.fullname" .) }}
{{- if not ( lookup "v1" "ConfigMap" .Release.Namespace $caConfig ) }}
{{- fail (printf "\n\nPlease create the '%s' configmap with the CA certificate for your existing postgresql: kubectl create configmap %s --from-file=ca.crt" $caConfig $caConfig) }}
{{- end }}
{{- end }}
@@ -0,0 +1,16 @@
{{- if .Values.postgresql.enabled }}
---
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
name: {{ required ".Values.postgresql.tls.certificatesSecret is required" .Values.postgresql.tls.certificatesSecret }}
labels:
app: {{ include "backstage.postgresql.fullname" . }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
data:
{{ include "generateCerts" . | indent 2 }}
{{- end }}
@@ -0,0 +1,14 @@
{{- if .Values.postgresql.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ required ".Values.postgresql.initdbScriptsSecret is required" .Values.postgresql.initdbScriptsSecret }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
type: Opaque
data:
create-backend-dbs.sql: |
{{ tpl (.Files.Get "files/create-backend-dbs.sql") . | b64enc }}
{{- end }}
@@ -0,0 +1,30 @@
{{- if not .Values.postgresql.enabled }}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "backend.postgresql.passwordSecret" . }}
labels:
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
data:
postgresql-password: {{ .Values.appConfig.backend.database.connection.password | b64enc }}
{{- end }}
{{- if not .Values.postgresql.enabled }}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "lighthouse.postgresql.passwordSecret" . }}
labels:
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
data:
postgresql-password: {{ .Values.lighthouse.database.connection.password | b64enc }}
{{- end }}
@@ -0,0 +1,23 @@
---
apiVersion: v1
kind: Pod
metadata:
name: {{ include "backstage.fullname" . -}}-test-app-connection
annotations:
"helm.sh/hook": test
spec:
containers:
- name: test-app
image: busybox
command:
- /bin/sh
- -ecx
- |
echo -e "===== Testing the connection with the frontend...\n"
wget -q -O - {{ printf "%s.%s" (include "frontend.serviceName" .) .Release.Namespace | quote }}
echo -e "\n\n===== Testing the connection with the backend...\n"
wget -q -O - {{ printf "http://%s.%s/catalog/entities" (include "backend.serviceName" .) .Release.Namespace | quote }}
echo -e "\n\n===== Testing the connection with the lighthouse plugin...\n"
wget -q -O - {{ printf "%s.%s/v1/audits" (include "lighthouse.serviceName" .) .Release.Namespace | quote }}
echo -e "\n"
restartPolicy: Never
@@ -0,0 +1,33 @@
{{- if .Values.postgresql.enabled}}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ include "backstage.name" . -}}-test-postgres
annotations:
"helm.sh/hook": test
spec:
containers:
- name: postgresql-client
image: bitnami/postgresql
env:
- name: PG_HOST
value: {{ include "postgresql.serviceName" . | quote }}
- name: PG_PORT
value: {{ .Values.postgresql.service.port | quote }}
- name: PG_USER
value: {{ .Values.global.postgresql.postgresqlUsername | quote }}
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ include "backend.postgresql.passwordSecret" .}}
key: postgresql-password
- name: PG_DBNAME
value: {{ .Values.appConfig.backend.database.connection.database }}
command:
- /bin/bash
- -ecx
- |
psql --host=$PG_HOST --port=$PG_PORT --username=$PG_USER --dbname=$PG_DBNAME --no-password
restartPolicy: Never
{{- end }}

Some files were not shown because too many files have changed in this diff Show More