Skip to content

Commit a1b7956

Browse files
Added config and docker for backstage docker
1 parent 3376e0b commit a1b7956

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

Diff for: deployment/kubernetes/backstage/docker/Dockerfile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This dockerfile builds an image for the backend package.
2+
# It should be executed with the root of the repo as docker context.
3+
#
4+
# Before building this image, be sure to have run the following commands in the repo root:
5+
#
6+
# yarn install
7+
# yarn tsc
8+
# yarn build:backend
9+
#
10+
# Once the commands have been run, you can build the image using `yarn build-image`
11+
12+
FROM node:18.12.0
13+
14+
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
15+
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
16+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
17+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
18+
apt-get update && \
19+
apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
20+
yarn config set python /usr/bin/python3
21+
22+
# From here on we use the least-privileged `node` user to run the backend.
23+
USER node
24+
25+
# This should create the app dir as `node`.
26+
# If it is instead created as `root` then the `tar` command below will fail: `can't create directory 'packages/': Permission denied`.
27+
# If this occurs, then ensure BuildKit is enabled (`DOCKER_BUILDKIT=1`) so the app dir is correctly created as `node`.
28+
WORKDIR /app
29+
30+
# This switches many Node.js dependencies to production mode.
31+
ENV NODE_ENV production
32+
33+
# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
34+
# The skeleton contains the package.json of each package in the monorepo,
35+
# and along with yarn.lock and the root package.json, that's enough to run yarn install.
36+
COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
37+
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
38+
39+
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
40+
yarn install --frozen-lockfile --production --network-timeout 300000
41+
42+
# Then copy the rest of the backend bundle, along with any other files we might want.
43+
COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
44+
COPY --chown=node:node examples/ /examples/
45+
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
46+
47+
CMD ["node", "packages/backend", "--config", "app-config.yaml"]
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
app:
2+
title: Scaffolded Backstage App
3+
baseUrl: http://localhost:3000
4+
5+
organization:
6+
name: My Company
7+
8+
backend:
9+
# Used for enabling authentication, secret is shared by all backend plugins
10+
# See https://backstage.io/docs/auth/service-to-service-auth for
11+
# information on the format
12+
# auth:
13+
# keys:
14+
# - secret: ${BACKEND_SECRET}
15+
baseUrl: http://localhost:80
16+
listen:
17+
port: 7007
18+
# Uncomment the following host directive to bind to specific interfaces
19+
# host: 127.0.0.1
20+
csp:
21+
connect-src: ["'self'", 'http:', 'https:']
22+
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
23+
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
24+
cors:
25+
origin: http://localhost:3000
26+
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
27+
credentials: true
28+
# This is for local development only, it is not recommended to use this in production
29+
# The production database configuration is stored in app-config.production.yaml
30+
database:
31+
client: pg
32+
connection:
33+
host: postgres
34+
port: 5432
35+
user: backstage
36+
password: hunter2
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/getting-started/configuration#setting-up-a-github-integration
44+
token: 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
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+
### Example for how to add a proxy endpoint for the frontend.
52+
### A typical reason to do this is to handle HTTPS and CORS for internal services.
53+
# '/test':
54+
# target: 'https://example.com'
55+
# changeOrigin: true
56+
57+
# Reference documentation http://backstage.io/docs/features/techdocs/configuration
58+
# Note: After experimenting with basic setup, use CI/CD to generate docs
59+
# and an external cloud storage when deploying TechDocs for production use-case.
60+
# https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-basic-to-recommended-deployment-approach
61+
techdocs:
62+
builder: 'local' # Alternatives - 'external'
63+
generator:
64+
runIn: 'docker' # Alternatives - 'local'
65+
publisher:
66+
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
67+
68+
auth:
69+
# see https://backstage.io/docs/auth/ to learn about auth providers
70+
providers: {}
71+
72+
scaffolder:
73+
# see https://backstage.io/docs/features/software-templates/configuration for software template options
74+
75+
catalog:
76+
import:
77+
entityFilename: catalog-info.yaml
78+
pullRequestBranchName: backstage-integration
79+
rules:
80+
- allow: [Component, System, API, Resource, Location]
81+
locations:
82+
# Local example data, file locations are relative to the backend process, typically `packages/backend`
83+
- type: file
84+
target: ../../examples/entities.yaml
85+
86+
# Local example template
87+
- type: file
88+
target: ../../examples/template/template.yaml
89+
rules:
90+
- allow: [Template]
91+
92+
# Local example organizational data
93+
- type: file
94+
target: ../../examples/org.yaml
95+
rules:
96+
- allow: [User, Group]
97+
98+
## Uncomment these lines to add more example data
99+
# - type: url
100+
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
101+
102+
## Uncomment these lines to add an example org
103+
# - type: url
104+
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
105+
# rules:
106+
# - allow: [User, Group]

0 commit comments

Comments
 (0)