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

Umami fails to start due to Prisma being unable to locate OpenSSL after Docker image build #3107

Closed
aphilas opened this issue Dec 12, 2024 · 13 comments
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@aphilas
Copy link

aphilas commented Dec 12, 2024

Describe the Bug

umami fails to start after building from v2.14.0 with docker.

check-db fails because prisma cannot find openssl. see logs below for more.

  • create the files below in the appropriate directory
# .env
UMAMI_DB_USER=umami
UMAMI_DB_PASSWORD=password
UMAMI_DB_NAME=umami
UMAMI_APP_SECRET=vwVXk1Y52GLLJWSC
# docker-compose.yaml
services:
  umami:
    build:
      context: https://github.com/umami-software/umami.git#v2.14.0
      args:
        BASE_PATH: /umami
        DATABASE_TYPE: postgresql
    environment:
      PORT: "4000"
      DATABASE_URL: postgres://${UMAMI_DB_USER}:${UMAMI_DB_PASSWORD}@umami-db:5432/${UMAMI_DB_NAME}
      DATABASE_TYPE: postgresql
      APP_SECRET: ${UMAMI_APP_SECRET}
      DISABLE_TELEMETRY: 1
    healthcheck:
      test: ["CMD-SHELL", "curl http://localhost:4000/api/heartbeat"]
      interval: 60s
      timeout: 15s
      retries: 5
    depends_on:
      umami-db:
        condition: service_healthy
    deploy:
      resources:
        limits:
          memory: 2G
          cpus: "1"

  umami-db:
    image: postgres:15-alpine
    environment:
      - POSTGRES_PASSWORD=${UMAMI_DB_PASSWORD}
      - POSTGRES_USER=${UMAMI_DB_USER}
      - POSTGRES_DB=${UMAMI_DB_NAME}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 60s
      timeout: 15s
      retries: 5
    volumes:
      - umami_pg_data:/var/lib/postgresql/data

volumes:
  umami_pg_data:
  • run the commands to start the service

Related issues:

Database

PostgreSQL

Relevant log output

$ docker compose up --wait --wait-timeout 360
[+] Running 0/10s (0/1)                             docker:default
 ⠇ Service umami  Building                                                                                                                 546.9s 
[+] Building 549.1s (25/25) FINISHED                                                                                               docker:default
 => CACHED [umami internal] load git source https://github.com/umami-software/umami.git#v2.13.2                                              1.2s
 => [umami internal] load metadata for docker.io/library/node:18-alpine                                                                      2.2s
 => [umami deps 1/6] FROM docker.io/library/node:18-alpine@sha256:6eb9c3d9bd191bd2cc6ce7ec3d5ec4c2127616140c8586af96a6bec8f28689d1           0.0s
 => CACHED [umami builder 2/6] WORKDIR /app                                                                                                  0.0s
 => CACHED [umami runner  3/12] RUN addgroup --system --gid 1001 nodejs                                                                      0.0s
 => CACHED [umami runner  4/12] RUN adduser --system --uid 1001 nextjs                                                                       0.0s
 => CACHED [umami runner  5/12] RUN set -x     && apk add --no-cache curl     && yarn add npm-run-all dotenv semver prisma@5.17.0            0.0s
 => CACHED [umami deps 2/6] RUN apk add --no-cache libc6-compat                                                                              0.0s
 => CACHED [umami deps 3/6] WORKDIR /app                                                                                                     0.0s
 => CACHED [umami deps 4/6] COPY package.json yarn.lock ./                                                                                   0.0s
 => CACHED [umami deps 5/6] RUN yarn config set network-timeout 300000                                                                       0.0s
 => [umami deps 6/6] RUN yarn install --frozen-lockfile                                                                                    428.5s 
 => [umami builder 3/6] COPY --from=deps /app/node_modules ./node_modules                                                                    7.0s 
 => [umami builder 4/6] COPY . .                                                                                                             1.4s 
 => [umami builder 5/6] COPY docker/middleware.js ./src                                                                                      0.1s 
 => [umami builder 6/6] RUN yarn build-docker                                                                                               89.0s 
 => [umami runner  6/12] COPY --from=builder /app/next.config.js .                                                                           0.4s 
 => [umami runner  7/12] COPY --from=builder --chown=nextjs:nodejs /app/public ./public                                                      0.4s 
 => [umami runner  8/12] COPY --from=builder /app/package.json ./package.json                                                                0.2s 
 => [umami runner  9/12] COPY --from=builder /app/prisma ./prisma                                                                            0.2s 
 => [umami runner 10/12] COPY --from=builder /app/scripts ./scripts                                                                          0.2s 
 => [umami runner 11/12] COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./                                                  0.9s 
 => [umami runner 12/12] COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static                                          0.1s
 => [umami] exporting to image                                                                                                               2.4s
 => => exporting layers                                                                                                                      2.4s 
 => => writing image sha256:3bcf30ec07e86ba97c2b4eee7915bfbe5e61bf0ac67a5f043dca027b2ae925a9                                                 0.0s
