How can I import vikunja dump zip file

It’s called env and it prints out all environment variables.

Returns:

HOSTNAME=cd748f213bf3
SHLVL=1
HOME=/root
PGID=1000
TERM=xterm
VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PUID=1000
PWD=/app/vikunja
1 Like

Is VIKUNJA_SERVICE_ROOTPATH the only env variable you set? Because if that’s not the case the shell you’re starting in the container does not pick up the config and thus assumes default for everything - which would lead to an empty sqlite database being used for the dump.

I was using this:

    vikunja:
        container_name: vikunja
        ports:
            - '80:80'
        volumes:
            - '/home/admin/vikunja/files:/app/vikunja/files'
        restart: unless-stopped
        image: vikunja/api

In that config, you did not configure a db or a volume for the default SQLite database file. That means on every restart, your database will be lost (with all data in it). I guess that explains the behaviour you’re seeing.

Check out the docker examples for a persistent setup:

I keep geting
240493242Z: CRITICAL ▶ migration/initMigration 001 Could not connect to db: could not open database file [uid=1000, gid=1000]: open /home/adm/vikunja/vikunja.db: no such file or directory
with this config:

vikunja:
        container_name: vikunja
        ports:
            - '3456:3456'
        environment:
            - VIKUNJA_DATABASE_PATH=/home/adm/vikunja/vikunja.db
            - PUID=1000
            - PGID=1000
        volumes:
            - '/home/adm/vikunja/files:/app/vikunja/files'
            - '/home/adm/vikunja/config.yml:/etc//vikunja/config.yml'
            - '/home/adm/vikunja/vikunja.db:/app/vikunja/vikunja.db'
        restart: unless-stopped
        image: vikunja/api
    frontend:
        container_name: vikunja-front
        ports:
            - '3451:80'
        restart: unless-stopped
        image: vikunja/frontend

/home/adm/vikunja/vikunja.db only exists outside the container. If you set VIKUNJA_DATABASE_PATH to that it won’t work because the path is different inside the container. The right part after the : in the volume definition is what the container sees, the left side is the host.

Try setting it to /app/vikunja/vikunja.db instead.

It runs, but I get this when I tried vikunja dump

