Skip to content

Commit

Permalink
Merge pull request #2439 from spotify/rugvip/data
Browse files Browse the repository at this point in the history
remove mock-data scripts and use catalog.locations for adding examples
  • Loading branch information
Rugvip committed Sep 12, 2020
2 parents fbd6ef9 + 3cf20cb commit 3aee1a1
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 176 deletions.
38 changes: 21 additions & 17 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,27 @@ catalog:
privateToken:
$secret:
env: AZURE_PRIVATE_TOKEN
exampleEntityLocations:
github:
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/artist-lookup-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-order-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/podcast-api-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/queue-proxy-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/searcher-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-lib-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/www-artist-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/shuffle-api-component.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml
- https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/hello-world-api.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/streetlights-api.yaml

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

auth:
providers:
Expand Down
7 changes: 0 additions & 7 deletions docs/features/software-templates/adding-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ curl \
This should then have added the catalog, and also should now be listed under the
create page at http://localhost:3000/create.

Alternatively, if you want to get setup with some mock templates that are
already provided, run the following to load those templates:

```
yarn lerna run mock-data
```

The `type` field which is chosen in the request to add the `template.yaml` to
the Service Catalog here, will be come the `PreparerKey` which will be used to
select the `Preparer` when creating a job.
Expand Down
6 changes: 2 additions & 4 deletions docs/getting-started/running-backstage-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ yarn start

That starts up a backend instance on port 7000.

In the other window, we will first populate the catalog with some nice mock data
to look at, and then launch the frontend. These commands are run from the
project root, not inside the backend directory.
In the other window, we will then launch the frontend. This command is run from
the project root, not inside the backend directory.

```bash
yarn lerna run mock-data
yarn start
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can customize Backstage Software Templates to fit your organization’s stan

## Getting started

The sample Software Templates are available under `/create`. If you're setting up Backstage for the first time, follow [Getting Started with Backstage](https://backstage.io/docs/getting-started/) and go to `http://localhost:3000/create`. If you’ve already been running Backstage locally, run the command `yarn lerna run mock-data` to load the new sample templates into the Service Catalog first.
The sample Software Templates are available under `/create`. If you're setting up Backstage for the first time, follow [Getting Started with Backstage](https://backstage.io/docs/getting-started/) and go to `http://localhost:3000/create`.

![available-templates](assets/2020-08-05/templates.png)

Expand Down
20 changes: 6 additions & 14 deletions packages/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,13 @@ The backend starts up on port 7000 per default.

## Populating The Catalog

