Vikunja 0.24 docker /bin/sh

I’m having issues with managing vikunja dump files from docker container since the update to v0.24 and scratch os. Prior to that version, I was using some /bin/sh commands to manage the files with a script (finding vikunja-dump_* files, docker cp to a network repository and then removing these files from docker).

Now when I run docker exec vikunja_app /app/vikunja/vikunja dump I also get permission denied.

user@server:~$ docker exec vikunja_app /app/vikunja/vikunja dump
2024-07-17T01:27:35.470882457Z: INFO    ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
2024-07-17T01:27:35.508221583Z: INFO    ▶ migration/Migrate 069 Ran all migrations successfully.
2024-07-17T01:27:35.513904555Z: CRITICAL        ▶ cmd/func2 06a error opening dump file: open vikunja-dump_2024-07-17_01-01-35.zip: permission denied

I’ve seen Command line interface | Vikunja. Any suggestion to get the dump files out of the container from a script?

thank you

Vikunja will dump the file in the current working directory, which in this case is /app/vikunja. Does it work if you change the workdir with the docker cli to a volume mounted folder that’s owned by the user vikunja is running as? (1000 by default)

You can’t mount /app/vikunja because the folder contains the binary as well.

Thanks! Mounted a new ./dump directory with same permissions as ./files (1000:1000), to /app/vikunja/dump. I get a .zip dump with the .env and database files but it’s missing the files directory.
At this point, I could backup my files directory manually since it’s a local bind mount. But it wouldn’t be from the dump process.

user@server:~$ docker exec -w /app/vikunja/dump vikunja_app /app/vikunja/vikunja dump
2024-07-20T11:02:29.325898594Z: INFO    ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
2024-07-20T11:02:29.327581427Z: INFO    ▶ migration/Migrate 003 Running migrations…
2024-07-20T11:02:29.369775838Z: INFO    ▶ migration/Migrate 06a Ran all migrations successfully.
2024-07-20T11:02:29.370192626Z: INFO    ▶ dump/Dump 06b Start dumping config file...
2024-07-20T11:02:29.370236031Z: WARNING ▶ dump/Dump 06c No config file found, not including one in the dump. This usually happens when environment variables are used for configuration.
2024-07-20T11:02:29.370253916Z: INFO    ▶ dump/Dump 06d Dumped config file
2024-07-20T11:02:29.370796112Z: INFO    ▶ dump/Dump 06e Dumped .env file
2024-07-20T11:02:29.370847011Z: INFO    ▶ dump/Dump 06f Start dumping version file...
2024-07-20T11:02:29.37100645Z: INFO     ▶ dump/Dump 070 Dumped version
2024-07-20T11:02:29.37102728Z: INFO     ▶ dump/Dump 071 Start dumping database...
2024-07-20T11:02:29.427873407Z: INFO    ▶ dump/Dump 0d6 Dumped database
2024-07-20T11:02:29.427919977Z: INFO    ▶ dump/Dump 0d7 Start dumping files...
2024-07-20T11:02:29.428701962Z: CRITICAL        ▶ cmd/func2 0d9 error saving file: open files/21: no such file or directory

Does the file 21 exist in the files directory? Not sure if this is a different error.

Ideally, the cli would support a --output-file flag to allow specifying the file name where it should save the dump file.

Yes, the file exists in the directory. The error is always for the most recent file ID. I uploaded a new attachment and ran a dump, the error went to files/22.

2024-07-21T15:49:01.12067379Z: CRITICAL ▶ cmd/func2 0d9 error saving file: open files/22: no such file or directory

I have the same problem. As I understand then using “docker exec -w …” to change the working directory breaks the backup:

# docker exec -w /app/vikunja/files vikunja-vikunja-1 /app/vikunja/vikunja dump
2024-08-21T11:43:52.370102058Z: INFO    ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
2024-08-21T11:43:52.370182322Z: INFO    ▶ migration/Migrate 002 Running migrations…
2024-08-21T11:43:52.397392157Z: INFO    ▶ migration/Migrate 069 Ran all migrations successfully.
2024-08-21T11:43:52.39765681Z: INFO     ▶ dump/Dump 06a Start dumping config file...
2024-08-21T11:43:52.397690375Z: WARNING ▶ dump/Dump 06b No config file found, not including one in the dump. This usually happens when environment variables are used for configuration.
2024-08-21T11:43:52.397707787Z: INFO    ▶ dump/Dump 06c Dumped config file
2024-08-21T11:43:52.397896529Z: INFO    ▶ dump/Dump 06d Dumped .env file
2024-08-21T11:43:52.397912036Z: INFO    ▶ dump/Dump 06e Start dumping version file...
2024-08-21T11:43:52.398502391Z: INFO    ▶ dump/Dump 06f Dumped version
2024-08-21T11:43:52.398518928Z: INFO    ▶ dump/Dump 070 Start dumping database...
2024-08-21T11:43:52.438517955Z: INFO    ▶ dump/Dump 0d5 Dumped database
2024-08-21T11:43:52.438544545Z: INFO    ▶ dump/Dump 0d6 Start dumping files...
2024-08-21T11:43:52.43900769Z: CRITICAL ▶ cmd/func2 0d8 error saving file: open files/3: no such file or directory


# ll files/
total 47
drwxr-xr-x 3    1000 root    7 Aug 21 14:43 ./
drwxrwxrwx 5 vikunja root    7 Aug 21 14:37 ../
-rw-r--r-- 1    1000 root 1221 Aug 21 13:35 1
-rw-r--r-- 1    1000 root 1224 Aug 21 13:36 2
-rw-r--r-- 1    1000 root 6027 Aug 21 14:28 3
drwx------ 2    1000 root    2 Aug 21 13:36 user-export-tmp/
-rw-r--r-- 1    1000 root 9924 Aug 21 14:43 vikunja-dump_2024-08-21_11-11-52.zip

I really would like this to be working…

I’ve just pushed 9d7b6d3d9a with a new flag to specify the dump folder path to set where the dump zip file will be saved.

With docker, you should be able to use it like this, assuming you have mounted a folder to /dump where you want to retrieve the dump file:

docker exec vikunja_app /app/vikunja/vikunja dump -p /dump

I’ve also pushed a fix in c2b116de70 to make sure the files are always retrieved with their absolute path. This should fix the problem where files could not be retrieved despite them actually existing on disk.

Please check with the next unstable build (should be ready for deployment in ~45min).

I confirm that it is working fine on my end with these changes. Thank you.

1 Like

Thank you! Is is possible for others like me to add this to the documentation, such as Command line interface ?

Also, when will the fix in 9d7b6d3d9a be released as a docker image ? I think the latest version 24.4 does not have it yet.

Sure! The website repo is here: vikunja/website - website - Gitea

I’ll happily take a PR for that.

Yeah that’s a feature and it will be included in the next release (0.25.0). The latest patch release contains bug fixes only.