Skip to content

Commit

Permalink
update to 1.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvshivkov committed Aug 20, 2024
1 parent 7b38194 commit 0c581a6
Show file tree
Hide file tree
Showing 24 changed files with 13,864 additions and 11,231 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ packages/*/dist
packages/*/node_modules
plugins/*/dist
plugins/*/node_modules
.yarn/cache
.yarn/install-state.gz
51 changes: 25 additions & 26 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,46 @@ env:
PROJECT: backstage

jobs:

build:
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
"${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}"
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
"${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}"
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false

push_if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,13 @@ site

# vscode database functionality support files
*.session.sql
app-config.yaml

# Yarn 3 files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.0.cjs

Large diffs are not rendered by default.

46 changes: 21 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.2

# Stage 1 - Create yarn install skeleton layer
FROM node:18-bookworm-slim AS packages
FROM node:20-bookworm-slim AS packages

WORKDIR /app
COPY package.json yarn.lock ./
Expand All @@ -14,17 +14,17 @@ 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:18-bookworm-slim AS build
FROM node:20-bookworm-slim AS build

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential && \
yarn config set python /usr/bin/python3
# Set Python interpreter for `node-gyp` to use
ENV PYTHON /usr/bin/python3

# 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.
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev
apt-get install -y --no-install-recommends python3 g++ build-essential libsqlite3-dev && \
rm -rf /var/lib/apt/lists/* && \
corepack enable && \
corepack prepare [email protected] --activate

USER node
WORKDIR /app
Expand All @@ -34,7 +34,8 @@ COPY --from=packages --chown=node:node /app .
ENV CYPRESS_CACHE_FOLDER /app/cypress_cache
RUN mkdir -p /app/cypress_cache && chown -R node:node /app/cypress_cache

RUN yarn install --frozen-lockfile --network-timeout 600000
RUN yarn workspaces focus --all --production && \
rm -rf "$(yarn cache clean)"

COPY --chown=node:node . .

Expand All @@ -48,34 +49,29 @@ RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
&& 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:18-bookworm-slim
FROM node:20-bookworm-slim

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential git && \
yarn config set python /usr/bin/python3
apt-get install -y --no-install-recommends python3 g++ build-essential git libsqlite3-dev && \
rm -rf /var/lib/apt/lists/* && \
corepack enable && \
corepack prepare [email protected] --activate

# 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 apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev

# 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.lock /app/package.json /app/packages/backend/dist/skeleton/ ./

RUN mkdir -p /app/cypress_cache && chown -R node:node /app/cypress_cache
COPY --from=build --chown=node:node /app/.yarn ./.yarn
COPY --from=build --chown=node:node /app/.yarnrc.yml ./

RUN yarn install --frozen-lockfile --production --network-timeout 600000
RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,sharing=locked,uid=1000,gid=1000 \
yarn workspaces focus --all --production

# Copy the built packages from the build stage
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ yarn dev
```

To build container, run:

```sh
yarn tsc
yarn build:backend
Expand Down
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.29.2"
"version": "1.30.0"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"@asyncapi/react-component"
]
},
"packageManager": "yarn@3.5.0",
"packageManager": "yarn@4.4.0",
"dependencies": {
"@backstage-community/plugin-tech-radar": "^0.7.6"
"@types/node-fetch": "^2.6.11"
}
}
55 changes: 54 additions & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,91 @@
"lint": "backstage-cli package lint"
},
"dependencies": {
"@backstage-community/plugin-adr-backend": "^0.4.15",
"@backstage-community/plugin-cicd-statistics": "^0.1.38",
"@backstage-community/plugin-explore-backend": "^0.0.28",
"@backstage-community/plugin-explore-common": "^0.0.3",
"@backstage-community/plugin-gcalendar": "^0.3.29",
"@backstage-community/plugin-tech-insights-backend": "^0.5.32",
"@backstage-community/plugin-tech-insights-backend-module-jsonfc": "^0.1.50",
"@backstage-community/plugin-tech-insights-node": "^0.6.1",
"@backstage-community/plugin-tech-radar": "^0.7.6",
"@backstage/app-defaults": "^1.5.10",
"@backstage/backend-common": "^0.24.0",
"@backstage/backend-defaults": "^0.4.2",
"@backstage/backend-dynamic-feature-service": "^0.3.0",
"@backstage/backend-tasks": "^0.6.0",
"@backstage/catalog-client": "^1.6.6",
"@backstage/catalog-model": "^1.6.0",
"@backstage/cli": "^0.27.0",
"@backstage/config": "^1.2.0",
"@backstage/core-app-api": "^1.14.2",
"@backstage/core-components": "^0.14.10",
"@backstage/core-plugin-api": "^1.9.3",
"@backstage/integration": "^1.14.0",
"@backstage/integration-react": "^1.1.30",
"@backstage/plugin-api-docs": "^0.11.8",
"@backstage/plugin-app-backend": "^0.3.72",
"@backstage/plugin-auth-backend": "^0.22.10",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.1.9",
"@backstage/plugin-auth-node": "^0.5.0",
"@backstage/plugin-catalog": "^1.22.0",
"@backstage/plugin-catalog-backend": "^1.25.0",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.21",
"@backstage/plugin-catalog-common": "^1.0.26",
"@backstage/plugin-catalog-graph": "^0.4.8",
"@backstage/plugin-catalog-import": "^0.12.2",
"@backstage/plugin-catalog-react": "^1.12.3",
"@backstage/plugin-home": "^0.7.9",
"@backstage/plugin-kubernetes-backend": "^0.18.4",
"@backstage/plugin-org": "^0.6.28",
"@backstage/plugin-permission-backend": "^0.5.47",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.1.20",
"@backstage/plugin-permission-common": "^0.8.1",
"@backstage/plugin-permission-node": "^0.8.1",
"@backstage/plugin-permission-react": "^0.4.25",
"@backstage/plugin-proxy-backend": "^0.5.4",
"@backstage/plugin-scaffolder": "^1.24.0",
"@backstage/plugin-scaffolder-backend": "^1.24.0",
"@backstage/plugin-search": "^1.4.15",
"@backstage/plugin-search-backend": "^1.5.15",
"@backstage/plugin-search-backend-module-catalog": "^0.2.0",
"@backstage/plugin-search-backend-module-pg": "^0.5.33",
"@backstage/plugin-search-backend-module-techdocs": "^0.2.0",
"@backstage/plugin-search-backend-node": "^1.3.0",
"@backstage/plugin-search-react": "^1.7.14",
"@backstage/plugin-techdocs": "^1.10.8",
"@backstage/plugin-techdocs-backend": "^1.10.10",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.13",
"@backstage/plugin-techdocs-react": "^1.2.7",
"@backstage/plugin-user-settings": "^0.8.11",
"@backstage/test-utils": "^1.5.10",
"@backstage/theme": "^0.5.6",
"@internal/backstage-plugin-cicd-statistics-module-zuul": "workspace:^",
"@internal/scaffolder-backend-module-otc": "^0.1.0",
"@janus-idp/backstage-plugin-keycloak-backend": "^1.13.1",
"@k-phoen/backstage-plugin-grafana": "^0.1.22",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@roadiehq/scaffolder-backend-argocd": "^1.1.27",
"@roadiehq/scaffolder-backend-module-http-request": "^4.3.2",
"@roadiehq/scaffolder-backend-module-utils": "^1.17.1",
"@types/passport-oauth2": "^1.4.12",
"app": "link:../app",
"better-sqlite3": "^7.5.0",
"dockerode": "^3.3.1",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"history": "^5.0.0",
"node-fetch": "^2.6.7",
"passport-oauth2": "^1.7.0",
"pg": "^8.3.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-use": "^17.2.4"
"react-use": "^17.2.4",
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/test-utils": "^1.5.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ export default app.createRoot(
<Root>{routes}</Root>
</AppRouter>
</>,
);
);
2 changes: 1 addition & 1 deletion packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
</Sidebar>
{children}
</SidebarPage>
);
);
2 changes: 1 addition & 1 deletion packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,4 @@ export const entityPage = (

<EntitySwitch.Case>{defaultEntityPage}</EntitySwitch.Case>
</EntitySwitch>
);
);
4 changes: 2 additions & 2 deletions packages/app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@backstage/cli/asset-types';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
29 changes: 20 additions & 9 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,49 @@
#
# Once the commands have been run, you can build the image using `yarn build-image`

FROM node:16-bullseye-slim
FROM node:18-bookworm-slim

# 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.
# Additionally, we install dependencies for `techdocs.generator.runIn: local`.
# https://backstage.io/docs/features/techdocs/getting-started#disabling-docker-in-docker-situation-optional
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 python3 build-essential && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 python3-pip python3-venv build-essential && \
yarn config set python /usr/bin/python3

# Set up a virtual environment for mkdocs-techdocs-core.
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip3 install mkdocs-techdocs-core==1.1.7

# From here on we use the least-privileged `node` user to run the backend.
WORKDIR /app
RUN chown node:node /app
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

# This switches many Node.js dependencies to production mode.
ENV NODE_ENV production

# Copy over Yarn 3 configuration, release, and plugins
COPY --chown=node:node .yarn ./.yarn
COPY --chown=node:node .yarnrc.yml ./

# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
# The skeleton contains the package.json of each package in the monorepo,
# and along with yarn.lock and the root package.json, that's enough to run yarn install.
COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz

RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
yarn install --frozen-lockfile --production --network-timeout 300000
RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,sharing=locked,uid=1000,gid=1000 \
yarn workspaces focus --all --production

# Then copy the rest of the backend bundle, along with any other files we might want.
COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz

CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"]
CMD ["node", "packages/backend", "--config", "app-config.yaml"]
Loading

0 comments on commit 0c581a6

Please sign in to comment.