Skip to content

Commit 737028a

Browse files
committed
feat: construction of mountOpt and vfsOpt for rc moounts
1 parent a31dd33 commit 737028a

File tree

13 files changed

+730
-62
lines changed

13 files changed

+730
-62
lines changed

compose.yaml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
services:
22
rclone-manager:
3+
image: ipromknight/rclone-manager:latest
34
container_name: rclone-manager
45
restart: unless-stopped
56
stop_signal: SIGTERM
67
stop_grace_period: 30s
78
ports:
89
- "5572:5572" # Rclone RC API
9-
- "8080:8080"
10+
- "8080:8080" # Add Mappings for any serves you have defined in config.yaml
1011
devices:
1112
- /dev/fuse:/dev/fuse:rwm
1213
cap_add:
@@ -19,36 +20,50 @@ services:
1920
- ./local-dev/mnt/rclone:/mnt/rclone:shared
2021
- ./local-dev/caches/rclone:/caches/rclone
2122
environment:
22-
# General
23-
RCLONE_BUFFER_SIZE: 0
23+
# Rclone Manager Debug Messages (true/false)
24+
DEBUG_MODE: "false"
25+
26+
# Customize Rclone Defaults
27+
RCLONE_USE_MMAP: true
2428
RCLONE_BWLIMIT: off
2529
RCLONE_BIND: 0.0.0.0
2630
RCLONE_LOG_LEVEL: Info
2731
RCLONE_CACHE_DIR: /caches/rclone
28-
RCLONE_DIR_CACHE_TIME: 10s
32+
RCLONE_CONFIG: /data/rclone.conf
2933
RCLONE_TIMEOUT: 10m
3034
RCLONE_UMASK: 002
31-
RCLONE_UID: 1000
32-
RCLONE_GID: 1000
33-
RCLONE_LINKS: true
35+
RCLONE_UID: 568
36+
RCLONE_GID: 568
37+
RCLONE_ALLOW_NON_EMPTY: true
38+
RCLONE_ALLOW_OTHER: true
39+
RCLONE_BUFFER_SIZE: 0
40+
RCLONE_DIR_CACHE_TIME: 10s
41+
RCLONE_POLL_INTERVAL: 0
42+
RCLONE_VFS_CACHE_MAX_AGE: 72h
43+
RCLONE_VFS_CACHE_MAX_SIZE: 2G
44+
RCLONE_VFS_CACHE_MIN_FREE_SPACE: off
45+
RCLONE_VFS_CACHE_MODE: writes
46+
RCLONE_VFS_CACHE_POLL_INTERVAL: 30s
47+
RCLONE_VFS_DISK_SPACE_TOTAL_SIZE: 20G
48+
RCLONE_VFS_FAST_FINGERPRINT: true
49+
RCLONE_VFS_READ_AHEAD: 2M
50+
RCLONE_VFS_READ_CHUNK_SIZE: 8M
51+
RCLONE_VFS_READ_CHUNK_SIZE_LIMIT: 0
52+
RCLONE_VFS_READ_WAIT: 5ms
53+
RCLONE_VFS_REFRESH: true
54+
RCLONE_READ_ONLY: true
55+
RCLONE_NO_MODTIME: true
3456
RCLONE_MULTI_THREAD_STREAMS: 1
35-
RCLONE_TRANSFERS: 1
36-
RCLONE_ALLOW_NON_EMPTY: "true"
37-
RCLONE_ALLOW_OTHER: "true"
38-
RCLONE_CONFIG: /data/rclone.conf
57+
RCLONE_TRANSFERS: 4
3958

4059
# RCD API
4160
RCLONE_RC_ADDR: :5572
4261
RCLONE_RC_NO_AUTH: "true"
62+
63+
# RCD API Web GUI
4364
RCLONE_RC_WEB_GUI: "true"
4465
RCLONE_RC_WEB_GUI_NO_OPEN_BROWSER: "true"
66+
RCLONE_RC_WEB_GUI_UPDATE: "true"
4567

46-
# VFS DEFAULTS
47-
RCLONE_VFS_CACHE_MODE: writes
48-
RCLONE_VFS_READ_CHUNK_SIZE: 10M
49-
RCLONE_VFS_READ_CHUNK_SIZE_LIMIT: 10M
50-
51-
# MOUNT DEFAULTS
52-
RCLONE_NO_TRAVERSE: "true"
53-
RCLONE_IGNORE_EXISTING: "true"
54-
RCLONE_POLL_INTERVAL: 0
68+
## Uncomment to use custom URL for fetching latest release. This is RcloneFM's URL.
69+
# RCLONE_RC_WEB_FETCH_URL: "https://api.github.com/repos/retifrav/rclone-rc-web-gui/releases/latest"

config.yaml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1+
# Define your Mounts for Rclone Backends here
12
mounts:
3+
# This is the name of the backend in your rclone.conf
24
- backendName: "AllDebrid"
5+
# This is the path to the mountpoint on the host
36
mountPoint: "/mnt/rclone/alldebrid"
7+
# These will be fully converted to vfsOpt and mountOpt payloads for the rclone mount command through RC. You can use your regular rclone env vars.
8+
# They override the shared options in the environment section of the compose / running container for this specific mount.
49
environment:
510
RCLONE_BWLIMIT: off
611
RCLONE_READ_ONLY: true
712
RCLONE_VFS_READ_CHUNK_SIZE: 16M
813
RCLONE_VFS_READ_CHUNK_SIZE_LIMIT: 32M
14+
RCLONE_VFS_CACHE_MODE: full
915

