Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

SQLite database error #18

Open
koshrf opened this issue Jan 6, 2025 · 4 comments
Open

SQLite database error #18

koshrf opened this issue Jan 6, 2025 · 4 comments

Comments

@koshrf
Copy link

koshrf commented Jan 6, 2025

Tried to do a compose up -d after a git clone of the repository, waited for the build and after few seconds the container goes down.

npm WARN exec The following package was not found and will be installed: [email protected]
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "dev.db" at "file:/data/dev.db"

Error: Schema engine error:
SQLite database error
unable to open database file: /data/dev.db

npm notice 
npm notice New major version of npm available! 9.6.4 -> 11.0.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.0.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice 

Tried to create the database by hand but I'm getting a read-only problem when the application try to reach it.

@koshrf
Copy link
Author

koshrf commented Jan 6, 2025

Temporal fix:

sudo touch jobsyncdb/data/dev.db

And edit the docker-compose.yml to run as root with a user: "0"

The container run normally as nextjs user and was getting read-only problems even when the file had 0666 permissions, didn't want to deal with it atm so just ran the container as root and will change the dockerfile and compose later to accomodate for the missing sqlite3 file.

@Gsync
Copy link
Owner

Gsync commented Jan 6, 2025

Are you running it on a local machine or server? Is it a clean install or overwrite? What OS are you running it on? I will try to replicate the issue, glad that you found a work around.

@koshrf
Copy link
Author

koshrf commented Jan 7, 2025

Are you running it on a local machine or server? Is it a clean install or overwrite? What OS are you running it on? I will try to replicate the issue, glad that you found a work around.

I did run it on my local machine and in a homelab, both with ubuntu 24.04, I did change the docker-compose a little bit to fit my env. It is a clean installation, first time trying it out.

#10 (comment) is having the same issue

services:
  app:
    container_name: jobsync_app
    build:
      context: .
      dockerfile: Dockerfile
    image: jobsync_app_image
    user: "0"
    ports:
      - "3001:3000"
    environment:
      NODE_ENV: production
      DATABASE_URL: file:/data/dev.db
      # Change your initial username and password here
      USER_EMAIL: <my-email>
      USER_PASSWORD: <my-password>
      # Refer to readme to generate auth secret
      #AUTH_SECRET: Cft42eLmgapfLoot7ByiCL9ToNfbqZ4xaaMuOJsbm+9u
      AUTH_SECRET: <my-auth-secret>
      #NEXTAUTH_URL: http://localhost:3000
      #AUTH_TRUST_HOST: http://localhost:3000
      NEXTAUTH_URL: https://jobsync.<local-fqdn>
      AUTH_TRUST_HOST: https://jobsync.<local-fqdn> 
    volumes:
      - ./jobsyncdb/data:/data
    networks:
      - compose_default
networks:
  compose_default:
    external: true
Client: Docker Engine - Community
 Version:           27.3.1
 API version:       1.47
 Go version:        go1.22.7
 Git commit:        ce12230
 Built:             Fri Sep 20 11:40:59 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.3.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.7
  Git commit:       41ca978
  Built:            Fri Sep 20 11:40:59 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.24
  GitCommit:        88bf19b2105c8b17560993bee28a01ddc2f97182
 runc:
  Version:          1.2.2
  GitCommit:        v1.2.2-0-g7cb3632
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble

@Gsync
Copy link
Owner

Gsync commented Jan 7, 2025

Seems like it is related to permissions when running in homelab, Thanks for raising this, I will work on the resolve soon.

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

No branches or pull requests

2 participants