Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Module sqlite is missing #6

Open
cmoulliard opened this issue Jun 20, 2022 · 5 comments
Open

Module sqlite is missing #6

cmoulliard opened this issue Jun 20, 2022 · 5 comments

Comments

@cmoulliard
Copy link
Contributor

Issue

When we deploy the helm chart

DOMAIN_NAME="192.168.1.90.nip.io"
cat <<EOF > $HOME/demo-backstage/my-values.yml
backstage:
  image:
    registry: "docker.io/library"
    repository: "backstage"
    tag: "dev"
EOF

helm repo add backstage https://vinzscam.github.io/backstage-chart
helm install -f $HOME/demo-backstage/my-values.yml  --create-namespace -n backstage my-backstage

from a project created using npx @backstage/create-app

npx @backstage/create-app
...
yarn dev
yarn build
yarn build-image -t backstage:dev
kind load docker-image backstage:dev

then we got the following error as by default the module better-sqlite3 is not packaged within the node application when we build it

Log of the backend pod

...
Backend failed to start up, Error: Knex: run
$ npm install @vscode/sqlite3 --save
Cannot find module 'better-sqlite3'
Require stack:
- /app/node_modules/knex/lib/dialects/better-sqlite3/index.js
- /app/node_modules/knex/lib/knex-builder/internal/config-resolver.js
- /app/node_modules/knex/lib/knex-builder/Knex.js
- /app/node_modules/knex/lib/index.js
- /app/node_modules/knex/knex.js
- /app/node_modules/@backstage/backend-common/dist/index.cjs.js
- /app/packages/backend/dist/index.cjs.js

The documentation page should include a warning message to explain how the image should be created and which packages should be packaged

@ChrisJBurns
Copy link
Contributor

So, as far as I'm aware this was because of the following bits of code in the Dockerfile that you can see on the backstage docs:

# 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 libsqlite3-dev python3 build-essential && \
    rm -rf /var/lib/apt/lists/* && \
    yarn config set python /usr/bin/python3

I had the same error until I remove that part from the Dockerfile and also made sure to change the database engine to postgres and not sqlite.

@cmoulliard
Copy link
Contributor Author

Previously the process to create an application was asking which DB the user wanted to use and the package was installed by the BuildAppTask but this option is gone since versions >= 1.2.

As the npx @backstage/create-app will not anymore package the dependencies of the DB, I suggest then to document part of this Helm documentation that additional packages should be added using the command yarn add --cwd packages/backend better-sqlite3, etc before to build the image.

WDYT ? @ChrisJBurns @vinzscam

@ChrisJBurns
Copy link
Contributor

To be honest, I don't even think it's worth mentioning. The backstage docs themselves say that sqlite are for local setups and local testing and that users should focus on using postgres for their real setup. Since the Helm Chart will be dealing with official deployments of Backstage in Kubernetes, I think we just completely drop the mentioning of sqlite across the board and only offer the ability to add config for external databases OR using the postgres offered by the subchart (as this will be a popular implementation method for those who want to use Backstage in hermetic environments (some banking firms, governments etc etc) and want to have their postgres instance inside of Kubernetes.

@cmoulliard
Copy link
Contributor Author

Since the Helm Chart will be dealing with official deployments of Backstage in Kubernetes, I think we just completely drop the mentioning of sqlite across the board and only offer the ability to add config for external databases OR using the postgres offered by the subchart (as this will be a popular implementation method for those who want to use Backstage in hermetic environments (some banking firms, governments etc etc) and want to have their postgres instance inside of Kubernetes.

So it is time that we include the helm postgresql sub-chart or dependency of this backstage helm chart to have a backstage application working on k8s ;-)

@ChrisJBurns
Copy link
Contributor

I agree! I've pushed up the newest changes on the weekend, let me know if all looks well 👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants