Restoring from a docker volume

Hello,

I’m an idiot, I started using vikunja quite actively, and then started to make changes to my live instance. I swiftly broke it, and I’ve not been able to get it back to the same state. All my fault, I need to get better at sysadmining.

Normally at this stage I’d nuke and reinstall and learn a lesson, but I’d actually quite like to keep what I’d created in Vikunja this time around.

I’d correctly mapped my volumes, so I have a /db folder which appears to be complete.

If I just start a new instance of vikunja over the top of this one, it won’t let me log in - it’s not picking up the db entries.

Could someone please point me towards being able to ‘import’ this db into a new instance?

I used the simple Docker without any proxy example here:

Thank you so much :slight_smile:

Can you check if your db contains all data you entered in Vikunja?

To get a db shell in the container: docker-compose exec mysql -u root -p, then SHOW DATABASES to check if there even is a Vikunja DB. Select the db with use <DB>, and then check if the tables are present with SHOW TABLES. If there are tables check if they contain data. For example the tasks table: select * from tasks.

Since you’re hosting with docker you may want to check out my docker db backup tool:

Ah no - SHOW DATABASES returns blank outcome. Nuked!

Must have overwritten it when I fired up the container again?

I think I need to put in some foundational study on DBs - I really don’t know what I’m doing with them. Not to worry - entirely my fault. Thanks so much for the product :slight_smile:

1 Like

If you used the volume mount like this one:

      - ./db:/var/lib/mysql

it should not have overridden that. There might be additional info in the logs though. It’s also interesting there’s no database at all because usually there should be at least an internal mysql db. If really all data was nuked the db container would also create a new empty vikunja db when it starts again.
Did you check this as root?

You’re welcome! :slightly_smiling_face:

Ah - you’re right ! My MariaDB CLI knowledge is weak.

I seem to have data in the database, although I can’t tell if they’re default or mine.

I’m reading the guide at mysql Command-line Client - MariaDB Knowledge Base as fast as I can, but if you could suggest a couple of sample commands to see what I’ve got that would be amazing.

buymeacoffee the best way to support yes?

Vikunja won’t create any data by itself so if you have any tasks or users these should be yours.

It’s probably more about SQL knowledge than the cli, you only need to know how the client works to get a shell into the db where you can run sql queries.

To get a shell: docker-compose exec mysql -u root -p vikunja. Then enter the password you set for the MYSQL_ROOT_PASSWORD env variable. The prompt should now look something like this:

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 178223
Server version: 10.7.3-MariaDB-1:10.7.3+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [vikunja]>

The -u root flag tells it to connect as the root user, the -p flag without any parameter tells it to ask for a password and vikunja as the last parameter tells it to directly select the vikunja database (that’s the same as running USE vikunja).

Next, check if you have any tables by running SHOW TABLES. Should looks something like this:

MariaDB [vikunja]> show tables;
+-------------------+
| Tables_in_vikunja |
+-------------------+
| buckets           |
| favorites         |
| files             |
| label_tasks       |
| labels            |
| link_shares       |
| lists             |
| migration         |
| migration_status  |
| namespaces        |
| notifications     |
| saved_filters     |
| subscriptions     |
| task_assignees    |
| task_attachments  |
| task_comments     |
| task_relations    |
| task_reminders    |
| tasks             |
| team_lists        |
| team_members      |
| team_namespaces   |
| teams             |
| totp              |
| unsplash_photos   |
| user_tokens       |
| users             |
| users_lists       |
| users_namespaces  |
+-------------------+
29 rows in set (0.001 sec)

Then, to check if there are any tasks run SELECT * FROM tasks. For users run SELECT * FROM users (won’t be able to show you my output here since this is public and there is tasks from other people in there).

Either that or GitHub Sponsors (there’s a one time option there as well). If you have it set up I’d prefer GitHub Sponsors because of the lower fees.

Thanks - I spent a few hours going through the MariaDB beginners tutorials and realised that I had an empty database. No big deal, I didn’t lose anything critical.

I set up a new instance, more slowly this time, and we’re back on track. Give me a few more months and I’ll have it running beautifully :slight_smile:

Donation made - if that gets me a moment’s notice for a feature request, I really like the way that I can assign sub-checkboxes to a task in the Microsoft products like ToDo and Planner!

Awesome, thank you very much!

By “sub-checkboxes”, do you mean something like this:

Yes - the same genre of problem as that.

The discussion is already very good - no need to add to it here!