2023/03/11 22:29:10 Using config file: /etc/vikunja/config.yml
2023-03-11T22:29:10.775951223Z: INFO	▶ migration/Migrate 04e Ran all migrations successfully.
2023-03-11T22:29:10.776738144Z: INFO	▶ models/RegisterReminderCron 04f Mailer is disabled, not sending reminders per mail
2023-03-11T22:29:10.777225344Z: INFO	▶ models/RegisterOverdueReminderCron 050 Mailer is disabled, not sending overdue per mail
2023-03-11T22:29:10.777919394Z: INFO	▶ dump/Dump 051 Start dumping config file...
2023-03-11T22:29:10.780864225Z: INFO	▶ dump/Dump 052 Dumped config file
2023-03-11T22:29:10.781155352Z: INFO	▶ [EVENTS] 056 Adding handler, topic=poison, handler_name=poison.logger
2023-03-11T22:29:10.781383777Z: INFO	▶ [EVENTS] 058 Adding handler, handler_name=task.created.task.counter.increase, topic=task.created
2023-03-11T22:29:10.78158272Z: INFO	▶ [EVENTS] 059 Adding handler, handler_name=task.created.task.created.mentions, topic=task.created
2023-03-11T22:29:10.781901458Z: INFO	▶ [EVENTS] 05a Adding handler, topic=task.updated, handler_name=task.updated.task.updated.mentions
2023-03-11T22:29:10.782081253Z: INFO	▶ [EVENTS] 05b Adding handler, handler_name=task.deleted.task.counter.decrease, topic=task.deleted
2023-03-11T22:29:10.782441454Z: INFO	▶ [EVENTS] 05c Adding handler, handler_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2023-03-11T22:29:10.782778396Z: INFO	▶ [EVENTS] 05d Adding handler, handler_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2023-03-11T22:29:10.782998802Z: INFO	▶ [EVENTS] 05e Adding handler, handler_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2023-03-11T22:29:10.78340991Z: INFO	▶ [EVENTS] 05f Adding handler, handler_name=task.assignee.created.task.assignee.subscribe, topic=task.assignee.created
2023-03-11T22:29:10.783689723Z: INFO	▶ [EVENTS] 060 Adding handler, topic=team.member.added, handler_name=team.member.added.team.member.added.notification
2023-03-11T22:29:10.783977424Z: INFO	▶ [EVENTS] 061 Adding handler, topic=list.created, handler_name=list.created.list.counter.increase
2023-03-11T22:29:10.784555309Z: INFO	▶ [EVENTS] 062 Adding handler, handler_name=list.created.send.list.created.notification, topic=list.created
2023-03-11T22:29:10.784810604Z: INFO	▶ [EVENTS] 063 Adding handler, handler_name=list.deleted.list.counter.decrease, topic=list.deleted
2023-03-11T22:29:10.785242786Z: INFO	▶ [EVENTS] 064 Adding handler, handler_name=team.created.team.counter.increase, topic=team.created
2023-03-11T22:29:10.785564506Z: INFO	▶ [EVENTS] 065 Adding handler, handler_name=task.comment.edited.handle.task.comment.edit.mentions, topic=task.comment.edited
2023-03-11T22:29:10.785643468Z: INFO	▶ [EVENTS] 066 Adding handler, handler_name=user.export.requested.handle.user.data.export, topic=user.export.requested
2023-03-11T22:29:10.785856355Z: INFO	▶ [EVENTS] 067 Adding handler, handler_name=user.created.increase.user.counter, topic=user.created
2023-03-11T22:29:10.786122094Z: INFO	▶ [EVENTS] 068 Adding handler, handler_name=namespace.created.namespace.counter.increase, topic=namespace.created
2023-03-11T22:29:10.786393574Z: INFO	▶ [EVENTS] 069 Adding handler, handler_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2023-03-11T22:29:10.786458351Z: INFO	▶ [EVENTS] 06a Adding handler, handler_name=team.deleted.team.counter.decrease, topic=team.deleted
2023-03-11T22:29:10.787833637Z: INFO	▶ dump/Dump 06d Dumped .env file
2023-03-11T22:29:10.789501959Z: INFO	▶ dump/Dump 06e Start dumping version file...
2023-03-11T22:29:10.790091769Z: INFO	▶ dump/Dump 06f Dumped version
2023-03-11T22:29:10.790199305Z: INFO	▶ dump/Dump 070 Start dumping database...
2023-03-11T22:29:10.792857545Z: INFO	▶ [EVENTS] 08b Starting handler, subscriber_name=team.created.team.counter.increase, topic=team.created
2023-03-11T22:29:10.792860768Z: INFO	▶ [EVENTS] 08c Starting handler, subscriber_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2023-03-11T22:29:10.793018155Z: INFO	▶ [EVENTS] 08d Starting handler, subscriber_name=poison.logger, topic=poison
2023-03-11T22:29:10.793141488Z: INFO	▶ [EVENTS] 08e Starting handler, subscriber_name=task.created.task.counter.increase, topic=task.created
2023-03-11T22:29:10.793887149Z: INFO	▶ [EVENTS] 090 Starting handler, subscriber_name=list.created.list.counter.increase, topic=list.created
2023-03-11T22:29:10.794307553Z: INFO	▶ [EVENTS] 093 Starting handler, subscriber_name=task.assignee.created.task.assignee.subscribe, topic=task.assignee.created
2023-03-11T22:29:10.793983167Z: INFO	▶ [EVENTS] 091 Starting handler, subscriber_name=team.member.added.team.member.added.notification, topic=team.member.added
2023-03-11T22:29:10.794046907Z: INFO	▶ [EVENTS] 092 Starting handler, subscriber_name=task.created.task.created.mentions, topic=task.created
2023-03-11T22:29:10.794467867Z: INFO	▶ [EVENTS] 094 Starting handler, subscriber_name=list.created.send.list.created.notification, topic=list.created
2023-03-11T22:29:10.795415953Z: INFO	▶ [EVENTS] 096 Starting handler, topic=task.comment.edited, subscriber_name=task.comment.edited.handle.task.comment.edit.mentions
2023-03-11T22:29:10.795861672Z: INFO	▶ [EVENTS] 098 Starting handler, subscriber_name=user.export.requested.handle.user.data.export, topic=user.export.requested
2023-03-11T22:29:10.795957227Z: INFO	▶ [EVENTS] 099 Starting handler, subscriber_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2023-03-11T22:29:10.796564611Z: INFO	▶ [EVENTS] 09d Starting handler, subscriber_name=namespace.created.namespace.counter.increase, topic=namespace.created
2023-03-11T22:29:10.796839331Z: INFO	▶ [EVENTS] 09f Starting handler, subscriber_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2023-03-11T22:29:10.797004664Z: INFO	▶ [EVENTS] 0a1 Starting handler, topic=user.created, subscriber_name=user.created.increase.user.counter
2023-03-11T22:29:10.796116189Z: INFO	▶ [EVENTS] 09b Starting handler, subscriber_name=task.deleted.task.counter.decrease, topic=task.deleted
2023-03-11T22:29:10.796787721Z: INFO	▶ [EVENTS] 09e Starting handler, subscriber_name=task.updated.task.updated.mentions, topic=task.updated
2023-03-11T22:29:10.798028323Z: INFO	▶ [EVENTS] 0a5 Starting handler, subscriber_name=team.deleted.team.counter.decrease, topic=team.deleted
2023-03-11T22:29:10.797348309Z: INFO	▶ [EVENTS] 0a2 Starting handler, subscriber_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2023-03-11T22:29:10.796058467Z: INFO	▶ [EVENTS] 09a Starting handler, subscriber_name=list.deleted.list.counter.decrease, topic=list.deleted
2023-03-11T22:29:10.827215482Z: INFO	▶ dump/Dump 0f1 Dumped database
2023-03-11T22:29:10.82735174Z: INFO	▶ dump/Dump 0f2 Start dumping files...
2023-03-11T22:29:10.829091987Z: CRITICAL	▶ cmd/func2 0f4 error saving file: open files/2: no such file or directory

