Skip to content

Commit

Permalink
Add backstage stub
Browse files Browse the repository at this point in the history
  • Loading branch information
jmichalak-fluxninja committed Feb 27, 2024
1 parent 59e0528 commit 7aca61b
Show file tree
Hide file tree
Showing 25 changed files with 428 additions and 0 deletions.
24 changes: 24 additions & 0 deletions backstage-org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
name: opentelemetry-demo
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/
description: OTEL demo app
spec:
owner: user:guest
---
apiVersion: backstage.io/v1alpha1
kind: Group
metadata:
name: devs
spec:
type: team
children: []
---
apiVersion: backstage.io/v1alpha1
kind: User
metadata:
name: guest
spec:
memberOf: [devs]

Check failure on line 24 in backstage-org.yaml

View workflow job for this annotation

GitHub Actions / yamllint

24:19 [new-line-at-end-of-file] no new line character at the end of file
48 changes: 48 additions & 0 deletions backstage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os

# Template string for backstage.yaml
template = """
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: {service_name}
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/{service_name}/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
"""

def create_backstage_file(directory):
# Construct the file path for backstage.yaml
backstage_file_path = os.path.join(directory, "backstage.yaml")

# Extract the directory name from the full path
directory_name = os.path.basename(directory)

# Fill in the template with the directory name
backstage_content = template.format(service_name=directory_name)

# Write the content to the backstage.yaml file
with open(backstage_file_path, 'w') as f:
f.write(backstage_content)

print(f"Created backstage.yaml in {directory}")

def scan_directories(root_directory):
from pathlib import Path
dirs = sorted([d for d in Path(root_directory).iterdir() if d.is_dir()])
for entry in dirs:
#create_backstage_file(entry)
print(f' - ./{entry}/backstage.yaml')

if __name__ == "__main__":
root_directory = "./src"

if not os.path.exists(root_directory):
print("Root directory not found.")
else:
scan_directories(root_directory)
32 changes: 32 additions & 0 deletions backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: backstage.io/v1alpha1
kind: Location
metadata:
name: opentelemetry-demo
description: A collection of all Backstage example entities, except users, groups, and templates
annotations:
github.com/project-slug: jmichalak9/opentelemetry-demo
spec:
targets:
- ./pb/backstage.yaml
- ./src/accountingservice/backstage.yaml
- ./src/adservice/backstage.yaml
- ./src/cartservice/backstage.yaml
- ./src/checkoutservice/backstage.yaml
- ./src/currencyservice/backstage.yaml
- ./src/emailservice/backstage.yaml
- ./src/featureflagservice/backstage.yaml
- ./src/ffspostgres/backstage.yaml
- ./src/frauddetectionservice/backstage.yaml
- ./src/frontend/backstage.yaml
- ./src/frontendproxy/backstage.yaml
- ./src/grafana/backstage.yaml
- ./src/kafka/backstage.yaml
- ./src/loadgenerator/backstage.yaml
- ./src/otelcollector/backstage.yaml
- ./src/paymentservice/backstage.yaml
- ./src/productcatalogservice/backstage.yaml
- ./src/prometheus/backstage.yaml
- ./src/quoteservice/backstage.yaml
- ./src/recommendationservice/backstage.yaml
- ./src/shippingservice/backstage.yaml
- https://github.com/jmichalak9/opentelemetry.io/blob/main/catalog-info.yaml
12 changes: 12 additions & 0 deletions pb/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: pb
description: grpc api
spec:
type: grpc
lifecycle: production
owner: user:guest
system: opentelemetry-demo
definition:
$text: ./demo.proto
16 changes: 16 additions & 0 deletions src/accountingservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: accountingservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/accountingservice/
github.com/project-slug: jmichalak9/opentelemetry-demo
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- resource:default/kafka
15 changes: 15 additions & 0 deletions src/adservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Check failure on line 1 in src/adservice/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: adservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/adservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/featureflagservice
15 changes: 15 additions & 0 deletions src/cartservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Check failure on line 1 in src/cartservice/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: cartservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/cartservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/featureflagservice
21 changes: 21 additions & 0 deletions src/checkoutservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: checkoutservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/checkoutservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/cartservice
- component:default/currencyservice
- component:default/emailservice
- component:default/paymentservice
- component:default/productcatalogservice
- component:default/shippingservice
- resource:default/kafka
13 changes: 13 additions & 0 deletions src/currencyservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: currencyservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/currencyservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
13 changes: 13 additions & 0 deletions src/emailservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: emailservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/emailservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
16 changes: 16 additions & 0 deletions src/featureflagservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Check failure on line 1 in src/featureflagservice/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: featureflagservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/featureflagservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- resource:default/ffspostgres
providesApis: [pb]

Check failure on line 16 in src/featureflagservice/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

16:21 [new-line-at-end-of-file] no new line character at the end of file
13 changes: 13 additions & 0 deletions src/ffspostgres/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Check failure on line 1 in src/ffspostgres/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: ffspostgres
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/ffspostgres/
spec:
type: database
lifecycle: production
owner: user:guest
system: opentelemetry-demo
15 changes: 15 additions & 0 deletions src/frauddetectionservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: frauddetectionservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/frauddetectionservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- resource:default/kafka
20 changes: 20 additions & 0 deletions src/frontend/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: frontend
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/frontend/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/cartservice
- component:default/currencyservice
- component:default/checkoutservice
- component:default/productcatalogservice
- component:default/shippingservice
- component:default/recommendationservice
16 changes: 16 additions & 0 deletions src/frontendproxy/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: frontendproxy
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/frontendproxy/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/frontend
- component:default/featureflagservice
13 changes: 13 additions & 0 deletions src/grafana/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Check failure on line 1 in src/grafana/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: grafana
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/grafana/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
13 changes: 13 additions & 0 deletions src/kafka/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: kafka
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/kafka/
spec:
type: database
lifecycle: production
owner: user:guest
system: opentelemetry-demo
15 changes: 15 additions & 0 deletions src/loadgenerator/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Check failure on line 1 in src/loadgenerator/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: loadgenerator
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/loadgenerator/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/frontendproxy
13 changes: 13 additions & 0 deletions src/otelcollector/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: otelcollector
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/otelcollector/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
13 changes: 13 additions & 0 deletions src/paymentservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: paymentservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/paymentservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
15 changes: 15 additions & 0 deletions src/productcatalogservice/backstage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Check failure on line 1 in src/productcatalogservice/backstage.yaml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [empty-lines] too many blank lines (1 > 0)
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: productcatalogservice
description: This service is responsible to process a checkout order from the user. The checkout service will call many other services in order to process an order.
annotations:
backstage.io/techdocs-ref: url:https://opentelemetry.io/docs/demo/services/productcatalogservice/
spec:
type: service
lifecycle: production
owner: user:guest
system: opentelemetry-demo
dependsOn:
- component:default/featureflagservice
Loading

0 comments on commit 7aca61b

Please sign in to comment.