If you want to use the catalog functionality, you need to add so called locations
to the backend. These are places where the backend can find some entity descriptor
data to consume and serve.
If you want to use the catalog functionality, you need to add so called
locations to the backend. These are places where the backend can find some
entity descriptor data to consume and serve. For more information, see
[Software Catalog Overview - Adding Components to the Catalog](https://backstage.io/docs/features/software-catalog/software-catalog-overview#adding-components-to-the-catalog).

To get started, you can issue the following after starting the backend, from inside
the `plugins/catalog-backend` directory:

```bash
yarn mock-data
```

You should then start seeing data on `localhost:7000/catalog/entities`.

The catalog currently runs in-memory only, so feel free to try it out, but it will
need to be re-populated on next startup.
For convenience we already include some statically configured example locations
in `app-config.yaml` under `catalog.locations`. For local development you can override these in your own `app-config.local.yaml`.

## Authentication

Expand Down
10 changes: 10 additions & 0 deletions packages/catalog-model/examples/all-apis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: example-apis
description: A collection of all Backstage example APIs
spec:
type: github
targets:
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/hello-world-api.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/streetlights-api.yaml
16 changes: 16 additions & 0 deletions packages/catalog-model/examples/all-components.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: example-components
description: A collection of all Backstage example components
spec:
type: github
targets:
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/artist-lookup-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-order-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/podcast-api-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/queue-proxy-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/searcher-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-lib-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/www-artist-component.yaml
- https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/shuffle-api-component.yaml
23 changes: 5 additions & 18 deletions packages/create-app/templates/default-app/app-config.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,12 @@ catalog:
locations:
# Backstage example components
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/artist-lookup-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-order-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/podcast-api-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/queue-proxy-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/searcher-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/playback-lib-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/www-artist-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/shuffle-api-component.yaml
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/hello-world-api.yaml
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/all-components.yaml

# Backstage example APIs
- type: github
target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/streetlights-api.yaml
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/react-ssr-template/template.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
This package is an EXAMPLE of a Backstage backend.

The main purpose of this package is to provide a test bed for Backstage plugins
that have a backend part. Feel free to experiment locally or within your fork
by adding dependencies and routes to this backend, to try things out.
that have a backend part. Feel free to experiment locally or within your fork by
adding dependencies and routes to this backend, to try things out.

Our goal is to eventually amend the create-app flow of the CLI, such that a
production ready version of a backend skeleton is made alongside the frontend
Expand Down Expand Up @@ -33,34 +33,32 @@ LOG_LEVEL=debug \
yarn start
```

Substitute `x` for actual values, or leave them as
dummy values just to try out the backend without using the auth or sentry features.
Substitute `x` for actual values, or leave them as dummy values just to try out
the backend without using the auth or sentry features.

The backend starts up on port 7000 per default.

## Populating The Catalog

If you want to use the catalog functionality, you need to add so called locations
to the backend. These are places where the backend can find some entity descriptor
data to consume and serve.
If you want to use the catalog functionality, you need to add so called
locations to the backend. These are places where the backend can find some
entity descriptor data to consume and serve. For more information, see
[Software Catalog Overview - Adding Components to the Catalog](https://backstage.io/docs/features/software-catalog/software-catalog-overview#adding-components-to-the-catalog).

To get started, you can issue the following after starting the backend, from inside
the `plugins/catalog-backend` directory:

```bash
yarn mock-data
```

You should then start seeing data on `localhost:7000/catalog/entities`.

The catalog currently runs in-memory only, so feel free to try it out, but it will
need to be re-populated on next startup.
To get started quickly, this template already includes some statically configured example locations
in `app-config.yaml` under `catalog.locations`. You can remove and replace these locations as you
like, and also override them for local development in `app-config.local.yaml`.

## Authentication

We chose [Passport](http://www.passportjs.org/) as authentication platform due to its comprehensive set of supported authentication [strategies](http://www.passportjs.org/packages/).
We chose [Passport](http://www.passportjs.org/) as authentication platform due
to its comprehensive set of supported authentication
[strategies](http://www.passportjs.org/packages/).

Read more about the [auth-backend](https://github.com/spotify/backstage/blob/master/plugins/auth-backend/README.md) and [how to add a new provider](https://github.com/spotify/backstage/blob/master/docs/auth/add-auth-provider.md)
Read more about the
[auth-backend](https://github.com/spotify/backstage/blob/master/plugins/auth-backend/README.md)
and
[how to add a new provider](https://github.com/spotify/backstage/blob/master/docs/auth/add-auth-provider.md)

## Documentation

Expand Down
5 changes: 1 addition & 4 deletions plugins/catalog-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ To evaluate the catalog and have a greater amount of functionality available, in
# in one terminal window, run this from from the very root of the Backstage project
cd packages/backend
yarn start

# open another terminal window, and run the following from the very root of the Backstage project
yarn lerna run mock-data
```

This will launch the full example backend and populate its catalog with some mock entities.
This will launch the full example backend, populated some example entities.

## Links

Expand Down
4 changes: 1 addition & 3 deletions plugins/catalog-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"test": "backstage-cli test",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean",
"mock-data": "./scripts/mock-data.sh",
"mock-data:local": "./scripts/mock-data-local.sh"
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.1.1-alpha.21",
Expand Down
12 changes: 0 additions & 12 deletions plugins/catalog-backend/scripts/mock-data-local.sh

This file was deleted.

21 changes: 0 additions & 21 deletions plugins/catalog-backend/scripts/mock-data.sh

This file was deleted.

File renamed without changes.
3 changes: 1 addition & 2 deletions plugins/github-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"diff": "backstage-cli plugin:diff",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean",
"mock-data": "./scripts/mock-data.sh"
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/catalog-model": "^0.1.1-alpha.21",
Expand Down
8 changes: 0 additions & 8 deletions plugins/github-actions/scripts/mock-data.sh

This file was deleted.

3 changes: 1 addition & 2 deletions plugins/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"test": "backstage-cli test",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean",
"mock-data": "./scripts/mock-data.sh"
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.1.1-alpha.21",
Expand Down
2 changes: 0 additions & 2 deletions plugins/graphql/scripts/mock-data.sh

This file was deleted.

3 changes: 1 addition & 2 deletions plugins/scaffolder-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"test": "backstage-cli test",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean",
"mock-data": "./scripts/mock-data.sh"
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.1.1-alpha.21",
Expand Down
13 changes: 13 additions & 0 deletions plugins/scaffolder-backend/sample-templates/all-templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: example-templates
description: A collection of all Backstage example templates
spec:
type: github
targets:
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml
- https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml
- https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml
22 changes: 0 additions & 22 deletions plugins/scaffolder-backend/scripts/mock-data.sh

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/techdocs-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ To evaluate TechDocs and have a greater amount of functionality available, inste
# in one terminal window, run this from from the very root of the Backstage project
cd packages/backend
yarn start

# open another terminal window, and run the following from the very root of the Backstage project
yarn lerna run mock-data
```

## What techdocs-backend does
Expand Down
3 changes: 1 addition & 2 deletions plugins/techdocs-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"test": "backstage-cli test",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean",
"mock-data": "./scripts/mock-data.sh"
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.1.1-alpha.21",
Expand Down

0 comments on commit 3aee1a1

Please sign in to comment.