That looks like a file is gone but wasn’t deleted from the database. Try deleting the entry with the id 2 from the files database.

I did exacly that, and stoped, removed, created the container again and than loged in in the same account, wich I could sucessufully, just had to upload the avatar again, I don’t know if it was in the id 2. But I ran to the same error:

2023/03/12 15:43:36 Using config file: /etc/vikunja/config.yml
2023-03-12T15:43:36.133508252Z: INFO	▶ migration/Migrate 04e Ran all migrations successfully.
2023-03-12T15:43:36.134189688Z: INFO	▶ models/RegisterReminderCron 04f Mailer is disabled, not sending reminders per mail
2023-03-12T15:43:36.134628664Z: INFO	▶ models/RegisterOverdueReminderCron 050 Mailer is disabled, not sending overdue per mail
2023-03-12T15:43:36.135318192Z: INFO	▶ dump/Dump 051 Start dumping config file...
2023-03-12T15:43:36.137617942Z: INFO	▶ dump/Dump 052 Dumped config file
2023-03-12T15:43:36.138772557Z: INFO	▶ [EVENTS] 056 Adding handler, handler_name=poison.logger, topic=poison
2023-03-12T15:43:36.138905Z: INFO	▶ [EVENTS] 058 Adding handler, handler_name=user.created.increase.user.counter, topic=user.created
2023-03-12T15:43:36.139477678Z: INFO	▶ [EVENTS] 059 Adding handler, topic=list.created, handler_name=list.created.list.counter.increase
2023-03-12T15:43:36.140203447Z: INFO	▶ [EVENTS] 05a Adding handler, handler_name=list.created.send.list.created.notification, topic=list.created
2023-03-12T15:43:36.140318205Z: INFO	▶ [EVENTS] 05b Adding handler, handler_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2023-03-12T15:43:36.140391926Z: INFO	▶ [EVENTS] 05c Adding handler, handler_name=task.created.task.counter.increase, topic=task.created
2023-03-12T15:43:36.141106602Z: INFO	▶ [EVENTS] 05d Adding handler, handler_name=task.created.task.created.mentions, topic=task.created
2023-03-12T15:43:36.141223897Z: INFO	▶ [EVENTS] 05e Adding handler, handler_name=team.deleted.team.counter.decrease, topic=team.deleted
2023-03-12T15:43:36.141792705Z: INFO	▶ [EVENTS] 060 Adding handler, handler_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2023-03-12T15:43:36.141924296Z: INFO	▶ [EVENTS] 061 Adding handler, handler_name=task.assignee.created.task.assignee.subscribe, topic=task.assignee.created
2023-03-12T15:43:36.14178865Z: INFO	▶ dump/Dump 05f Dumped .env file
2023-03-12T15:43:36.142159886Z: INFO	▶ dump/Dump 063 Start dumping version file...
2023-03-12T15:43:36.142858007Z: INFO	▶ dump/Dump 064 Dumped version
2023-03-12T15:43:36.141983592Z: INFO	▶ [EVENTS] 062 Adding handler, topic=namespace.created, handler_name=namespace.created.namespace.counter.increase
2023-03-12T15:43:36.143024431Z: INFO	▶ dump/Dump 065 Start dumping database...
2023-03-12T15:43:36.143113115Z: INFO	▶ [EVENTS] 066 Adding handler, handler_name=team.created.team.counter.increase, topic=team.created
2023-03-12T15:43:36.144141269Z: INFO	▶ [EVENTS] 068 Adding handler, handler_name=team.member.added.team.member.added.notification, topic=team.member.added
2023-03-12T15:43:36.144475654Z: INFO	▶ [EVENTS] 069 Adding handler, handler_name=task.comment.edited.handle.task.comment.edit.mentions, topic=task.comment.edited
2023-03-12T15:43:36.14475965Z: INFO	▶ [EVENTS] 06a Adding handler, handler_name=task.deleted.task.counter.decrease, topic=task.deleted
2023-03-12T15:43:36.144910482Z: INFO	▶ [EVENTS] 06c Adding handler, handler_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2023-03-12T15:43:36.145105109Z: INFO	▶ [EVENTS] 06d Adding handler, handler_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2023-03-12T15:43:36.14525394Z: INFO	▶ [EVENTS] 06e Adding handler, handler_name=task.updated.task.updated.mentions, topic=task.updated
2023-03-12T15:43:36.145403624Z: INFO	▶ [EVENTS] 06f Adding handler, handler_name=user.export.requested.handle.user.data.export, topic=user.export.requested
2023-03-12T15:43:36.145555029Z: INFO	▶ [EVENTS] 070 Adding handler, handler_name=list.deleted.list.counter.decrease, topic=list.deleted
2023-03-12T15:43:36.151270162Z: INFO	▶ [EVENTS] 091 Starting handler, subscriber_name=task.comment.edited.handle.task.comment.edit.mentions, topic=task.comment.edited
2023-03-12T15:43:36.151361865Z: INFO	▶ [EVENTS] 092 Starting handler, subscriber_name=poison.logger, topic=poison
2023-03-12T15:43:36.151535622Z: INFO	▶ [EVENTS] 094 Starting handler, subscriber_name=user.export.requested.handle.user.data.export, topic=user.export.requested
2023-03-12T15:43:36.151591047Z: INFO	▶ [EVENTS] 096 Starting handler, subscriber_name=team.member.added.team.member.added.notification, topic=team.member.added
2023-03-12T15:43:36.15161214Z: INFO	▶ [EVENTS] 098 Starting handler, subscriber_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2023-03-12T15:43:36.151604344Z: INFO	▶ [EVENTS] 097 Starting handler, subscriber_name=list.deleted.list.counter.decrease, topic=list.deleted
2023-03-12T15:43:36.151704527Z: INFO	▶ [EVENTS] 09a Starting handler, subscriber_name=namespace.created.namespace.counter.increase, topic=namespace.created
2023-03-12T15:43:36.151659139Z: INFO	▶ [EVENTS] 099 Starting handler, topic=task.deleted, subscriber_name=task.deleted.task.counter.decrease
2023-03-12T15:43:36.151782175Z: INFO	▶ [EVENTS] 09c Starting handler, subscriber_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2023-03-12T15:43:36.151540807Z: INFO	▶ [EVENTS] 095 Starting handler, subscriber_name=task.created.task.created.mentions, topic=task.created
2023-03-12T15:43:36.151826526Z: INFO	▶ [EVENTS] 09d Starting handler, subscriber_name=user.created.increase.user.counter, topic=user.created
2023-03-12T15:43:36.151487104Z: INFO	▶ [EVENTS] 093 Starting handler, subscriber_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2023-03-12T15:43:36.151878377Z: INFO	▶ [EVENTS] 09e Starting handler, subscriber_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2023-03-12T15:43:36.151928895Z: INFO	▶ [EVENTS] 0a1 Starting handler, subscriber_name=team.deleted.team.counter.decrease, topic=team.deleted
2023-03-12T15:43:36.15194958Z: INFO	▶ [EVENTS] 0a2 Starting handler, subscriber_name=task.assignee.created.task.assignee.subscribe, topic=task.assignee.created
2023-03-12T15:43:36.151895321Z: INFO	▶ [EVENTS] 0a0 Starting handler, subscriber_name=task.updated.task.updated.mentions, topic=task.updated
2023-03-12T15:43:36.151778064Z: INFO	▶ [EVENTS] 09b Starting handler, subscriber_name=list.created.list.counter.increase, topic=list.created
2023-03-12T15:43:36.151993654Z: INFO	▶ [EVENTS] 0a3 Starting handler, subscriber_name=task.created.task.counter.increase, topic=task.created
2023-03-12T15:43:36.151269866Z: INFO	▶ [EVENTS] 090 Starting handler, subscriber_name=team.created.team.counter.increase, topic=team.created
2023-03-12T15:43:36.152016783Z: INFO	▶ [EVENTS] 0a4 Starting handler, subscriber_name=list.created.send.list.created.notification, topic=list.created
2023-03-12T15:43:36.181921489Z: INFO	▶ dump/Dump 0f1 Dumped database
2023-03-12T15:43:36.182048117Z: INFO	▶ dump/Dump 0f2 Start dumping files...
2023-03-12T15:43:36.183477118Z: CRITICAL	▶ cmd/func2 0f4 error saving file: open files/3: no such file or directory