[+] Running 4/5o docker.io/library/umami-reprex-umami                                                                                        0.0s
 ✔ Service umami                        Built                                                                                              549.2s 
 ✔ Network umami-reprex_default         Created                                                                                              0.1s 
 ✔ Volume "umami-reprex_umami_pg_data"  Created                                                                                              0.0s 
 ✔ Container umami-reprex-umami-db-1    Healthy                                                                                             61.5s 
 ⠇ Container umami-reprex-umami-1       Waiting                                                                                             62.5s 
container umami-reprex-umami-1 exited (1)

$ docker compose logs umami
umami-1  | yarn run v1.22.22
umami-1  | $ npm-run-all check-db update-tracker start-server
umami-1  | $ node scripts/check-db.js
umami-1  | ✓ DATABASE_URL is defined.
umami-1  | prisma:warn Prisma failed to detect the libssl/openssl v
ersion to use, and may not work as expected. Defaulting to "openssl-1.1.x".                                                           umami-1  | Please manually install OpenSSL and try installing Prism
a again.                                                           umami-1  | ✗ Unable to connect to the database: Unable to require(`
/app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node`).                                                                umami-1  | The Prisma engines do not seem to be compatible with you
r system. Please refer to the documentation about Prisma's system requirements: https://pris.ly/d/system-requirements                 umami-1  | 
umami-1  | Details: Error loading shared library libssl.so.1.1: No 
such file or directory (needed by /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node)                                umami-1  | error Command failed with exit code 1.
umami-1  | info Visit https://yarnpkg.com/en/docs/cli/run for docum
entation about this command.                                       umami-1  | ERROR: "check-db" exited with 1.
umami-1  | error Command failed with exit code 1.
umami-1  | info Visit https://yarnpkg.com/en/docs/cli/run for docum
entation about this command.

Which Umami version are you using? (if relevant)

v2.14.0

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Docker

@aphilas
Copy link
Author

aphilas commented Dec 12, 2024

If I make the following changes, it works:

