vinzscam / backstage-chart

Backstage Helm Chart
27 stars 10 forks source link

Config validation failed, Config must have required property 'techdocs' { missingProperty=techdocs } #18

Open bainss opened 2 years ago

bainss commented 2 years ago

Hi

I'm using the following Dockerfile.

FROM node:16-bullseye-slim

WORKDIR /app

# install sqlite3 dependencies, you can skip this if you don't use sqlite3 in the image
RUN apt-get update && \
    apt-get install -y --no-install-recommends  python3 build-essential pip curl openjdk-11-jdk graphviz fontconfig && \
    rm -rf /var/lib/apt/lists/* && \
    yarn config set python /usr/bin/python3

# 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 yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz

RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
RUN yarn add --cwd packages/app @backstage/plugin-techdocs --network-timeout 100000
RUN yarn add --cwd packages/backend @backstage/plugin-techdocs-backend --network-timeout 100000

# Download plantuml file, Validate checksum & Move plantuml file
RUN curl -o plantuml.jar -L http://sourceforge.net/projects/plantuml/files/plantuml.1.2022.4.jar/download && echo "246d1ed561ebbcac14b2798b45712a9d018024c0  plantuml.jar" | sha1sum -c - && mv plantuml.jar /opt/plantuml.jar

# Install the mkdocs python package
RUN pip install mkdocs-techdocs-core==1.0.2

# Create script to call plantuml.jar from a location in path
RUN echo $'#!/bin/sh\n\njava -jar '/opt/plantuml.jar' ${@}' >> /usr/local/bin/plantuml
RUN chmod 755 /usr/local/bin/plantuml

# Then copy the rest of the backend bundle, along with any other files we might want.
COPY 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"]

with app-config.yaml as follows

  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
    listen:
      port: 7007
      # The following host directive binds to all IPv4 interfaces when its value
      # is "0.0.0.0". This is the most permissive setting. The right value depends
      # on your specific deployment. If you remove the host line entirely, the
      # backend will bind on the interface that corresponds to the backend.baseUrl
      # hostname.
      host: 0.0.0.0

    # config options: https://node-postgres.com/api/client
    database:
      client: pg
      connection:
        host: ${POSTGRES_HOST}
        port: ${POSTGRES_PORT}
        user: ${POSTGRES_USER}
        password: ${POSTGRES_PASSWORD}
        # 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

  catalog:
    # Overrides the default list locations from app-config.yaml as these contain example data.
    # See https://backstage.io/docs/features/software-catalog/software-catalog-overview#adding-components-to-the-catalog for more details
    # on how to get entities into the catalog.
    locations: []

  techdocs:
    builder: 'local'
    publisher:
      type: 'local'
    generator:
      runIn: local
  However I still get an exception on startup 
2022-07-19T14:31:01.293Z search info Starting all scheduled search tasks. type=plugin
2
2022-07-19T14:31:01.874Z app info Serving static app content from /app/packages/app/dist type=plugin
1
Backend failed to start up, Error: Invalid app bundle schema. If this error is unexpected you need to run `yarn build` in the app. If that doesn't help you should make sure your config schema is correct and rebuild the app bundle again. Caused by the following schema error, Error: Config validation failed, Config must have required property 'techdocs' { missingProperty=techdocs } at
cmoulliard commented 2 years ago

techdocs:

Can you remove the 2 chars in front of each category (app, backend, catalog, techdocs) within the config file please ?

I dont have any issue when I pass the config file as configmap to backstage

Example of config file

DOMAIN_NAME="<VM_IP>.sslip.io"
cat <<EOF > $(pwd)/app-config.extra.yaml
app:
  baseUrl: http://backstage.$DOMAIN_NAME
  title: Backstage
backend:
  baseUrl: http://backstage.$DOMAIN_NAME
  cors:
    origin: http://backstage.$DOMAIN_NAME
    methods: [GET, POST, PUT, DELETE]
    credentials: true      
  csp:
    connect-src: ['self','http:','https:']
  database:
    client: better-sqlite3
    connection: ':memory:'
  cache:
    store: memory
techdocs:
  builder: 'local'
  generator:
    runIn: 'local'
  publisher:
    type: 'local'
catalog:
  locations:
  - type: url
    target: https://github.com/mclarke47/dice-roller/blob/master/catalog-info.yaml    
EOF

that the helm will use as such

cat <<EOF > $(pwd)/my-values.yml
backstage:
  extraAppConfig:
    - filename: app-config.extra.yaml
      configMapRef: my-app-config         
EOF

during deployment

and deploy it
```bash
helm upgrade --install \
  my-backstage \
  backstage \
  --repo https://vinzscam.github.io/backstage-chart \
  -f $(pwd)/my-values.yml \
  --create-namespace \
  -n backstage