[GH-ISSUE #1965] Digital Ocean Deployment: unable to open database file: ../storage/anythingllm.db #1277

Closed
opened 2026-02-22 18:24:02 -05:00 by yindo · 8 comments
Owner

Originally created by @tertek on GitHub (Jul 25, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1965

Update: Please check comment below. This was not the issue.

Could you please provide a minimal .env example (uncommented) so that the deployment works?
The droplet gets created and is accessible through SSH.
The docker pull is successful, but .env is empty, and running docker will stop after some seconds.

https://github.com/Mintplex-Labs/anything-llm/blob/61e214aa8c3f1cde6d6aa687a9310cf7f15e46cc/cloud-deployments/digitalocean/terraform/DEPLOY.md?plain=1#L16

Originally created by @tertek on GitHub (Jul 25, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1965 **Update:** Please check comment below. This was not the issue. Could you please provide a minimal .env example (uncommented) so that the deployment works? The droplet gets created and is accessible through SSH. The docker pull is successful, but .env is empty, and running docker will stop after some seconds. https://github.com/Mintplex-Labs/anything-llm/blob/61e214aa8c3f1cde6d6aa687a9310cf7f15e46cc/cloud-deployments/digitalocean/terraform/DEPLOY.md?plain=1#L16
yindo closed this issue 2026-02-22 18:24:02 -05:00
Author
Owner

@tertek commented on GitHub (Jul 25, 2024):

In the meanwhile I have used .env example from here uncommenting those lines from .env used in the Docker Compose example.

Now, my deployment has following logs:

root@anything-llm-instance:/# sudo tail -f /var/log/cloud-init-output.log
c417e795f834: Pull complete
e09e97b09907: Pull complete
Digest: sha256:9de4e8048ed562489c9c7c9546e43f56610fca6c20a080276ca947ac5ebc64ee
Status: Downloaded newer image for mintplexlabs/anythingllm:master
docker.io/mintplexlabs/anythingllm:master
d6ff3ddaa00c66eaab2286d03e64722eb9e185cff0c0067e8ed79cde946bca68
Container ID: d6ff3ddaa00c
Health check:
Setup complete! AnythingLLM instance is now online!
Cloud-init v. 24.1.3-0ubuntu3.3 finished at Thu, 25 Jul 2024 13:24:52 +0000. Datasource DataSourceConfigDrive [net,ver=2][source=/dev/vdb].  Up 131.42 seconds

And my docker does not run anything:

root@anything-llm-instance:/# docker logs d6ff3ddaa00c
[collector] info: Collector hot directory and tmp storage wiped!
[collector] info: Document processor app listening on port 8888
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 458ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
\```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
\```
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
\```
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()
\```

See other ways of importing Prisma Client: http://pris.ly/d/importing-client

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db"

Error: Schema engine error:
SQLite database error
unable to open database file: ../storage/anythingllm.db

The .env is empty:

root@anything-llm-instance:/# ls -ltra home/anythingllm/
total 8
drwxr-xr-x 3 root root 4096 Jul 25 13:23 ..
-rw-r--r-- 1 root root    0 Jul 25 13:23 .env
drwxr-xr-x 2 root root 4096 Jul 25 13:23 .
root@anything-llm-instance:/# cat home/anythingllm/.env
root@anything-llm-instance:/#
@tertek commented on GitHub (Jul 25, 2024): In the meanwhile I have used .env example from [here ](https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#recommend-way-to-run-dockerized-anythingllm) uncommenting those lines from .env used in the Docker Compose example. Now, my deployment has following logs: ``` root@anything-llm-instance:/# sudo tail -f /var/log/cloud-init-output.log c417e795f834: Pull complete e09e97b09907: Pull complete Digest: sha256:9de4e8048ed562489c9c7c9546e43f56610fca6c20a080276ca947ac5ebc64ee Status: Downloaded newer image for mintplexlabs/anythingllm:master docker.io/mintplexlabs/anythingllm:master d6ff3ddaa00c66eaab2286d03e64722eb9e185cff0c0067e8ed79cde946bca68 Container ID: d6ff3ddaa00c Health check: Setup complete! AnythingLLM instance is now online! Cloud-init v. 24.1.3-0ubuntu3.3 finished at Thu, 25 Jul 2024 13:24:52 +0000. Datasource DataSourceConfigDrive [net,ver=2][source=/dev/vdb]. Up 131.42 seconds ``` And my docker does not run anything: ``` root@anything-llm-instance:/# docker logs d6ff3ddaa00c [collector] info: Collector hot directory and tmp storage wiped! [collector] info: Document processor app listening on port 8888 Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma ✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 458ms Start using Prisma Client in Node.js (See: https://pris.ly/d/client) \``` import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() \``` or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate) \``` import { PrismaClient } from '@prisma/client/edge' const prisma = new PrismaClient() \``` See other ways of importing Prisma Client: http://pris.ly/d/importing-client Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "anythingllm.db" at "file:../storage/anythingllm.db" Error: Schema engine error: SQLite database error unable to open database file: ../storage/anythingllm.db ``` The `.env` is empty: ``` root@anything-llm-instance:/# ls -ltra home/anythingllm/ total 8 drwxr-xr-x 3 root root 4096 Jul 25 13:23 .. -rw-r--r-- 1 root root 0 Jul 25 13:23 .env drwxr-xr-x 2 root root 4096 Jul 25 13:23 . root@anything-llm-instance:/# cat home/anythingllm/.env root@anything-llm-instance:/# ```
Author
Owner

@tertek commented on GitHub (Jul 25, 2024):

Alright, this seems very related to https://github.com/Mintplex-Labs/anything-llm/issues/710 and can be fixed as suggested here https://github.com/Mintplex-Labs/anything-llm/pull/714.

sudo chown -R 1000:1000 /home/anythingllm

@tertek commented on GitHub (Jul 25, 2024): Alright, this seems very related to https://github.com/Mintplex-Labs/anything-llm/issues/710 and can be fixed as suggested here https://github.com/Mintplex-Labs/anything-llm/pull/714. `sudo chown -R 1000:1000 /home/anythingllm`
Author
Owner

@tertek commented on GitHub (Jul 26, 2024):

Still getting these errors in docker logs:

usermod: user 'ubuntu' does not exist
chown: invalid user: ‘ubuntu:ubuntu’
@tertek commented on GitHub (Jul 26, 2024): Still getting these errors in `docker logs`: ``` usermod: user 'ubuntu' does not exist chown: invalid user: ‘ubuntu:ubuntu’ ```
Author
Owner

@timothycarambat commented on GitHub (Jul 26, 2024):

I just reverted the template change (weird the ubuntu user does not exist in ubuntu?). These are community-made templates. I dont personally use DO or terraform. Seems like in the instructions they require you to clone the whole repo and cp /docker/.env.example /docker/.env - which should work because then when you run terraform it looks into that folder.

Otherwise, i presume this template worked when the user who created it made the PR

@timothycarambat commented on GitHub (Jul 26, 2024): I just reverted the template change (weird the ubuntu user does not exist in ubuntu?). These are community-made templates. I dont personally use DO or terraform. Seems like in the instructions they require you to clone the whole repo and cp `/docker/.env.example /docker/.env` - which should work because then when you run terraform it looks into that folder. Otherwise, i presume this template worked when the user who created it made the PR
Author
Owner

@timothycarambat commented on GitHub (Jul 26, 2024):

When the TF template runs - its running as some user, who is the default user? Template seems to run everything as root - even the container.

@timothycarambat commented on GitHub (Jul 26, 2024): When the TF template runs - its running as some user, who is the default user? Template seems to run everything as `root` - even the container.
Author
Owner

@Swigler commented on GitHub (Jul 26, 2024):

sudo useradd -m -s /bin/bash -p "$6$123456$some_random_hash" ubuntu this command seems to work on bypassing the prompts when creating a new user so I edited the file as follows,

sudo apt-get update
sudo apt-get install -y docker.io
sudo useradd -m -s /bin/bash -p "$6$123456$some_random_hash" ubuntu
sudo usermod -a -G docker ubuntu

sudo systemctl enable docker
sudo systemctl start docker

sudo mkdir -p /home/anythingllm
sudo chown -R ubuntu:ubuntu /home/anythingllm
sudo touch /home/anythingllm/.env

sudo docker pull mintplexlabs/anythingllm:master
sudo docker run -d -p 3001:3001 --cap-add SYS_ADMIN -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e ST>
echo "Container ID: $(sudo docker ps --latest --quiet)"

export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)
echo "Health check: $ONLINE"
echo "Setup complete! AnythingLLM instance is now online!"

also i thought to move sudo chown -R ubuntu:ubuntu /home/anythingllm before the sudo touch /home/anythingllm/.env command

this is the error I got from the docker log

{"log":"Error: EACCES: permission denied, open '/app/server/.env'\n","stream":"stderr","time":"2024-07-26T19:45:23.647615507Z"}
{"log":" at Object.openSync (node:fs:596:3)\n","stream":"stderr","time":"2024-07-26T19:45:23.647622899Z"}
{"log":" at Object.writeFileSync (node:fs:2322:35)\n","stream":"stderr","time":"2024-07-26T19:45:23.64762691Z"}
{"log":" at dumpENV (/app/server/utils/helpers/updateENV.js:830:6)\n","stream":"stderr","time":"2024-07-26T19:45:23.647630806Z"}
{"log":" at #loadOrCreateKeySalt (/app/server/utils/EncryptionManager/index.js:42:50)\n","stream":"stderr","time":"2024-07-26T19:45:23.647638233Z"}
{"log":" at new EncryptionManager (/app/server/utils/EncryptionManager/index.js:13:30)\n","stream":"stderr","time":"2024-07-26T19:45:23.647648455Z"}
{"log":" at Server.\u003canonymous\u003e (/app/server/utils/boot/index.js:61:7) {\n","stream":"stderr","time":"2024-07-26T19:45:23.647654705Z"}
{"log":" errno: -13,\n","stream":"stderr","time":"2024-07-26T19:45:23.647659164Z"}
{"log":" syscall: 'open',\n","stream":"stderr","time":"2024-07-26T19:45:23.647663498Z"}
{"log":" code: 'EACCES',\n","stream":"stderr","time":"2024-07-26T19:45:23.647667244Z"}
{"log":" path: '/app/server/.env'\n","stream":"stderr","time":"2024-07-26T19:45:23.647671141Z"}
{"log":"}\n","stream":"stderr","time":"2024-07-26T19:45:23.647675419Z"}
{"log":"\n","stream":"stderr","time":"2024-07-26T19:45:23.6476792Z"}
{"log":"Node.js v18.20.4\n","stream":"stderr","time":"2024-07-26T19:45:23.647682819Z"}

@Swigler commented on GitHub (Jul 26, 2024): sudo useradd -m -s /bin/bash -p "$6$123456$some_random_hash" ubuntu this command seems to work on bypassing the prompts when creating a new user so I edited the file as follows, sudo apt-get update sudo apt-get install -y docker.io sudo useradd -m -s /bin/bash -p "$6$123456$some_random_hash" ubuntu sudo usermod -a -G docker ubuntu sudo systemctl enable docker sudo systemctl start docker sudo mkdir -p /home/anythingllm sudo chown -R ubuntu:ubuntu /home/anythingllm sudo touch /home/anythingllm/.env sudo docker pull mintplexlabs/anythingllm:master sudo docker run -d -p 3001:3001 --cap-add SYS_ADMIN -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e ST> echo "Container ID: $(sudo docker ps --latest --quiet)" export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2) echo "Health check: $ONLINE" echo "Setup complete! AnythingLLM instance is now online!" also i thought to move sudo chown -R ubuntu:ubuntu /home/anythingllm before the sudo touch /home/anythingllm/.env command this is the error I got from the docker log {"log":"Error: EACCES: permission denied, open '/app/server/.env'\n","stream":"stderr","time":"2024-07-26T19:45:23.647615507Z"} {"log":" at Object.openSync (node:fs:596:3)\n","stream":"stderr","time":"2024-07-26T19:45:23.647622899Z"} {"log":" at Object.writeFileSync (node:fs:2322:35)\n","stream":"stderr","time":"2024-07-26T19:45:23.64762691Z"} {"log":" at dumpENV (/app/server/utils/helpers/updateENV.js:830:6)\n","stream":"stderr","time":"2024-07-26T19:45:23.647630806Z"} {"log":" at #loadOrCreateKeySalt (/app/server/utils/EncryptionManager/index.js:42:50)\n","stream":"stderr","time":"2024-07-26T19:45:23.647638233Z"} {"log":" at new EncryptionManager (/app/server/utils/EncryptionManager/index.js:13:30)\n","stream":"stderr","time":"2024-07-26T19:45:23.647648455Z"} {"log":" at Server.\u003canonymous\u003e (/app/server/utils/boot/index.js:61:7) {\n","stream":"stderr","time":"2024-07-26T19:45:23.647654705Z"} {"log":" errno: -13,\n","stream":"stderr","time":"2024-07-26T19:45:23.647659164Z"} {"log":" syscall: 'open',\n","stream":"stderr","time":"2024-07-26T19:45:23.647663498Z"} {"log":" code: 'EACCES',\n","stream":"stderr","time":"2024-07-26T19:45:23.647667244Z"} {"log":" path: '/app/server/.env'\n","stream":"stderr","time":"2024-07-26T19:45:23.647671141Z"} {"log":"}\n","stream":"stderr","time":"2024-07-26T19:45:23.647675419Z"} {"log":"\n","stream":"stderr","time":"2024-07-26T19:45:23.6476792Z"} {"log":"Node.js v18.20.4\n","stream":"stderr","time":"2024-07-26T19:45:23.647682819Z"}
Author
Owner

@tertek commented on GitHub (Jul 29, 2024):

When the TF template runs - its running as some user, who is the default user? Template seems to run everything as root - even the container.

I got it working by using uid/gid 1000:

sudo apt-get update  
sudo apt-get install -y docker.io  
sudo usermod -a -G docker 1000
  
sudo systemctl enable docker  
sudo systemctl start docker  
  
mkdir -p /home/anythingllm
touch /home/anythingllm/.env
sudo chown -R 1000:1000 /home/anythingllm
  
sudo docker pull mintplexlabs/anythingllm:master
sudo docker run -d -p 3001:3001 --cap-add SYS_ADMIN -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm
echo "Container ID: $(sudo docker ps --latest --quiet)"  
  
export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)  
echo "Health check: $ONLINE"  
echo "Setup complete! AnythingLLM instance is now online!"  
@tertek commented on GitHub (Jul 29, 2024): > When the TF template runs - its running as some user, who is the default user? Template seems to run everything as `root` - even the container. I got it working by using uid/gid 1000: ```bash sudo apt-get update sudo apt-get install -y docker.io sudo usermod -a -G docker 1000 sudo systemctl enable docker sudo systemctl start docker mkdir -p /home/anythingllm touch /home/anythingllm/.env sudo chown -R 1000:1000 /home/anythingllm sudo docker pull mintplexlabs/anythingllm:master sudo docker run -d -p 3001:3001 --cap-add SYS_ADMIN -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm echo "Container ID: $(sudo docker ps --latest --quiet)" export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2) echo "Health check: $ONLINE" echo "Setup complete! AnythingLLM instance is now online!" ```
Author
Owner

@Swigler commented on GitHub (Jul 29, 2024):

it worked for me as well :D but on a 22.-04-x64 instance for what ever reason, thank you.

@Swigler commented on GitHub (Jul 29, 2024): it worked for me as well :D but on a 22.-04-x64 instance for what ever reason, thank you.
yindo changed title from Digital Ocean Deployment: unable to open database file: ../storage/anythingllm.db to [GH-ISSUE #1965] Digital Ocean Deployment: unable to open database file: ../storage/anythingllm.db 2026-06-05 14:39:54 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1277