root-gg / plik

Plik is a temporary file upload system (Wetransfer like) in Go.
https://plik.root.gg
Other
1.47k stars 168 forks source link

plikd.cfg not all values applied on docker #424

Closed TS-Steff closed 2 years ago

TS-Steff commented 2 years ago

We run plik with docker-compose.

In the docker-compose.yml we mount the plikd.cfg ` volumes:

The Values MaxFileSizeStr and DefaultTTLStr are not applied. Other string values such as DownloadDomain work.

Workaround

#MaxFileSizeStr     = "10GB"           # 10GB
MaxFileSize         = 10240000
MaxFilePerUpload    = 20

#DefaultTTLStr      = "30d"            # 30 days
DefaultTTL          = 604800           # 7 days
jackald commented 2 years ago

I also have this issue where DefaultTTLStr, MaxTTLStr and the Plik features do not follow the flags that are set in plikd.cfg. DownloadDomain does work.

camathieu commented 2 years ago

Can you confirm that it's not a docker configuration issue and that inside the docker container the /home/plik/server/plikd.cfg has the right configuration by using docker exec -it plik /bin/sh ?

When specifing both parameters the Str version should have precedence.

DefaultTTLStr      = "30d"            # 30 days
DefaultTTL          = 604800           # 7 days
camathieu commented 2 years ago
🪂 ➜  tmp wget https://raw.githubusercontent.com/root-gg/plik/master/server/plikd.cfg
--2022-05-17 08:22:12--  https://raw.githubusercontent.com/root-gg/plik/master/server/plikd.cfg
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5349 (5.2K) [text/plain]
Saving to: ‘plikd.cfg’

plikd.cfg  100%[===>]   5.22K  --.-KB/s    in 0s      

2022-05-17 08:22:14 (76.2 MB/s) - ‘plikd.cfg’ saved [5349/5349]

🪂 ➜  tmp docker run rootgg/plik:dev
Unable to find image 'rootgg/plik:dev' locally
dev: Pulling from rootgg/plik
df9b9388f04a: Already exists 
968c136d602b: Pull complete 
c4def0be49a3: Pull complete 
b57bd14990c3: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:f706136e517b12d290285ac865ee6891e7fe726bde04dd7eb18e9647862f2b3c
Status: Downloaded newer image for rootgg/plik:dev
[05/17/2022 06:22:51][INFO    ] Starting plikd server v1.3.5
[05/17/2022 06:22:51][DEBUG   ] Configuration :
[05/17/2022 06:22:51][DEBUG   ] Maximum file size : 10 GB
[05/17/2022 06:22:51][DEBUG   ] Maximum files per upload : 1000
[05/17/2022 06:22:51][DEBUG   ] Default upload TTL : 30d
[05/17/2022 06:22:51][DEBUG   ] Maximum upload TTL : 30d
[05/17/2022 06:22:51][DEBUG   ] One shot upload : enabled
[05/17/2022 06:22:51][DEBUG   ] Removable upload : enabled
[05/17/2022 06:22:51][DEBUG   ] Streaming upload : enabled
[05/17/2022 06:22:51][DEBUG   ] Upload password : enabled
[05/17/2022 06:22:51][DEBUG   ] Upload comments : enabled
[05/17/2022 06:22:51][DEBUG   ] Upload set TTL : enabled
[05/17/2022 06:22:51][DEBUG   ] Upload extend TTL : disabled
[05/17/2022 06:22:51][DEBUG   ] Authentication : disabled
[05/17/2022 06:22:51][WARNING ] Initializing sqlite3 database
[05/17/2022 06:22:51][INFO    ] Starting server at http://0.0.0.0:8080
[05/17/2022 06:22:51][INFO    ] Will clean old uploads in 8013 seconds.
^C[05/17/2022 06:22:57][INFO    ] Shutdown server at http://127.0.0.1:8080
🪂 ➜  tmp vim plikd.cfg 
🪂 ➜  tmp cat plikd.cfg | grep TTLStr
DefaultTTLStr       = "7d"            # 30 days
MaxTTLStr           = "7d"            # 0 : No limit
🪂 ➜  tmp docker run -v /home/cam/tmp/plikd.cfg:/home/plik/server/plikd.cfg rootgg/plik:dev
[05/17/2022 06:25:20][INFO    ] Starting plikd server v1.3.5
[05/17/2022 06:25:20][DEBUG   ] Configuration :
[05/17/2022 06:25:20][DEBUG   ] Maximum file size : 10 GB
[05/17/2022 06:25:20][DEBUG   ] Maximum files per upload : 1000
[05/17/2022 06:25:20][DEBUG   ] Default upload TTL : 7d
[05/17/2022 06:25:20][DEBUG   ] Maximum upload TTL : 7d
[05/17/2022 06:25:20][DEBUG   ] One shot upload : enabled
[05/17/2022 06:25:20][DEBUG   ] Removable upload : enabled
[05/17/2022 06:25:20][DEBUG   ] Streaming upload : enabled
[05/17/2022 06:25:20][DEBUG   ] Upload password : enabled
[05/17/2022 06:25:20][DEBUG   ] Upload comments : enabled
[05/17/2022 06:25:20][DEBUG   ] Upload set TTL : enabled
[05/17/2022 06:25:20][DEBUG   ] Upload extend TTL : disabled
[05/17/2022 06:25:20][DEBUG   ] Authentication : disabled
[05/17/2022 06:25:20][WARNING ] Initializing sqlite3 database
[05/17/2022 06:25:20][INFO    ] Starting server at http://0.0.0.0:8080
[05/17/2022 06:25:20][INFO    ] Will clean old uploads in 9079 seconds.
^C[05/17/2022 06:25:25][INFO    ] Shutdown server at http://127.0.0.1:8080
TS-Steff commented 2 years ago

I can confirm that the plikd.cfg is correctly passed into the docker container. I made a comment on the host and checkt with docker exec -it plik /bin/sh cat plikd.cfg which then showed the comment.

camathieu commented 2 years ago

Hello the issue is that the feature that you are trying to use has not been released yet to rootgg/plik:latest which is an alias for rootgg/plik:1.3.5.

I'll release rootgg/plik:1.3.6 later today or tomorrow most likely.

camathieu commented 2 years ago

Released in https://github.com/root-gg/plik/releases/tag/1.3.6