Merge pull request #2364 from balena-os/avoid-unnecessary-config-calls-during-startup

Avoid unnecessary config calls during startup
This commit is contained in:
Christina Wang 2024-08-20 21:35:00 -07:00 committed by GitHub
commit 7f3a057797
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 10 deletions

View File

@ -7,7 +7,7 @@ ARG ALPINE_VERSION="3.19"
###################################################
# Build the supervisor dependencies
###################################################
FROM alpine:${ALPINE_VERSION} as build-base
FROM alpine:${ALPINE_VERSION} AS build-base
ARG ARCH
ARG NODE
@ -51,7 +51,7 @@ RUN npm ci --build-from-source=sqlite3 --sqlite=/usr/lib
# musl. We hack around this by copying the binary and its library
# dependencies to the final image
###################################################################
FROM debian:bullseye-slim as journal
FROM debian:bullseye-slim AS journal
RUN apt-get update && apt-get install -y --no-install-recommends systemd
@ -62,7 +62,7 @@ RUN /setup-journal.sh
# Extra dependencies. This uses alpine 3.11 as the
# procmail package was removed on 3.12
###################################################
FROM alpine:3.11 as extra
FROM alpine:3.11 AS extra
RUN apk add --update --no-cache procmail
@ -70,7 +70,7 @@ RUN apk add --update --no-cache procmail
# Image with the final production dependencies.
# This image will also be be used for testing
###################################################
FROM alpine:${ALPINE_VERSION} as runtime-base
FROM alpine:${ALPINE_VERSION} AS runtime-base
ARG NODE
@ -113,7 +113,7 @@ ENV LED_FILE=/dev/null \
###############################################################
# Use the base image to run integration tests and for livepush
###############################################################
FROM runtime-base as test
FROM runtime-base AS test
ARG NPM
ARG ARCH
@ -160,7 +160,7 @@ CMD npm run test:integration
###################################################
# Build the production package
###################################################
FROM build-base as build-prod
FROM build-base AS build-prod
WORKDIR /usr/src/app

View File

@ -45,8 +45,8 @@ export class Supervisor {
initializeContractRequirements({
supervisorVersion: version,
deviceType: await config.get('deviceType'),
deviceArch: await config.get('deviceArch'),
deviceType: conf.deviceType,
deviceArch: conf.deviceArch,
l4tVersion: await osRelease.getL4tVersion(),
});
@ -58,9 +58,8 @@ export class Supervisor {
await deviceState.initialized();
const unmanaged = await config.get('unmanaged');
logger.logSystemMessage('Supervisor starting', {}, 'Supervisor start');
if (conf.legacyAppsPresent && !unmanaged) {
if (conf.legacyAppsPresent && !conf.unmanaged) {
log.info('Legacy app detected, running migration');
await normaliseLegacyDatabase();
}