部署遇到的问题
- /cloudreve/conf.ini 是一个路径而不是文件
- 初始化数据库时内存不足
尝试解决
- 提前在./cloudreve路径下创建conf.ini文件, 不确定会有什么问题
- 1完成后,不再提示错误,但是报告初始化数据库库内存不足, 换了三个Ubuntu虚拟机都是这个问题.
1./cloudreve/conf.ini 是一个路径而不是文件
cloudreve | ___ _ _
cloudreve | / __\ | ___ _ _ __| |_ __ _____ _____
cloudreve | / / | |/ _ \| | | |/ _ | '__/ _ \ \ / / _ \
cloudreve | / /___| | (_) | |_| | (_| | | | __/\ V / __/
cloudreve | \____/|_|\___/ \__,_|\__,_|_| \___| \_/ \___|
cloudreve |
cloudreve | V3.8.3 Commit #88409cc Pro=false
cloudreve | ================================================
cloudreve |
cloudreve | [Panic] 2024-04-13 12:08:46 Failed to parse config file "/cloudreve/conf.ini": BOM: read /cloudreve/conf.ini: is a directory
cloudreve | panic: Failed to parse config file "/cloudreve/conf.ini": BOM: read /cloudreve/conf.ini: is a directory
cloudreve |
cloudreve | goroutine 1 [running]:
cloudreve | github.com/cloudreve/Cloudreve/v3/pkg/util.(*Logger).Panic(0xc00003c2c0, {0x1565ee1?, 0x0?}, {0xc0002258c8?, 0x0?, 0x0?})
cloudreve | /Users/aaronliu/Projects/Cloudreve/pkg/util/logger.go:74 +0x94
cloudreve | github.com/cloudreve/Cloudreve/v3/pkg/conf.Init({0xc00028ef60, 0x13})
cloudreve | /Users/aaronliu/Projects/Cloudreve/pkg/conf/conf.go:108 +0x5cf
cloudreve | github.com/cloudreve/Cloudreve/v3/bootstrap.Init({0xc00028ef60, 0x13}, {0x1a6b960, 0xc000011200})
cloudreve | /Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:24 +0x65
cloudreve | main.init.0()
cloudreve | /Users/aaronliu/Projects/Cloudreve/main.go:42 +0x1ca
cloudreve exited with code 2
Failed to connect to database
cloudreve |
cloudreve | ___ _ _
cloudreve | / __\ | ___ _ _ __| |_ __ _____ _____
cloudreve | / / | |/ _ \| | | |/ _ | '__/ _ \ \ / / _ \
cloudreve | / /___| | (_) | |_| | (_| | | | __/\ V / __/
cloudreve | \____/|_|\___/ \__,_|\__,_|_| \___| \_/ \___|
cloudreve |
cloudreve | V3.8.3 Commit #88409cc Pro=false
cloudreve | ================================================
cloudreve |
cloudreve | [Info] 2024-04-13 12:30:36 Initializing database connection...
cloudreve | [Panic] 2024-04-13 12:30:36 Failed to connect to database: unable to open database file: out of memory (14)
cloudreve | panic: Failed to connect to database: unable to open database file: out of memory (14)
cloudreve |
cloudreve | goroutine 1 [running]:
cloudreve | github.com/cloudreve/Cloudreve/v3/pkg/util.(*Logger).Panic(0xc0003e9090, {0x1564120?, 0xc00044bb98?}, {0xc00044bb98?, 0x14565c0?, 0x440b00?})
cloudreve | /Users/aaronliu/Projects/Cloudreve/pkg/util/logger.go:74 +0x94
cloudreve | github.com/cloudreve/Cloudreve/v3/models.Init()
cloudreve | /Users/aaronliu/Projects/Cloudreve/models/init.go:76 +0x70a
cloudreve | github.com/cloudreve/Cloudreve/v3/bootstrap.Init.func5()
cloudreve | /Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:61 +0x17
cloudreve | github.com/cloudreve/Cloudreve/v3/bootstrap.Init({0xc0002d4cd8, 0x13}, {0x1a6b960, 0xc000010120})
cloudreve | /Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:128 +0x29b
cloudreve | main.init.0()
cloudreve | /Users/aaronliu/Projects/Cloudreve/main.go:42 +0x1ca
cloudreve exited with code 2
^CGracefully stopping... (press Ctrl+C again to force)
cloudreve exited with code 0
To Reproduce
Steps to reproduce the behavior:
- Go to 'docker-compose up'
docker-compose.yaml
version: "3.8"
services:
redis:
container_name: redis
image: bitnami/redis:latest
restart: unless-stopped
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- redis_data:/bitnami/redis/data
cloudreve:
container_name: cloudreve
image: cloudreve/cloudreve:latest
restart: unless-stopped
ports:
- "5212:5212"
volumes:
- temp_data:/data
- ./cloudreve/uploads:/cloudreve/uploads
- ./cloudreve/conf.ini:/cloudreve/conf.ini
- ./cloudreve/cloudreve.db:/cloudreve/cloudreve.db
- ./cloudreve/avatar:/cloudreve/avatar
depends_on:
- aria2
aria2:
container_name: aria2
image: p3terx/aria2-pro # third party image, please keep notice what you are doing
restart: unless-stopped
environment:
- RPC_SECRET=cloudreve # aria rpc token, customize your own
- RPC_PORT=6800
volumes:
- ./aria2/config:/config
- temp_data:/data
volumes:
redis_data:
driver: local
temp_data:
driver: local
driver_opts:
type: none
device: $PWD/data
o: bind
2条答案
按热度按时间wlsrxk511#
1
卷参数
按照下面的参数,没有改动, 启动容器时,中间的两个文件,会被创建成一个同名的文件夹,导致容器运行出错。
volumes:
tcbh2hod2#
Same issue as the original poster.
Problem cause:
In the docker-compose.yml file for the Cloudreve image, the mounted volumes:
will create two folders
conf.ini
andcloudreve.db
, but actually two files are needed. The solution is to delete these two folders and create files with the same names in the corresponding directories.Solution steps are as follows:
step 1. Use the default docker-compose file to start, the image on port 5212 will keep restarting, and you can see the error log inside the container.
ERROR: for aria2 Cannot start service aria2: error while mounting volume '/var/lib/docker/volumes/cloudreve_temp_data/_data': failed to mount local volume: mount /media/zt/partition2/projects/Cloudreve/data:/var/lib/docker/volumes/cloudreve_temp_data/_data, flags: 0x1000: no such file or directory
ERROR: Encountered errors while bringing up the project.
step 2. Use
docker-compose down
to stop all containers.step 3. Delete the ./cloudreve/conf.ini folder and create a new conf.ini file using
touch conf.ini
.step 4. Delete the /cloudreve/cloudreve.db folder and create a new cloudreve.db file using
touch cloudreve.db
.step 5. Restart using
docker-compose up -d
.If you only execute step 3 and not step 4, you will encounter an out-of-memory error:
[Info] 2024-05-22 17:37:43 Initializing database connection...
[Panic] 2024-05-22 17:37:43 Failed to connect to database: unable to open database file: out of memory (14)
panic: Failed to connect to database: unable to open database file: out of memory (14)
goroutine 1 [running]:
github.com/cloudreve/Cloudreve/v3/pkg/util.(*Logger).Panic(0xc000798600, {0x1564120?, 0xc00028fb98?}, {0xc00028fb98?, 0x14565c0?, 0x440b00?})
/Users/aaronliu/Projects/Cloudreve/pkg/util/logger.go:74 +0x94
github.com/cloudreve/Cloudreve/v3/models.Init()
/Users/aaronliu/Projects/Cloudreve/models/init.go:76 +0x70a
github.com/cloudreve/Cloudreve/v3/bootstrap.Init.func5()
/Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:61 +0x17
github.com/cloudreve/Cloudreve/v3/bootstrap.Init({0xc000546780, 0x13}, {0x1a6b960, 0xc0004a60f0})
/Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:128 +0x29b
main.init.0()
/Users/aaronliu/Projects/Cloudreve/main.go:42 +0x1ca
和楼主一样的问题
问题原因:
docker-compose.yml的cloudreve镜像挂载卷中,
会创建两个文件夹
conf.ini
和cloudreve.db
,实际是需要两个文件,解决思路是删除这两个文件夹,同时在对应的目录下创建同名文件解决方式如下:
step 1. 使用默认的docker-compose文件启动,5212端口镜像会一直重启,进入容器内可以看到报错日志
ERROR: for aria2 Cannot start service aria2: error while mounting volume '/var/lib/docker/volumes/cloudreve_temp_data/_data': failed to mount local volume: mount /media/zt/partition2/projects/Cloudreve/data:/var/lib/docker/volumes/cloudreve_temp_data/_data, flags: 0x1000: no such file or directory
ERROR: Encountered errors while bringing up the project.
step2.使用
docker-compose down
退出全部容器step3.删除./cloudreve/conf.ini文件夹,新建conf.ini文件
touch conf.ini
step4.删除/cloudreve/cloudreve.db文件夹,新建cloudreve.db文件
touch cloudreve.db
step5.重新启动
docker-compose up -d
如果只执行step3,不执行step4,会出现内存不足报错:
[Info] 2024-05-22 17:37:43 Initializing database connection...
[Panic] 2024-05-22 17:37:43 Failed to connect to database: unable to open database file: out of memory (14)
panic: Failed to connect to database: unable to open database file: out of memory (14)
goroutine 1 [running]:
github.com/cloudreve/Cloudreve/v3/pkg/util.(*Logger).Panic(0xc000798600, {0x1564120?, 0xc00028fb98?}, {0xc00028fb98?, 0x14565c0?, 0x440b00?})
/Users/aaronliu/Projects/Cloudreve/pkg/util/logger.go:74 +0x94
github.com/cloudreve/Cloudreve/v3/models.Init()
/Users/aaronliu/Projects/Cloudreve/models/init.go:76 +0x70a
github.com/cloudreve/Cloudreve/v3/bootstrap.Init.func5()
/Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:61 +0x17
github.com/cloudreve/Cloudreve/v3/bootstrap.Init({0xc000546780, 0x13}, {0x1a6b960, 0xc0004a60f0})
/Users/aaronliu/Projects/Cloudreve/bootstrap/init.go:128 +0x29b
main.init.0()
/Users/aaronliu/Projects/Cloudreve/main.go:42 +0x1ca