Migrating from sqlite to mariadb

Having trouble installing serendipity?
Post Reply
AndreasB
Posts: 2
Joined: Sat Dec 12, 2020 4:30 pm

Migrating from sqlite to mariadb

Post by AndreasB »

Hi there,

I am running a s9y 2.1.1 installation with sqlite on a server which is shut down shortly. There are 851 posts with ~5k pictures I would like to keep. I am very happy with serendipity and do not want to move to another plattform. Therefore, I aim to move to a new server with version 2.3.5 (current stable) and mariadb.

Installation etc. was no problem, but ingesting the data was. What I tried:

* Install 2.1.1 with sqlite and use the old DB intending to upgrade to 2.3.5 later. Accessing any page gave the error: "Cannot write to directory .../templates_c/. Please check the permissions."
* Install 2.1.1 with mariadb and import sqlite dump of old db gives the same error.
* Install 2.3.5 with mariadb and just import tables permalinks, entries, references from old db into the fresh db seems to work (e.g. dropping entries and replacing it with the old version). But I loose authors and probably messed up more which I didn't notice yet.

The old db might have inconsistencies and therefore produce the errors above. I still want to preserve the data.

Can you give me a hint how to migrate properly? If there is documentation for this, I must have missed it :-/

Regards
Andreas
onli
Regular
Posts: 2822
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Migrating from sqlite to mariadb

Post by onli »

Hi!
Don't worry, that we can solve.
Accessing any page gave the error: "Cannot write to directory .../templates_c/
This might not be related to the database. It really means that the templates_c directory on the new server is not writeable for the webserver. You might have to either correct the rights manually or have them corrected by your hoster. Sometimes actions for that are in the admin area of the hoster (at manitu for example).

Have a look at https://docs.s9y.org/docs/faq/index.htm ... er-or-path for a bit more documentation.

One thing that does not seem to be covered in the documentation: You might also have to change a value in the database. In the table serendipity_config, there is one row with the key serendipityPath. That is the variable that points to the location of the serendipity installation. If the path changed (e.g. it moved from /var/www/ to /var/www/html/), then serendipity might not find the right templates_c/ directory and then throws the error you described above. To change that, you can set the value of that config row to the new path.

You can use sqlite3 for that, the command line client, or a program with a graphical interface like https://sqlitebrowser.org/.

It is almost certain that it is one of these two issues or both of them, with the corrected path and the right permissions the old sqlite datbase will continue to work on the new server. And fixing those is easier than transfering everything into a new mariadb :)
AndreasB
Posts: 2
Joined: Sat Dec 12, 2020 4:30 pm

Re: Migrating from sqlite to mariadb

Post by AndreasB »

Hi Onli,

you were right, it was the configuration serendipityPath. I had to change a few more; e.g. defaultBaseURL (well, of course, but I forgot at first). Fun anecdote: I could access the web UI config without changeing it, but the HTTP request to save the change went to the old instance. D'oh!

Now it is working for me. Thank you very much for taking the time to reply and pointing me in the right direction! I will happily continue to run s9y on the new server :-)

Regards
Andreas
onli
Regular
Posts: 2822
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Migrating from sqlite to mariadb

Post by onli »

AndreasB wrote: Thu Dec 24, 2020 1:11 pm I will happily continue to run s9y on the new server :)
That's awesome :) Happy I could help.
Post Reply