16+
# Define your Rclone Serves here . All protocols are supported.
1017
serves:
18+
# This is the name of the backend in your rclone.conf
1119
- backendName: "AllDebrid"
20+
# This is the serve protocol: webdav, ftp, sftp, dlna, docker, nfs, restic, s3.
1221
protocol: "webdav"
22+
# This is the port to bind the serve to.
1323
addr: "0.0.0.0:8080"
24+
# These will override the shared options in the environment section of the compose / running container for this specific serve.
1425
environment:
15-
RCLONE_BUFFER_SIZE: 0
16-
RCLONE_BWLIMIT: 300M
17-
RCLONE_COPY_LINKS: true
18-
RCLONE_LINKS: false
19-
RCLONE_MAX_HEADER_SIZE: 8192
20-
RCLONE_VFS_READ_CHUNK_SIZE: 16M
21-
RCLONE_VFS_READ_CHUNK_SIZE_LIMIT: 32M
22-
RCLONE_STATS: 60s
23-
RCLONE_VFS_CACHE_MODE: writes
24-
RCLONE_CUTOFF_MODE: cautious
25-
RCLONE_MULTI_THREAD_STREAMS: 0
26-
RCLONE_DIR_CACHE_TIME: 10s
27-
RCLONE_NO_MODTIME: true
28-
RCLONE_READ_ONLY: true
26+
RCLONE_BUFFER_SIZE: 0

src/cmd/main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ import (
55
"os"
66
"os/signal"
77
"rclone-manager/internal/rclone_manager"
8+
"strings"
89
"syscall"
910
"time"
1011
)
1112

12-
var logger = zerolog.New(os.Stdout).With().Timestamp().Logger()
13+
var logger zerolog.Logger
14+
15+
func init() {
16+
debugMode := os.Getenv("DEBUG_MODE")
17+
if strings.ToLower(debugMode) == "true" || strings.ToLower(debugMode) == "1" {
18+
logger = zerolog.New(os.Stdout).Level(zerolog.DebugLevel).With().Timestamp().Logger()
19+
} else {
20+
logger = zerolog.New(os.Stdout).Level(zerolog.InfoLevel).With().Timestamp().Logger()
21+
}
22+
}
1323

1424
func main() {
1525
sigs := make(chan os.Signal, 1)

src/go.mod

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,53 @@ go 1.23
44

55
require (
66
github.com/fsnotify/fsnotify v1.8.0
7+
github.com/rclone/rclone v1.68.2
78
github.com/rs/zerolog v1.33.0
89
gopkg.in/yaml.v3 v3.0.1
910
)
1011

1112
require (
13+
github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd // indirect
14+
github.com/aalpar/deheap v0.0.0-20210914013432-0cc84d79dec3 // indirect
15+
github.com/abbot/go-http-auth v0.4.0 // indirect
16+
github.com/beorn7/perks v1.0.1 // indirect
17+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
18+
github.com/coreos/go-semver v0.3.1 // indirect
19+
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
20+
github.com/go-chi/chi/v5 v5.1.0 // indirect
21+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
22+
github.com/go-ole/go-ole v1.3.0 // indirect
23+
github.com/google/uuid v1.6.0 // indirect
24+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
25+
github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004 // indirect
26+
github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect
1227
github.com/mattn/go-colorable v0.1.13 // indirect
13-
github.com/mattn/go-isatty v0.0.19 // indirect
14-
golang.org/x/sys v0.13.0 // indirect
28+
github.com/mattn/go-isatty v0.0.20 // indirect
29+
github.com/mitchellh/go-homedir v1.1.0 // indirect
30+
github.com/moby/sys/mountinfo v0.7.2 // indirect
31+
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
32+
github.com/prometheus/client_golang v1.19.1 // indirect
33+
github.com/prometheus/client_model v0.5.0 // indirect
34+
github.com/prometheus/common v0.48.0 // indirect
35+
github.com/prometheus/procfs v0.12.0 // indirect
36+
github.com/rfjakob/eme v1.1.2 // indirect
37+
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
38+
github.com/shoenig/go-m1cpu v0.1.6 // indirect
39+
github.com/sirupsen/logrus v1.9.3 // indirect
40+
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
41+
github.com/smartystreets/goconvey v1.8.1 // indirect
42+
github.com/spf13/cobra v1.8.1 // indirect
43+
github.com/spf13/pflag v1.0.5 // indirect
44+
github.com/tklauser/go-sysconf v0.3.13 // indirect
45+
github.com/tklauser/numcpus v0.7.0 // indirect
46+
github.com/unknwon/goconfig v1.0.0 // indirect
47+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
48+
golang.org/x/crypto v0.25.0 // indirect
49+
golang.org/x/net v0.27.0 // indirect
50+
golang.org/x/sync v0.8.0 // indirect
51+
golang.org/x/sys v0.22.0 // indirect
52+
golang.org/x/term v0.22.0 // indirect
53+
golang.org/x/text v0.17.0 // indirect
54+
golang.org/x/time v0.5.0 // indirect
55+
google.golang.org/protobuf v1.34.2 // indirect
1556
)

0 commit comments

Comments
 (0)