Migration issue

Hi all,

I’m moving to a new provider and since I already imported 100+ videos already thought to migrate my new instance to the new provider. For that purpose I followed this document to the letter. The migration is from an existing 3.0.0-rc1 server to a brand new 2.4.0 server. Everything goes fine until I try to import the database:

$ sudo -u postgres pg_restore -c -C -d postgres /tmp/peertube_prod-dump.db
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 2917; 1262 16385 DATABASE peertube_prod peertube
pg_restore: error: could not execute query: ERROR: invalid locale name: « C.utf8 »
Command was: CREATE DATABASE peertube_prod WITH TEMPLATE = template0 ENCODING = ‹ UTF8 › LC_COLLATE = ‹ C.utf8 › LC_CTYPE = ‹ C.utf8 ›;

pg_restore: error: could not execute query: ERROR: database « peertube_prod » does not exist
Command was: ALTER DATABASE peertube_prod OWNER TO peertube;

pg_restore: error: reconnection to database « peertube_prod » failed: FATAL: database « peertube_prod » does not exist

So, apparently my database is just gone from that point, which is what the -c flag does I suppose. Even removing the -c flag does not import the database and results in the same error. After thinking I messed something up I deleted the entire server and recreated it, following the guide to setup another pristine server, with the same result.

The version difference would be suspect, but the same thing happened when I upgraded the new server to 3.0.0-rc1 first. What am I missing? And how can I import the database without nuking the server again? That can’t be the best way to deal with this :smiley:

Ok, making progress, sort of. I created a new database, with the required extensions, as documented in the installation documentation. Then I imported the database with:

sudo -u postgres pg_restore -d postgres /tmp/peertube_prod-dump.db

So, without the clean and create flags and restarted peertube again. Ok, working install, but not with the data in the database I just imported? The resulting database is just 164K, while the imported db was 240K. Basically, my entries are not imported and I just have a clean install (now at 3.0.0-rc1 though!).

So, having a sleep helps, heh. Rereading the output gives an issue with the locales, which is strange. My locale -a on my old Gentoo system is:

$ locale -a

Whereas on my new Ubuntu 20.04 system it is:

$ locale -a

So, both systems have C UTF8, be it noted slightly differently. Could this be the issue? And if so, how to circumvent it?

Ok, I’ve just started from scratch. But this is a real hurdle for people moving between systems (if they use different distro’s).

In any case, I found the useful tool at PeerTube tools to import all my YouTube videos by that script. This actually saves a lot of time and wished I had known it before, heh. I mean, it’s linked in the installation documentation, but for some reason I’ve always overlooked it. Silly, I know.