-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b53530e
commit a46c494
Showing
54 changed files
with
33,826 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: backstage | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- feature/* | ||
paths: | ||
- 'backstage/**' | ||
- .github/workflows/backstage.yaml | ||
|
||
jobs: | ||
build-and-publish-latest: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Repository | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Container Image to GitHub Container Repository | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./backstage | ||
push: true | ||
tags: ghcr.io/base2services/backstage:snapshot_${{env.GITHUB_REF_SLUG}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
dist-types | ||
node_modules | ||
packages/*/dist | ||
packages/*/node_modules | ||
plugins/*/dist | ||
plugins/*/node_modules | ||
*.local.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
playwright.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
root: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# macOS | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Coverage directory generated when running tests with coverage | ||
coverage | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Yarn files | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# Node version directives | ||
.nvmrc | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# Build output | ||
dist | ||
dist-types | ||
|
||
# Temporary change files created by Vim | ||
*.swp | ||
|
||
# MkDocs build output | ||
site | ||
|
||
# Local configuration files | ||
*.local.yaml | ||
|
||
# Sensitive credentials | ||
*-credentials.yaml | ||
|
||
# vscode database functionality support files | ||
*.session.sql | ||
|
||
# E2E test reports | ||
e2e-test-report/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist | ||
dist-types | ||
coverage | ||
.vscode |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.4.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Stage 1 - Create yarn install skeleton layer | ||
FROM node:20-bookworm-slim AS packages | ||
|
||
WORKDIR /app | ||
COPY package.json yarn.lock ./ | ||
COPY .yarn ./.yarn | ||
COPY .yarnrc.yml ./ | ||
|
||
COPY packages packages | ||
|
||
# Comment this out if you don't have any internal plugins | ||
COPY plugins plugins | ||
|
||
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {} \+ | ||
|
||
# Stage 2 - Install dependencies and build packages | ||
FROM node:20-bookworm-slim AS build | ||
|
||
# Set Python interpreter for `node-gyp` to use | ||
ENV PYTHON=/usr/bin/python3 | ||
|
||
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend. | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends python3 g++ build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image, | ||
# in which case you should also move better-sqlite3 to "devDependencies" in package.json. | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends libsqlite3-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
USER node | ||
WORKDIR /app | ||
|
||
COPY --from=packages --chown=node:node /app . | ||
COPY --from=packages --chown=node:node /app/.yarn ./.yarn | ||
COPY --from=packages --chown=node:node /app/.yarnrc.yml ./ | ||
|
||
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \ | ||
yarn install --immutable | ||
|
||
COPY --chown=node:node . . | ||
|
||
RUN yarn tsc | ||
RUN yarn --cwd packages/backend build | ||
|
||
RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \ | ||
&& tar xzf packages/backend/dist/skeleton.tar.gz -C packages/backend/dist/skeleton \ | ||
&& tar xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist/bundle | ||
|
||
# Stage 3 - Build the actual backend image and install production dependencies | ||
FROM node:20-bookworm-slim | ||
|
||
# Set Python interpreter for `node-gyp` to use | ||
ENV PYTHON=/usr/bin/python3 | ||
|
||
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend. | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends python3 g++ build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image, | ||
# in which case you should also move better-sqlite3 to "devDependencies" in package.json. | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends libsqlite3-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# From here on we use the least-privileged `node` user to run the backend. | ||
USER node | ||
|
||
# This should create the app dir as `node`. | ||
# If it is instead created as `root` then the `tar` command below will | ||
# fail: `can't create directory 'packages/': Permission denied`. | ||
# If this occurs, then ensure BuildKit is enabled (`DOCKER_BUILDKIT=1`) | ||
# so the app dir is correctly created as `node`. | ||
WORKDIR /app | ||
|
||
# Copy the install dependencies from the build stage and context | ||
COPY --from=build --chown=node:node /app/.yarn ./.yarn | ||
COPY --from=build --chown=node:node /app/.yarnrc.yml ./ | ||
COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./ | ||
# Note: The skeleton bundle only includes package.json files -- if your app has | ||
# plugins that define a `bin` export, the bin files need to be copied as well to | ||
# be linked in node_modules/.bin during yarn install. | ||
|
||
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \ | ||
yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)" | ||
|
||
# Copy the built packages from the build stage | ||
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./ | ||
|
||
# Copy any other files that we need at runtime | ||
COPY --chown=node:node app-config*.yaml ./ | ||
|
||
# This will include the examples, if you don't need these simply remove this line | ||
COPY --chown=node:node examples ./examples | ||
|
||
# This switches many Node.js dependencies to production mode. | ||
ENV NODE_ENV=production | ||
|
||
# This disables node snapshot for Node 20 to work with the Scaffolder | ||
ENV NODE_OPTIONS "--no-node-snapshot" | ||
|
||
CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# [Backstage](https://backstage.io) | ||
|
||
This is your newly scaffolded Backstage App, Good Luck! | ||
|
||
To start the app, run: | ||
|
||
```sh | ||
yarn install | ||
yarn dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
app: | ||
# Should be the same as backend.baseUrl when using the `app-backend` plugin. | ||
baseUrl: http://localhost:7007 | ||
|
||
backend: | ||
# Note that the baseUrl should be the URL that the browser and other clients | ||
# should use when communicating with the backend, i.e. it needs to be | ||
# reachable not just from within the backend host, but from all of your | ||
# callers. When its value is "http://localhost:7007", it's strictly private | ||
# and can't be reached by others. | ||
baseUrl: http://localhost:7007 | ||
# The listener can also be expressed as a single <host>:<port> string. In this case we bind to | ||
# all interfaces, the most permissive setting. The right value depends on your specific deployment. | ||
listen: ':7007' | ||
|
||
# config options: https://node-postgres.com/apis/client | ||
# database: | ||
# client: pg | ||
# connection: | ||
# host: ${POSTGRES_HOST} | ||
# port: ${POSTGRES_PORT} | ||
# user: ${POSTGRES_USER} | ||
# password: ${POSTGRES_PASSWORD} | ||
database: | ||
client: better-sqlite3 | ||
connection: ':memory:' | ||
# https://node-postgres.com/features/ssl | ||
# you can set the sslmode configuration option via the `PGSSLMODE` environment variable | ||
# see https://www.postgresql.org/docs/current/libpq-ssl.html Table 33.1. SSL Mode Descriptions (e.g. require) | ||
# ssl: | ||
# ca: # if you have a CA file and want to verify it you can uncomment this section | ||
# $file: <file-path>/ca/server.crt | ||
|
||
auth: | ||
providers: | ||
guest: {} | ||
|
||
catalog: | ||
# Overrides the default list locations from app-config.yaml as these contain example data. | ||
# See https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog for more details | ||
# on how to get entities into the catalog. | ||
locations: | ||
# Local example data, replace this with your production config, these are intended for demo use only. | ||
# File locations are relative to the backend process, typically in a deployed context, such as in a Docker container, this will be the root | ||
- type: file | ||
target: ./examples/entities.yaml | ||
|
||
# Local example template | ||
- type: file | ||
target: ./examples/template/template.yaml | ||
rules: | ||
- allow: [Template] | ||
|
||
# Local example organizational data | ||
- type: file | ||
target: ./examples/org.yaml | ||
rules: | ||
- allow: [User, Group] |
Oops, something went wrong.