-
Notifications
You must be signed in to change notification settings - Fork 1
fix SQLITE CANTOPEN errorno:14 issue #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM node:20-alpine | ||
| FROM node:20-slim | ||
| WORKDIR /app | ||
| COPY package*.json ./ | ||
| RUN npm install | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -47,6 +47,7 @@ npm install | |||||
| ```env | ||||||
| TELEGRAM_TOKEN=your_telegram_bot_token | ||||||
| WEBAPP_URL=http://localhost:5000 | ||||||
| DB_PATH=/path/to/data/data.db # use in development mode (not needed for docker-compose setup) | ||||||
|
||||||
| DB_PATH=/path/to/data/data.db # use in development mode (not needed for docker-compose setup) | |
| DB_PATH=./data/data.db # путь к файлу БД относительно корня проекта (для локальной разработки; не нужен для docker-compose) |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ services: | |||||||||
| environment: | ||||||||||
| - TELEGRAM_TOKEN=${TELEGRAM_TOKEN} | ||||||||||
| - WEBAPP_URL=${WEBAPP_URL} | ||||||||||
| - DB_PATH=/app/data.db | ||||||||||
|
||||||||||
| - DB_PATH=/app/data.db | |
| - DB_PATH=/app/data.db |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a mismatch between the DB_PATH environment variable and the volume mapping. DB_PATH is set to /app/data.db but the volume maps ./data to /data (not /app/data). This will cause the database file to be created at /app/data.db inside the container, which won't be persisted to the host because the volume is mounted at /data. Either change DB_PATH to /data/data.db or change the volume mapping to ./data:/app/data.
| - DB_PATH=/app/data.db | |
| - DB_PATH=/data/data.db |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { Entry } from "./entity/Entry"; | |||||
|
|
||||||
| export const AppDataSource = new DataSource({ | ||||||
| type: "sqlite", | ||||||
| database: "data.db", | ||||||
| database: process.env.DB_PATH || "data.db", | ||||||
|
||||||
| database: process.env.DB_PATH || "data.db", | |
| database: process.env.DB_PATH || "data.db", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Dockerfile doesn't create the /app/data directory that's needed for the database file when using DB_PATH=/app/data.db. Consider adding 'RUN mkdir -p /app/data' before the CMD instruction to ensure the directory exists when the container starts.