-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade 16 #58
Upgrade 16 #58
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ examples | |
*.github | ||
*.log | ||
*.git | ||
**/.swc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "1.14.2" | ||
"version": "1.16.0" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the upgrade path, I followed the instructions on https://backstage.github.io/upgrade-helper/?from=1.14.2&to=1.16.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,78 @@ | ||
# From https://github.com/janus-idp/backstage-showcase/ | ||
# Stage 1 - Install dependencies | ||
FROM registry.access.redhat.com/ubi9/nodejs-18:latest AS deps | ||
# Stage 1 - Build nodejs skeleton | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the janus show case docker file at the v 1.15 upgrade as the basis for this docker file. It's pretty much the same except for adding in plugins and removing techdocs dependencies as techdocs are external for us |
||
|
||
FROM registry.access.redhat.com/ubi9/nodejs-18:1-80.1699550448 AS skeleton | ||
USER 0 | ||
|
||
RUN dnf install -y -q --allowerasing --nobest \ | ||
python3 gcc gcc-c++ zlib-devel brotli-devel openssl-devel && \ | ||
dnf update -y && dnf clean all | ||
|
||
|
||
# Env vars | ||
ENV YARN=./.yarn/releases/yarn-1.22.19.cjs | ||
ENV REMOTE_SOURCES=. | ||
ENV REMOTE_SOURCES_DIR=/opt/app-root/src | ||
ENV EXTERNAL_SOURCE=. | ||
ENV CONTAINER_SOURCE=/opt/app-root/src | ||
|
||
WORKDIR $REMOTE_SOURCES_DIR/ | ||
COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR | ||
RUN chmod +x $REMOTE_SOURCES_DIR/.yarn/releases/yarn-1.22.19.cjs | ||
WORKDIR $CONTAINER_SOURCE/ | ||
COPY $EXTERNAL_SOURCE/.yarn ./.yarn | ||
COPY $EXTERNAL_SOURCE/.yarnrc.yml ./ | ||
RUN chmod +x "$YARN" | ||
|
||
# Remove all files except package.json | ||
RUN find packages -mindepth 2 -maxdepth 2 \! -name "package.json" -exec rm -rf {} \+ | ||
# Stage 2 - Install dependencies | ||
FROM skeleton AS deps | ||
|
||
RUN $YARN install --frozen-lockfile --network-timeout 600000 --ignore-scripts | ||
COPY $EXTERNAL_SOURCE/package.json $EXTERNAL_SOURCE/yarn.lock ./ | ||
COPY $EXTERNAL_SOURCE/packages/app/package.json ./packages/app/package.json | ||
COPY $EXTERNAL_SOURCE/packages/backend/package.json ./packages/backend/package.json | ||
COPY $EXTERNAL_SOURCE/plugins/ ./plugins/ | ||
|
||
# Stage 2 - Build packages | ||
FROM registry.access.redhat.com/ubi9/nodejs-18:latest AS build | ||
USER 0 | ||
RUN "$YARN" install --frozen-lockfile --network-timeout 600000 | ||
|
||
# Env vars | ||
ENV YARN=./.yarn/releases/yarn-1.22.19.cjs | ||
ENV REMOTE_SOURCES=. | ||
ENV REMOTE_SOURCES_DIR=/opt/app-root/src | ||
# Stage 3 - Build packages | ||
FROM deps AS build | ||
|
||
WORKDIR $REMOTE_SOURCES_DIR/ | ||
COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR | ||
COPY --from=deps $REMOTE_SOURCES_DIR $REMOTE_SOURCES_DIR | ||
RUN chmod +x $REMOTE_SOURCES_DIR/.yarn/releases/yarn-1.22.19.cjs | ||
RUN git config --global --add safe.directory $REMOTE_SOURCES_DIR/ | ||
COPY $EXTERNAL_SOURCE ./ | ||
RUN git config --global --add safe.directory ./ | ||
|
||
RUN $YARN tsc | ||
RUN $YARN build:backend | ||
|
||
# Stage 3 - Build the actual backend image and install production dependencies | ||
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1 AS runner | ||
USER 0 | ||
|
||
# Install gzip for tar and clean up | ||
RUN microdnf install -y gzip && microdnf clean all | ||
|
||
# Env vars | ||
ENV YARN=./.yarn/releases/yarn-1.22.19.cjs | ||
ENV REMOTE_SOURCES=. | ||
ENV REMOTE_SOURCES_DIR=/opt/app-root/src | ||
|
||
WORKDIR $REMOTE_SOURCES_DIR/ | ||
COPY --from=build --chown=1001:1001 $REMOTE_SOURCES_DIR/.yarn $REMOTE_SOURCES_DIR/.yarn | ||
COPY --from=build --chown=1001:1001 $REMOTE_SOURCES_DIR/.yarnrc.yml $REMOTE_SOURCES_DIR/ | ||
RUN chmod +x $REMOTE_SOURCES_DIR/.yarn/releases/yarn-1.22.19.cjs | ||
# Stage 4 - Build the actual backend image and install production dependencies | ||
FROM skeleton AS cleanup | ||
|
||
# Copy the install dependencies from the build stage and context | ||
COPY --from=build --chown=1001:1001 $REMOTE_SOURCES_DIR/yarn.lock $REMOTE_SOURCES_DIR/package.json $REMOTE_SOURCES_DIR/packages/backend/dist/skeleton.tar.gz $REMOTE_SOURCES_DIR/ | ||
COPY --from=build $CONTAINER_SOURCE/yarn.lock $CONTAINER_SOURCE/package.json $CONTAINER_SOURCE/packages/backend/dist/skeleton.tar.gz ./ | ||
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz | ||
|
||
# Copy the built packages from the build stage | ||
COPY --from=build --chown=1001:1001 $REMOTE_SOURCES_DIR/packages/backend/dist/bundle.tar.gz $REMOTE_SOURCES_DIR/ | ||
RUN tar xzf $REMOTE_SOURCES_DIR/bundle.tar.gz && rm $REMOTE_SOURCES_DIR/bundle.tar.gz | ||
COPY --from=build $CONTAINER_SOURCE/packages/backend/dist/bundle.tar.gz ./ | ||
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz | ||
|
||
# Copy any other files that we need at runtime | ||
COPY --chown=1001:1001 $REMOTE_SOURCES/app-config.yaml \ | ||
$REMOTE_SOURCES/app-config.production.yaml \ | ||
$REMOTE_SOURCES/catalog-info.yaml \ | ||
$REMOTE_SOURCES/catalog-seed.yaml $REMOTE_SOURCES_DIR/ | ||
# Copy app-config files needed in runtime | ||
COPY $EXTERNAL_SOURCE/app-config.yaml \ | ||
$EXTERNAL_SOURCE/app-config.production.yaml \ | ||
$EXTERNAL_SOURCE/catalog-info.yaml \ | ||
$EXTERNAL_SOURCE/catalog-seed.yaml ./ | ||
|
||
# Install production dependencies | ||
RUN $YARN install --frozen-lockfile --production --network-timeout 600000 --ignore-scripts && $YARN cache clean | ||
RUN "$YARN" install --frozen-lockfile --production --network-timeout 600000 && "$YARN" cache clean | ||
|
||
# Stage 5 - Build the runner image | ||
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1-85.1699549021 AS runner | ||
USER 0 | ||
|
||
# Env vars | ||
ENV YARN=./.yarn/releases/yarn-1.22.19.cjs | ||
ENV CONTAINER_SOURCE=/opt/app-root/src | ||
|
||
WORKDIR $CONTAINER_SOURCE/ | ||
COPY --from=cleanup --chown=1001:1001 $CONTAINER_SOURCE/ ./ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line gives a Security Hotspot warning in Sonar Cloud. But, janus-idp/backstage-showcase#374 (comment) indicates it is a false positive There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going to mark it as such in Sonar, if that is alright with everyone |
||
# The fix-permissions script is important when operating in environments that dynamically use a random UID at runtime, such as OpenShift. | ||
# The upstream backstage image does not account for this and it causes the container to fail at runtime. | ||
RUN fix-permissions $REMOTE_SOURCES_DIR/ | ||
|
||
RUN fix-permissions ./ | ||
# Switch to nodejs user | ||
USER 1001 | ||
|
||
ENTRYPOINT ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,34 +16,36 @@ | |
"build-image": "docker build ../.. -f Dockerfile --tag backstage" | ||
}, | ||
"dependencies": { | ||
"@backstage/backend-common": "^0.18.5", | ||
"@backstage/backend-tasks": "^0.5.2", | ||
"@backstage/catalog-client": "^1.4.1", | ||
"@backstage/catalog-model": "^1.3.0", | ||
"@backstage/config": "^1.0.7", | ||
"@backstage/plugin-app-backend": "^0.3.45", | ||
"@backstage/plugin-auth-backend": "^0.18.3", | ||
"@backstage/plugin-auth-node": "^0.2.14", | ||
"@backstage/plugin-catalog-backend": "^1.9.1", | ||
"@backstage/plugin-catalog-backend-module-github": "^0.3.0", | ||
"@backstage/plugin-permission-common": "^0.7.5", | ||
"@backstage/plugin-permission-node": "^0.7.8", | ||
"@backstage/plugin-proxy-backend": "^0.2.39", | ||
"@backstage/plugin-scaffolder-backend": "^1.14.0", | ||
"@backstage/plugin-search-backend": "^1.3.1", | ||
"@backstage/plugin-search-backend-module-pg": "^0.5.6", | ||
"@backstage/plugin-search-backend-node": "^1.2.1", | ||
"@backstage/backend-common": "^0.19.1", | ||
"@backstage/backend-tasks": "^0.5.4", | ||
"@backstage/catalog-client": "^1.4.3", | ||
"@backstage/catalog-model": "^1.4.1", | ||
"@backstage/config": "^1.0.8", | ||
"@backstage/plugin-app-backend": "^0.3.47", | ||
"@backstage/plugin-auth-backend": "^0.20.0", | ||
"@backstage/plugin-auth-node": "^0.2.16", | ||
"@backstage/plugin-catalog-backend": "^1.11.0", | ||
"@backstage/plugin-catalog-backend-module-github": "^0.3.2", | ||
"@backstage/plugin-permission-common": "^0.7.7", | ||
"@backstage/plugin-permission-node": "^0.7.10", | ||
"@backstage/plugin-proxy-backend": "^0.4.5", | ||
"@backstage/plugin-scaffolder-backend": "^1.15.1", | ||
"@backstage/plugin-search-backend": "^1.3.3", | ||
"@backstage/plugin-search-backend-module-pg": "^0.5.8", | ||
"@backstage/plugin-search-backend-node": "^1.2.3", | ||
"@backstage/plugin-stack-overflow-backend": "^0.2.6", | ||
"@backstage/plugin-techdocs-backend": "^1.6.2", | ||
"@backstage/plugin-techdocs-backend": "^1.6.4", | ||
"app": "link:../app", | ||
"dockerode": "^3.3.1", | ||
"express": "^4.17.1", | ||
"express-promise-router": "^4.1.0", | ||
"pg": "^8.10.0", | ||
"winston": "^3.2.1" | ||
"winston": "^3.2.1", | ||
"node-gyp": "^9.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add node-gyp as per backstage/backstage#20695 |
||
"isolated-vm": "4.6.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.22.7", | ||
"@backstage/cli": "^0.22.9", | ||
"@types/dockerode": "^3.3.0", | ||
"@types/express": "^4.17.6", | ||
"@types/express-serve-static-core": "^4.17.5", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was originally added when I added the snowplow js script to the header in the summer time.
I removed this line because it was interfering with the isolated-vm change. With this line in place, the website would show a blank page with the error in the web browser developer tools of:
"EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' *.gov.bc.ca"."
I checked that the current analytics is working without it by using the Chrome snowplow plugin. I could see the page view for the environment I was working in (tools).