janus-idp / backstage-showcase

This repo is moving to https://github.com/redhat-developer/red-hat-developer-hub
https://janus-idp.io
Apache License 2.0
112 stars 152 forks source link

Deployment failed with sqlite backend #268

Closed gorkem closed 1 year ago

gorkem commented 1 year ago

What happened?

Deployment failed with the following error

Backend failed to start up Error: Could not locate the bindings file. Tried:
 → /opt/app-root/src/node_modules/better-sqlite3/build/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/build/Release/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/Debug/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/out/Release/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/Release/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/build/default/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/compiled/18.14.2/linux/x64/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
 → /opt/app-root/src/node_modules/better-sqlite3/lib/binding/node-v108-linux-x64/better_sqlite3.node
    at bindings (/opt/app-root/src/node_modules/bindings/bindings.js:126:9)
    at new Database (/opt/app-root/src/node_modules/better-sqlite3/lib/database.js:48:64)
    at Client_BetterSQLite3.acquireRawConnection (/opt/app-root/src/node_modules/knex/lib/dialects/better-sqlite3/index.js:12:12)
    at create (/opt/app-root/src/node_modules/knex/lib/client.js:254:39) {
  tries: [
    '/opt/app-root/src/node_modules/better-sqlite3/build/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/build/Debug/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/build/Release/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/out/Debug/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/Debug/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/out/Release/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/Release/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/build/default/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/compiled/18.14.2/linux/x64/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node',
    '/opt/app-root/src/node_modules/better-sqlite3/lib/binding/node-v108-linux-x64/better_sqlite3.node'
  ]
}

What are the steps to reproduce this issue?

Deployment with SQLite backend to a Kubernetes namespace

christophe-f commented 1 year ago

was it deployed with the helm chart?

tumido commented 1 year ago

was it deployed with the helm chart?

I don't think that's possible with the default values, helm chart defaults to deploying with PostgreSQL now.

gorkem commented 1 year ago

This is not with the Helm chart but deployed the image locally. The error is probably due to the image build failing to package things correctly. I expected the image to work regardless of local or helm deployment. If we are deliberately not supporting the SQLite with the image we can close this one.

Zaperex commented 1 year ago

Hi @gorkem, when I tried deploying it on a minikube cluster, the pods run properly and when I check the logs the backend appears to have started properly without the error above. However, I am getting a separate error defined in this issue. I worked around this issue by defining SONARQUBE_URL when I ran the image, and it worked with no issues afterwards.

I noticed that the better-sqlite3 dependency is already included in the backend package.json after running yarn build --filter=backend, so this issue might no longer be relevant?

image

The process I followed was to build using the current latest Dockerfile (for 1.15.0), uploading the image to quay.io with the default configurations from app-config.example.yaml and setting the database for app-config.production.example.yaml to a sqlite3 database:

-  database:
-   client: pg
-   connection:
-     host: ${POSTGRES_HOST}
-     password: ${POSTGRES_PASSWORD}
-     port: ${POSTGRES_PORT}
-     user: ${POSTGRES_USER}
+  database:
+    client: better-sqlite3
+    connection: ':memory:'

I then ran the following deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: backstage-showcase-deployment
  labels:
    app: backstage-showcase
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backstage-showcase
  template:
    metadata:
      labels:
        app: backstage-showcase
    spec:
      containers:
        - name: backstage-showcase
          image: quay.io/rh-ee-frkong/backstage-testing:latest
          ports:
            - containerPort: 7007

Could you perhaps provide a more detailed reproduction process? Such as what configurations you had?

gorkem commented 1 year ago

It is possible that the image I was using aat the time had the issue. I am closing this one.