# Dockerfile
- && apk add --no-cache curl \
+ && apk add --no-cache curl openssl \
# db/postgresql/schema.prisma
generator client {
  provider = "prisma-client-js"
+ binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
docker compose -f docker-compose.fix.yml up --build --wait --wait-timeout 360
[+] Running 0/0
[+] Running 0/1i  Building                                                                  0.1s 
[+] Building 153.8s (27/27) FINISHED                                              docker:default 
 => [umami internal] load build definition from Dockerfile                                  0.0s
 => => transferring dockerfile: 1.83kB                                                      0.0s
 => [umami internal] load metadata for docker.io/library/node:18-alpine                     2.8s 
 => [umami internal] load .dockerignore                                                     0.0s
 => => transferring context: 114B                                                           0.0s
 => [umami internal] load build context                                                     0.3s
 => => transferring context: 92.14kB                                                        0.2s
 => [umami deps 1/6] FROM docker.io/library/node:18-alpine@sha256:6eb9c3d9bd191bd2cc6ce7ec  0.0s 
 => CACHED [umami builder 2/6] WORKDIR /app                                                 0.0s
 => CACHED [umami deps 2/6] RUN apk add --no-cache libc6-compat                             0.0s
 => CACHED [umami deps 3/6] WORKDIR /app                                                    0.0s
 => CACHED [umami deps 4/6] COPY package.json yarn.lock ./                                  0.0s
 => CACHED [umami deps 5/6] RUN yarn config set network-timeout 300000                      0.0s
 => CACHED [umami deps 6/6] RUN yarn install --frozen-lockfile                              0.0s
 => CACHED [umami builder 3/6] COPY --from=deps /app/node_modules ./node_modules            0.0s
 => [umami builder 4/6] COPY . .                                                            0.7s 
 => [umami builder 5/6] COPY docker/middleware.js ./src                                     0.1s
 => [umami builder 6/6] RUN yarn build-docker                                             139.2s 
 => CACHED [umami runner  3/12] RUN addgroup --system --gid 1001 nodejs                     0.0s 
 => CACHED [umami runner  4/12] RUN adduser --system --uid 1001 nextjs                      0.0s 
 => CACHED [umami runner  5/12] RUN set -x     && apk add --no-cache curl openssl     && y  0.0s 
 => CACHED [umami runner  6/12] COPY --from=builder /app/next.config.js .                   0.0s 
 => CACHED [umami runner  7/12] COPY --from=builder --chown=nextjs:nodejs /app/public ./pu  0.0s 
 => CACHED [umami runner  8/12] COPY --from=builder /app/package.json ./package.json        0.0s 
 => [umami runner  9/12] COPY --from=builder /app/prisma ./prisma                           0.1s
 => [umami runner 10/12] COPY --from=builder /app/scripts ./scripts                         0.1s 
 => [umami runner 11/12] COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone .  1.3s 
 => [umami runner 12/12] COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.ne  0.2s 
 => [umami] exporting to image                                                              4.4s
 => => exporting layers                                                                     4.4s 
 => => writing image sha256:a32811cc65f62801b076ba2f0a041d47f8c796bcb81394136ae9fafa11e3fa  0.0s
[+] Running 3/3o docker.io/library/umami-umami                                              0.0s
 ✔ Service umami               Built                                                      154.0s 
 ✔ Container umami-umami-db-1  Healthy                                                      1.7s 
 ✔ Container umami-umami-1     Healthy                                                     62.7s 

@plttn
Copy link

plttn commented Dec 13, 2024

2.15 images from GHCR are failing for me as well on Rocky Linux 9.

@MatKlein
Copy link

Same here with Ubuntu 24.04.

@wyangx
Copy link

wyangx commented Dec 13, 2024

ubuntu22.04 same problem

@mikecao
Copy link
Collaborator

mikecao commented Dec 13, 2024

I rebuilt the image and pushed it out. Can you try downloading it again?

@MatKlein
Copy link

Works. Great job, thanks.

@wyangx
Copy link

wyangx commented Dec 13, 2024

Successfully started! Thank you!

@jermorin
Copy link

2024-12-13T08:01:49.115670159Z ✗ Unable to connect to the database: Prisma Client could not locate the Query Engine for runtime "linux-musl-arm64-openssl-3.0.x".
2024-12-13T08:01:49.115699519Z 
2024-12-13T08:01:49.115702519Z This happened because Prisma Client was generated for "linux-musl-arm64-openssl-1.1.x", but the actual deployment required "linux-musl-arm64-openssl-3.0.x".
2024-12-13T08:01:49.115705839Z Add "linux-musl-arm64-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
2024-12-13T08:01:49.115708839Z 
2024-12-13T08:01:49.115711119Z generator client {
2024-12-13T08:01:49.115713319Z   provider      = "prisma-client-js"
2024-12-13T08:01:49.115715719Z   binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"]
2024-12-13T08:01:49.115718399Z }
2024-12-13T08:01:49.115720639Z 
2024-12-13T08:01:49.115722759Z The following locations have been searched:
2024-12-13T08:01:49.115725119Z   /app/node_modules/.prisma/client
2024-12-13T08:01:49.115727719Z   /app/node_modules/@prisma/client
2024-12-13T08:01:49.115730079Z   /tmp/prisma-engines
2024-12-13T08:01:49.115732399Z   /app/prisma
2024-12-13T08:01:49.133586771Z error Command failed with exit code 1.
2024-12-13T08:01:49.133734972Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2024-12-13T08:01:49.155676845Z ERROR: "check-db" exited with 1.
2024-12-13T08:01:49.172989335Z error Command failed with exit code 1.
2024-12-13T08:01:49.173064695Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hello, I've updated to the latest version and get this error that seems to be related to the initial issue.

@aphilas
Copy link
Author

aphilas commented Dec 13, 2024

-      context: https://github.com/umami-software/umami.git#v2.14.0
+      context: https://github.com/umami-software/umami.git
$ docker compose up --build --wait --wait-timeout 360
 ✔ Service umami                      Built                                     625.9s 
 ✔ Container umami-reprex-umami-db-1  Heal...                                     1.5s 
 ✔ Container umami-reprex-umami-1     Healthy                                    61.5s 

building from master works for me. is there a forthcoming patch release?

@dreary-ennui
Copy link

2024-12-13T08:01:49.115670159Z ✗ Unable to connect to the database: Prisma Client could not locate the Query Engine for runtime "linux-musl-arm64-openssl-3.0.x".
2024-12-13T08:01:49.115699519Z 
2024-12-13T08:01:49.115702519Z This happened because Prisma Client was generated for "linux-musl-arm64-openssl-1.1.x", but the actual deployment required "linux-musl-arm64-openssl-3.0.x".
2024-12-13T08:01:49.115705839Z Add "linux-musl-arm64-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
2024-12-13T08:01:49.115708839Z 
2024-12-13T08:01:49.115711119Z generator client {
2024-12-13T08:01:49.115713319Z   provider      = "prisma-client-js"
2024-12-13T08:01:49.115715719Z   binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"]
2024-12-13T08:01:49.115718399Z }
2024-12-13T08:01:49.115720639Z 
2024-12-13T08:01:49.115722759Z The following locations have been searched:
2024-12-13T08:01:49.115725119Z   /app/node_modules/.prisma/client
2024-12-13T08:01:49.115727719Z   /app/node_modules/@prisma/client
2024-12-13T08:01:49.115730079Z   /tmp/prisma-engines
2024-12-13T08:01:49.115732399Z   /app/prisma
2024-12-13T08:01:49.133586771Z error Command failed with exit code 1.
2024-12-13T08:01:49.133734972Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2024-12-13T08:01:49.155676845Z ERROR: "check-db" exited with 1.
2024-12-13T08:01:49.172989335Z error Command failed with exit code 1.
2024-12-13T08:01:49.173064695Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hello, I've updated to the latest version and get this error that seems to be related to the initial issue.

I'm receiving this same error message with the latest image from the mysql-latest tag.

@aphilas
Copy link
Author

aphilas commented Dec 14, 2024

d43293d only updated db/postgresql/schema.prisma

db/mysql/schema.prisma probably needs to be updated as well

@madn00b
Copy link

madn00b commented Dec 14, 2024

Please fix for mysql

@mikecao mikecao added bug Something isn't working fixed in dev Fixed in the dev branch labels Dec 15, 2024
@mikecao
Copy link
Collaborator

mikecao commented Dec 15, 2024

Should be fixed in v2.15.1.

@mikecao mikecao closed this as completed Dec 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

9 participants