Also in my files directory just there is a folder 3 Let me know if I made anything wrong and thank you for the help!

What’s in that folder?

To resolve this, you can do the same as with the other file.

It’s actually not a folder, it’s a file with the name 3 the same as the previously 2. So in files there is just the file with a number that’s created. If I delete 3 it happens that when I recreate the container the only thing that happens Is that I have to upload my avatar again, and vikunja creates another file called 4 but the error keeps prompting “no such file or directory”.

And this time with the file 4?

I see in your compose file you have mounted a config.yml file. What’s the value of the files.basepath or service.rootpath?

Exacly I have mounted a config.yml, but when I open it it’s empty! I don’t know why. Very strange

Did you put content in the config file? Vikunja will only ever read the config, never create or update one.

Oh no! I read in other post that was to create the file with touch and than mount. So this would prevent from losing data.

That’s technically correct by Vikunja won’t touch that file. Take a look at the docs and add what you need. You don’t need to add the default values to the config file.

Anyway, if your config is empty that can’t be the cause of the problem you have. How many files are in the files directory? Is there a file for every entry in the files table in the database and vice-versa?

In files there is just a file with a number, in this case 5 as I was deleting the file(Initially 1) to see if this was the problem.

And is there an entry with the id 5 in the files table in the database?

Strangely I was able to solve this by adding service rootpath and database path in my config file. And I also ran a lot of vikunja migrate . I open json files and they are displayed correclty; hope to not lose the data too. Thanks for the support, seriously, vikunja has not a lot of developers, so you’re very important. You spend a lot of time answering stuff here. Hope to see more contributors in open source, like the guy that’s developing the mobile app.

1 Like