Skip to content

Commit

Permalink
minor fixes and add lighthouse
Browse files Browse the repository at this point in the history
  • Loading branch information
jmichalak-fluxninja committed Mar 13, 2024
1 parent d21a491 commit 100ef7d
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 435 deletions.
8 changes: 8 additions & 0 deletions backstage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
run:
yarn dev

.PHONY: run-lighthouse-srv
run-lighthouse-srv:
docker-compose -f lighthouse.yaml up

.PHONY: stop-lighthouse-srv
stop-lighthouse-srv:
docker-compose -f lighthouse.yaml down

.PHONY: install
install:
pip3 install mkdocs-techdocs-core==1.0.2
Expand Down
8 changes: 2 additions & 6 deletions backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ This is your newly scaffolded Backstage App, Good Luck!
To start the app, run:

```sh
make install
make run
yarn install
yarn dev
```

Provide Github identity in http://localhost:3000/settings/auth-providers.

This setup installs backstage plugins. The OTEL demo should be visible in backstage by default -- you can explore provided components, API and docs. In each component, we provide a simple overview including security, dependabot and GH codespaces. More info is available in the tabs. Components documentation is hosted in https://github.com/jmichalak9/opentelemetry.io.
4 changes: 4 additions & 0 deletions backstage/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ backend:
# host: 127.0.0.1
csp:
connect-src: ["'self'", 'http:', 'https:']
frame-src:
- http://localhost:4008
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference

Check warning on line 24 in backstage/app-config.yaml

View workflow job for this annotation

GitHub Actions / yamllint

24:5 [comments-indentation] comment not indented like content
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
Expand Down Expand Up @@ -105,3 +107,5 @@ catalog:
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
# rules:
# - allow: [User, Group]
lighthouse:
baseUrl: http://localhost:4008

Check failure on line 111 in backstage/app-config.yaml

View workflow job for this annotation

GitHub Actions / yamllint

111:33 [new-line-at-end-of-file] no new line character at the end of file
24 changes: 24 additions & 0 deletions backstage/lighthouse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# docker-compose.yml
version: '3.1'

services:

db:
image: postgres:latest
restart: always
environment:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: example

Check failure on line 12 in backstage/lighthouse.yaml

View workflow job for this annotation

GitHub Actions / yamllint

12:1 [trailing-spaces] trailing spaces
lighthouse:
image: spotify/lighthouse-audit-service:latest
environment:
PGHOST: db
PGUSER: dbuser
PGPASSWORD: example
LAS_PORT: 4008
LAS_CORS: "true"
ports:
- "4008:4008"
extra_hosts:
- "host.docker.internal:host-gateway"

Check failure on line 24 in backstage/lighthouse.yaml

View workflow job for this annotation

GitHub Actions / yamllint

24:5 [indentation] wrong indentation: expected 6 but found 4

Check failure on line 24 in backstage/lighthouse.yaml

View workflow job for this annotation

GitHub Actions / yamllint

24:42 [new-line-at-end-of-file] no new line character at the end of file
4 changes: 1 addition & 3 deletions backstage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
"dependencies": {
"@adityasinghal26/plugin-github-codespaces": "^1.0.3",
"@roadiehq/backstage-plugin-github-insights": "^2.3.27",
"@roadiehq/backstage-plugin-security-insights": "^2.3.15",
"backstage-plugin-techdocs-addon-mermaid": "^0.11.0",
"isolated-vm": "^4.7.2"
"@roadiehq/backstage-plugin-security-insights": "^2.3.15"
}
}
4 changes: 2 additions & 2 deletions backstage/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
"@backstage/plugin-catalog-import": "^0.10.5",
"@backstage/plugin-catalog-react": "^1.9.3",
"@backstage/plugin-github-actions": "^0.6.10",
"@backstage/plugin-lighthouse": "^0.4.15",
"@backstage/plugin-org": "^0.6.19",
"@backstage/plugin-permission-react": "^0.4.19",
"@backstage/plugin-scaffolder": "^1.17.1",
"@backstage/plugin-search": "^1.4.5",
"@backstage/plugin-search-react": "^1.7.5",
"@backstage/plugin-tech-radar": "^0.6.12",
"@backstage/plugin-techdocs": "^1.9.3",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.5",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.4",
"@backstage/plugin-techdocs-react": "^1.1.15",
"@backstage/plugin-user-settings": "^0.8.0",
"@backstage/theme": "^0.5.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"backstage-plugin-techdocs-addon-mermaid": "^0.11.0",
"history": "^5.0.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
Expand Down
5 changes: 2 additions & 3 deletions backstage/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/

import { githubAuthApiRef } from '@backstage/core-plugin-api';
import { SignInProviderConfig, SignInPage } from '@backstage/core-components';

import { Mermaid } from 'backstage-plugin-techdocs-addon-mermaid';
import { LighthousePage } from '@backstage/plugin-lighthouse';

const githubProvider: SignInProviderConfig = {
id: 'github-auth-provider',
Expand Down Expand Up @@ -93,7 +92,6 @@ const routes = (
>
<TechDocsAddons>
<ReportIssue />
<Mermaid config={{ theme: 'forest', themeVariables: { lineColor: '#000000' } }} />
</TechDocsAddons>
</Route>
<Route path="/create" element={<ScaffolderPage />} />
Expand All @@ -115,6 +113,7 @@ const routes = (
</Route>
<Route path="/settings" element={<UserSettingsPage />} />
<Route path="/catalog-graph" element={<CatalogGraphPage />} />
<Route path="/lighthouse" element={<LighthousePage />} />
</FlatRoutes>
);

Expand Down
18 changes: 15 additions & 3 deletions backstage/packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ import {
} from '@adityasinghal26/plugin-github-codespaces';

import { EntityGithubInsightsContent } from '@roadiehq/backstage-plugin-github-insights';

import { Mermaid } from 'backstage-plugin-techdocs-addon-mermaid';
import {
EntityLighthouseContent,
EntityLastLighthouseAuditCard,
isLighthouseAvailable,
} from '@backstage/plugin-lighthouse';

const codespacesContent = (
<>
Expand Down Expand Up @@ -103,7 +106,6 @@ const techdocsContent = (
<EntityTechdocsContent>
<TechDocsAddons>
<ReportIssue />
<Mermaid config={{ theme: 'forest', themeVariables: { lineColor: '#000000' } }} />
</TechDocsAddons>
</EntityTechdocsContent>
);
Expand Down Expand Up @@ -212,6 +214,13 @@ const overviewContent = (
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<EntitySwitch>
<EntitySwitch.Case if={isLighthouseAvailable}>
<Grid item md={6}>
<EntityLastLighthouseAuditCard />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
</Grid>
);

Expand Down Expand Up @@ -296,6 +305,9 @@ const websiteEntityPage = (
<EntityLayout.Route path="/docs" title="Docs">
{techdocsContent}
</EntityLayout.Route>
<EntityLayout.Route path="/lighthouse" title="Lighthouse">
<EntityLighthouseContent />
</EntityLayout.Route>
</EntityLayout>
);

Expand Down
Binary file modified backstage/packages/backend/auth.sqlite
Binary file not shown.
Binary file modified backstage/packages/backend/catalog.sqlite
Binary file not shown.
Binary file modified backstage/packages/backend/scaffolder.sqlite
Binary file not shown.
Binary file modified backstage/packages/backend/search.sqlite
Binary file not shown.
Loading

0 comments on commit 100ef7d

Please sign in to comment.