0
Answered

Database Backup / Rebuild

Bobby Hill 7 years ago updated by hitnrun30 6 years ago 6

Would simply making a copy of the .db file be suitable as a backup?  If I reinstalled Ubooquity and dropped the file into my Ubooquity folder, would it be recognized?


With as heavily skinned as this program can be, if the database gets wiped all the links get changed to new values.


If it's not as simple as replacing the fresh install's database file with the old file, can we get a to-do for an option in the Admin screen to load from a database file?

Answer

Answer
Answered

I just wrote a page describing the directory structure of Ubooquity so that you can know what contains what:

https://vaemendis.github.io/ubooquity-doc/pages/dir-structure.html


Basically, if you want to backup your installation and restore it without having to rescan your files, you'll need:


  • preferences.json (your settings)
  • ubooquity-5.mv.db (the database)
  • webadmin.cred (contains your admin password)
  • the cache folder (the covers of your books)
  • the themes folder (if you added additional themes inside)

So if you don't care about wasting a few megs, you might as well just backup and restore your whole Ubooquity directory without the "jar" file (or with, if you want to keep the same version ).

Hi,

Not exactly the same need but a related one: I'd like the migration from 1.x to 2.x to be in position to migrate the users definition automatically. Otherwise, as all db are restarted from scratch, you just loose all users and need to redefine them on by one, but then you change their pwd, which is leading to frustration...

Tom, can you evaluate?

Thanks

+1

Shared directories and users (with their password) are stored in the preferences files (preferences.json).

Unfortunately for you, the format has changed between 1.x and 2.x.

If your concern is only the users, I'd advise to manually edit the new preferences file and add them using the info taken from the old preferences.xml file.


Let me know if you need additional info to do that.

Well... Then, from the old preferences.xml, I extracted the user list, in the form:


<user>

           <name>USER_1</name

           <passwordHash>HASH_1</passwordHash>

</user>

<user>

           <name>USER_2</name>

           <passwordHash>HASH_2</passwordHash>

</user>


In the new preferences.json, I copy-pasted the former user settings in the section 

 "users" : [ {

    "name" : "USER_1",

    "passwordHash" : "HASH_1"

  }, {

     "name" : "USER_2",

    "passwordHash" : "HASH_2"

  } ],

That enough to re-recreate the previously defined users.

I had a limited number of users therefore could do it by hand. For a bigger user db, would be a pain in the %%% ;-)


If you want to set the permissions for the re-recreated users, then for each "pathString" above the "users" section, you have to complete like this:

"userName" : [ "USER_1", "USER_2" ]


Thanks for the help Tom.


I still believe that for the public release you should propose an automatic mean to transfer the old settings db to the new one. Based on what I saw it seems it be achievable ;-)

Otherwise this will limit the penetration rate of v2.

+1

Yes, it's technically feasible, but as usual, it would require time that could be spent on other features.

That's the first time in almost 4 years that settings compatibility is lost with a new version. I know it's a bit painful, but I'll rely on users for this one, sorry.

Answer
Answered

I just wrote a page describing the directory structure of Ubooquity so that you can know what contains what:

https://vaemendis.github.io/ubooquity-doc/pages/dir-structure.html


Basically, if you want to backup your installation and restore it without having to rescan your files, you'll need:


  • preferences.json (your settings)
  • ubooquity-5.mv.db (the database)
  • webadmin.cred (contains your admin password)
  • the cache folder (the covers of your books)
  • the themes folder (if you added additional themes inside)

So if you don't care about wasting a few megs, you might as well just backup and restore your whole Ubooquity directory without the "jar" file (or with, if you want to keep the same version ).

Simple question, what should I open the db in so that i can look at the database information.  I thought it would be SQlite, but i am having issues opening it.