Skip to content

Commit 4c5807d

Browse files
authored
Initial workshop commit - oci pulumi self service (oracle-livelabs#411)
* Initial workshop commit * Updating links in index.html
1 parent 992c366 commit 4c5807d

File tree

90 files changed

+28496
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+28496
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Pulumi.yaml
2+
Pulumi.*.yaml
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: 00-backstage
2+
runtime: yaml
3+
description: "Run Backstage on Oracle Cloud Container Instance"
4+
5+
6+
resources:
7+
backstageBuild:
8+
type: command:local:Command
9+
properties:
10+
dir: "./backstage"
11+
create: "yarn install && yarn tsc && yarn build:backend"
12+
update: "yarn install && yarn tsc && yarn build:backend"
13+
14+
backstageImage:
15+
options:
16+
version: v4.5.3
17+
dependsOn:
18+
- ${backstageBuild}
19+
properties:
20+
build:
21+
context: ./backstage
22+
platform: linux/amd64
23+
builderVersion: BuilderBuildKit
24+
dockerfile: ./backstage/packages/backend/Dockerfile
25+
imageName: ${oci:region}.ocir.io/${backstageContainerRepository.namespace}/${backstageContainerRepository.displayName}
26+
registry:
27+
server: ${oci:region}.ocir.io
28+
username: ${backstageContainerRepository.namespace}/${username}
29+
password: ${auth-token}
30+
type: docker:Image
31+
32+
backstageVcn:
33+
type: oci:Core:Vcn
34+
properties:
35+
compartmentId: ${compartment_ocid}
36+
cidrBlock: "10.0.0.0/16"
37+
displayName: "Backstage VCN"
38+
dnsLabel: "backstage"
39+
40+
backstageContainerRepository:
41+
type: oci:Artifacts:ContainerRepository
42+
properties:
43+
compartmentId: ${compartment_ocid}
44+
displayName: "backstage"
45+
isPublic: true
46+
47+
backstageSecurityList:
48+
type: oci:Core:SecurityList
49+
properties:
50+
compartmentId: ${compartment_ocid}
51+
vcnId: ${backstageVcn.id}
52+
displayName: "backstage-security-list"
53+
ingressSecurityRules:
54+
- protocol: "6"
55+
sourceType: "CIDR_BLOCK"
56+
source: "0.0.0.0/0"
57+
tcpOptions:
58+
max: 7007
59+
min: 7007
60+
egressSecurityRules:
61+
- protocol: "6"
62+
destinationType: "CIDR_BLOCK"
63+
destination: "0.0.0.0/0"
64+
description: "Allow access to container registry via HTTPS"
65+
tcpOptions:
66+
max: 443
67+
min: 443
68+
69+
backstageSubnet:
70+
type: oci:Core:Subnet
71+
properties:
72+
cidrBlock: "10.0.0.0/24"
73+
compartmentId: ${compartment_ocid}
74+
vcnId: ${backstageVcn.id}
75+
displayName: "backstage-subnet"
76+
dnsLabel: "containers"
77+
securityListIds:
78+
- ${backstageSecurityList.id}
79+
routeTableId: ${backstageRouteTable.id}
80+
81+
backstageInternetGateway:
82+
type: oci:Core:InternetGateway
83+
properties:
84+
compartmentId: ${compartment_ocid}
85+
vcnId: ${backstageVcn.id}
86+
displayName: "backstage-internet-gateway"
87+
enabled: true
88+
89+
backstageRouteTable:
90+
type: oci:Core:RouteTable
91+
properties:
92+
compartmentId: ${compartment_ocid}
93+
vcnId: ${backstageVcn.id}
94+
displayName: "backstage-route-table"
95+
routeRules:
96+
- destination: "0.0.0.0/0"
97+
networkEntityId: ${backstageInternetGateway.id}
98+
99+
backstageContainerInstance:
100+
type: oci:ContainerEngine:ContainerInstance
101+
properties:
102+
availabilityDomain: ${backstageAvailabilityDomains.availabilityDomains[0].name}
103+
compartmentId: ${compartment_ocid}
104+
displayName: "backstage-container-instance"
105+
containerRestartPolicy: "ALWAYS"
106+
shape: "CI.Standard.E4.Flex"
107+
shapeConfig:
108+
ocpus: 2
109+
memoryInGbs: 16
110+
vnics:
111+
- subnetId: ${backstageSubnet.id}
112+
displayName: "test-vnic"
113+
isPublicIpAssigned: true
114+
nsgIds: []
115+
containers:
116+
- imageUrl: ${backstageImage.repoDigest}
117+
displayName: "backstage"
118+
environmentVariables:
119+
PULUMI_ACCESS_TOKEN: ${pulumi-pat}
120+
GITHUB_TOKEN: ${github-token}
121+
commands:
122+
- "node"
123+
arguments:
124+
- "packages/backend"
125+
- "--config"
126+
- "app-config.yaml"
127+
128+
outputs:
129+
image: ${backstageImage.repoDigest}
130+
backstageUrl: http://${backstageContainerInstancePublicIp.publicIpAddress}:7007
131+
132+
133+
variables:
134+
backstageAvailabilityDomains:
135+
fn::oci:Identity/getAvailabilityDomains:getAvailabilityDomains:
136+
compartmentId: ${tenancy_ocid}
137+
138+
backstageContainerInstancePublicIp:
139+
fn::oci:Core/getVnic:getVnic:
140+
vnicId: ${backstageContainerInstance.vnics[0].vnicId}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.yarn/cache
3+
.yarn/install-state.gz
4+
node_modules
5+
packages/*/src
6+
packages/*/node_modules
7+
plugins
8+
*.local.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
playwright.config.ts
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
root: true,
3+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
dist-types
3+
coverage
4+
.vscode
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# [Backstage](https://backstage.io)
2+
3+
This is your newly scaffolded Backstage App, Good Luck!
4+
5+
To start the app, run:
6+
7+
```sh
8+
yarn install
9+
yarn dev
10+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
app:
2+
# Should be the same as backend.baseUrl when using the `app-backend` plugin.
3+
baseUrl: http://localhost:7007
4+
5+
backend:
6+
# Note that the baseUrl should be the URL that the browser and other clients
7+
# should use when communicating with the backend, i.e. it needs to be
8+
# reachable not just from within the backend host, but from all of your
9+
# callers. When its value is "http://localhost:7007", it's strictly private
10+
# and can't be reached by others.
11+
baseUrl: http://localhost:7007
12+
# The listener can also be expressed as a single <host>:<port> string. In this case we bind to
13+
# all interfaces, the most permissive setting. The right value depends on your specific deployment.
14+
listen: ':7007'
15+
16+
# config options: https://node-postgres.com/api/client
17+
database:
18+
client: pg
19+
connection:
20+
host: ${POSTGRES_HOST}
21+
port: ${POSTGRES_PORT}
22+
user: ${POSTGRES_USER}
23+
password: ${POSTGRES_PASSWORD}
24+
# https://node-postgres.com/features/ssl
25+
# you can set the sslmode configuration option via the `PGSSLMODE` environment variable
26+
# see https://www.postgresql.org/docs/current/libpq-ssl.html Table 33.1. SSL Mode Descriptions (e.g. require)
27+
# ssl:
28+
# ca: # if you have a CA file and want to verify it you can uncomment this section
29+
# $file: <file-path>/ca/server.crt
30+
31+
auth:
32+
providers:
33+
guest: null
34+
35+
catalog:
36+
# Overrides the default list locations from app-config.yaml as these contain example data.
37+
# See https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog for more details
38+
# on how to get entities into the catalog.
39+
locations: []
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
app:
2+
title: Scaffolded Backstage App
3+
baseUrl: http://localhost:7007
4+
5+
organization:
6+
name: My Company
7+
8+
backend:
9+
auth:
10+
keys:
11+
- secret: 'my-secret'
12+
# Used for enabling authentication, secret is shared by all backend plugins
13+
# See https://backstage.io/docs/auth/service-to-service-auth for
14+
# information on the format
15+
# auth:
16+
# keys:
17+
# - secret: ${BACKEND_SECRET}
18+
baseUrl: http://localhost:7007
19+
listen:
20+
port: 7007
21+
# Uncomment the following host directive to bind to specific interfaces
22+
# host: 127.0.0.1
23+
csp:
24+
connect-src: ["'self'", 'http:', 'https:']
25+
upgrade-insecure-requests: false
26+
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
27+
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
28+
cors:
29+
origin: http://localhost:7007
30+
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
31+
credentials: true
32+
# This is for local development only, it is not recommended to use this in production
33+
# The production database configuration is stored in app-config.production.yaml
34+
database:
35+
client: better-sqlite3
36+
connection: ':memory:'
37+
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir
38+
39+
integrations:
40+
github:
41+
- host: github.com
42+
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information
43+
# about setting up the GitHub integration here: https://backstage.io/docs/integrations/github/locations#configuration
44+
token: ${GITHUB_TOKEN}
45+
### Example for how to add your GitHub Enterprise instance using the API:
46+
# - host: ghe.example.net
47+
# apiBaseUrl: https://ghe.example.net/api/v3
48+
# token: ${GHE_TOKEN}
49+
50+
proxy:
51+
'/pulumi':
52+
target: 'https://api.pulumi.com/api'
53+
changeOrigin: true
54+
headers:
55+
Authorization: token ${PULUMI_ACCESS_TOKEN}
56+
Accept: application/vnd.pulumi+8
57+
Content-Type: application/json
58+
59+
# Reference documentation http://backstage.io/docs/features/techdocs/configuration
60+
# Note: After experimenting with basic setup, use CI/CD to generate docs
61+
# and an external cloud storage when deploying TechDocs for production use-case.
62+
# https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-basic-to-recommended-deployment-approach
63+
techdocs:
64+
builder: 'local' # Alternatives - 'external'
65+
generator:
66+
runIn: 'docker' # Alternatives - 'local'
67+
publisher:
68+
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
69+
70+
auth:
71+
# see https://backstage.io/docs/auth/ to learn about auth providers
72+
providers:
73+
# See https://backstage.io/docs/auth/guest/provider
74+
guest:
75+
dangerouslyAllowOutsideDevelopment: true
76+
scaffolder:
77+
defaultCommitMessage: "OCI + Pulumi + Backstage = self service"
78+
# see https://backstage.io/docs/features/software-templates/configuration for software template options
79+
80+
catalog:
81+
import:
82+
entityFilename: catalog-info.yaml
83+
pullRequestBranchName: backstage-integration
84+
rules:
85+
- allow: [Component, System, API, Resource, Location,Template,User,Group]
86+
locations:
87+
- type: url
88+
target: https://github.com/enschilling/pulumi-backstage-templates/blob/main/oci-static-page/template.yaml
89+
rules:
90+
- allow: [Template]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"version": "1.25.0"
3+
}

0 commit comments

Comments
 (0)