I had an update error too. I just deleted the directory from Peertube /var/www/peertube/versions/peertube-v3.1.0-rc1
and reinstalled. Then I replaced the config files and fixed all paths and passwords in them. Everything works great. But still there was a problem with the update.
I’m using postgresql 9.6 through freebsd’s pkg installer.
# pkg info | grep -i postgresql
postgresql96-client-9.6.20 PostgreSQL database (client)
postgresql96-contrib-9.6.20 The contrib utilities from the PostgreSQL distribution
postgresql96-server-9.6.20 PostgreSQL is the most advanced open-source database available anywhere
Thanks @alterak! I’ll give that a shot when I have some time today.
Thank you @Chocobozzz, I switched to postgresql 13 and the upgrade appears to have worked!
@mrflos I haven’t seen that upgrade path before, this is the process I used:
# pkg install postgresql13-server postgresql13-client postgresql13-contrib
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 5 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
llvm11: 11.0.1
lua52: 5.2.4
postgresql13-client: 13.1
postgresql13-contrib: 13.1_1
postgresql13-server: 13.1_1
Number of packages to be installed: 5
The process will require 765 MiB more space.
123 MiB to be downloaded.
Proceed with this action? [y/N]: y
[bns-normandy] [1/5] Fetching postgresql13-server-13.1_1.txz: 100% 13 MiB 13.3MB/s 00:01
[bns-normandy] [2/5] Fetching postgresql13-client-13.1.txz: 100% 3 MiB 2.8MB/s 00:01
[bns-normandy] [3/5] Fetching postgresql13-contrib-13.1_1.txz: 100% 487 KiB 498.6kB/s 00:01
[bns-normandy] [4/5] Fetching llvm11-11.0.1.txz: 100% 107 MiB 4.0MB/s 00:28
[bns-normandy] [5/5] Fetching lua52-5.2.4.txz: 100% 175 KiB 178.7kB/s 00:01
Checking integrity... done (4 conflicting)
- postgresql13-server-13.1_1 conflicts with postgresql96-server-9.6.20 on /usr/local/bin/initdb
- postgresql13-client-13.1 conflicts with postgresql96-client-9.6.20 on /usr/local/bin/clusterdb
- postgresql13-client-13.1 conflicts with postgresql96-client-9.6.20 on /usr/local/bin/clusterdb
- postgresql13-contrib-13.1_1 conflicts with postgresql96-contrib-9.6.20 on /usr/local/bin/oid2name
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 8 package(s) will be affected (of 0 checked):
Installed packages to be REMOVED:
postgresql96-client: 9.6.20
postgresql96-contrib: 9.6.20
postgresql96-server: 9.6.20
New packages to be INSTALLED:
llvm11: 11.0.1
lua52: 5.2.4
postgresql13-client: 13.1
postgresql13-contrib: 13.1_1
postgresql13-server: 13.1_1
Number of packages to be removed: 3
Number of packages to be installed: 5
The process will require 731 MiB more space.
Proceed with this action? [y/N]: y
[bns-normandy] [1/8] Deinstalling postgresql96-server-9.6.20...
[bns-normandy] [1/8] Deleting files for postgresql96-server-9.6.20: 100%
==> You should manually remove the "postgres" user.
==> You should manually remove the "postgres" group
[bns-normandy] [2/8] Deinstalling postgresql96-contrib-9.6.20...
[bns-normandy] [2/8] Deleting files for postgresql96-contrib-9.6.20: 100%
[bns-normandy] [3/8] Deinstalling postgresql96-client-9.6.20...
[bns-normandy] [3/8] Deleting files for postgresql96-client-9.6.20: 100%
[bns-normandy] [4/8] Installing lua52-5.2.4...
[bns-normandy] [4/8] Extracting lua52-5.2.4: 100%
[bns-normandy] [5/8] Installing postgresql13-client-13.1...
[bns-normandy] [5/8] Extracting postgresql13-client-13.1: 100%
[bns-normandy] [6/8] Installing llvm11-11.0.1...
[bns-normandy] [6/8] Extracting llvm11-11.0.1: 100%
[bns-normandy] [7/8] Installing postgresql13-server-13.1_1...
===> Creating groups.
Using existing group 'postgres'.
===> Creating users
Using existing user 'postgres'.
===> Creating homedir(s)
=========== BACKUP YOUR DATA! =============
As always, backup your data before
upgrading. If the upgrade leads to a higher
major revision (e.g. 9.6 -> 10), a dump
and restore of all databases is
required. This is *NOT* done by the port!
See https://www.postgresql.org/docs/current/upgrading.html
===========================================
[bns-normandy] [7/8] Extracting postgresql13-server-13.1_1: 100%
[bns-normandy] [8/8] Installing postgresql13-contrib-13.1_1...
[bns-normandy] [8/8] Extracting postgresql13-contrib-13.1_1: 100%
=====
Message from postgresql13-client-13.1:
--
The PostgreSQL port has a collection of "side orders":
postgresql-docs
For all of the html documentation
p5-Pg
A perl5 API for client access to PostgreSQL databases.
postgresql-tcltk
If you want tcl/tk client support.
postgresql-jdbc
For Java JDBC support.
postgresql-odbc
For client access from unix applications using ODBC as access
method. Not needed to access unix PostgreSQL servers from Win32
using ODBC. See below.
ruby-postgres, py-psycopg2
For client access to PostgreSQL databases using the ruby & python
languages.
postgresql-plperl, postgresql-pltcl & postgresql-plruby
For using perl5, tcl & ruby as procedural languages.
postgresql-contrib
Lots of contributed utilities, postgresql functions and
datatypes. There you find pg_standby, pgcrypto and many other cool
things.
etc...
=====
Message from postgresql13-server-13.1_1:
--
For procedural languages and postgresql functions, please note that
you might have to update them when updating the server.
If you have many tables and many clients running, consider raising
kern.maxfiles using sysctl(8), or reconfigure your kernel
appropriately.
The port is set up to use autovacuum for new databases, but you might
also want to vacuum and perhaps backup your database regularly. There
is a periodic script, /usr/local/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~pgsql/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script /usr/local/share/postgresql/odbc.sql
to get the functions required for ODBC compliance.
Please note that if you use the rc script,
/usr/local/etc/rc.d/postgresql, to initialize the database, unicode
(UTF-8) will be used to store character data by default. Set
postgresql_initdb_flags or use login.conf settings described below to
alter this behaviour. See the start rc script for more info.
To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
:lang=en_US.UTF-8:\
:setenv=LC_COLLATE=C:\
:tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.
======================================================================
To initialize the database, run
/usr/local/etc/rc.d/postgresql initdb
You can then start PostgreSQL by running:
/usr/local/etc/rc.d/postgresql start
For postmaster settings, see ~pgsql/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
See ~pgsql/data/postgresql.conf for more info
NB. If you're not using a checksumming filesystem like ZFS, you might
wish to enable data checksumming. It can only be enabled during
the initdb phase, by adding the "--data-checksums" flag to
the postgres_initdb_flags rcvar. Check the initdb(1) manpage
for more info and make sure you understand the performance
implications.
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
=====
Message from postgresql13-contrib-13.1_1:
--
The PostgreSQL contrib utilities have been installed. Please see
/usr/local/share/doc/postgresql/contrib/README
for more information.
root@bns-normandy:/var/www/peertube # /usr/local/etc/rc.d/postgresql initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /var/db/postgres/data13 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... US/Central
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/bin/pg_ctl -D /var/db/postgres/data13 -l logfile start
root@bns-normandy:/var/www/peertube # service postgresql start
2021-03-25 09:39:48.368 CDT [63446] LOG: ending log output to stderr
2021-03-25 09:39:48.368 CDT [63446] HINT: Future log output will go to log destination "syslog".
root@bns-normandy:/var/www/peertube # sudo -u postgres createuser -P peertube
Enter password for new role:
Enter it again:
# sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod
root@bns-normandy:/var/www/peertube # sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_prod
CREATE EXTENSION
root@bns-normandy:/var/www/peertube # sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_prod
CREATE EXTENSION
root@bns-normandy:/var/www/peertube #
root@bns-normandy:/var/www/peertube #
root@bns-normandy:/var/www/peertube # sudo -u postgres pg_restore -c -C -d postgres backup/sql-peertube_prod-21-03-24.sql
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 5; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR: schema "public" already exists
Command was: CREATE SCHEMA public;
pg_restore: warning: errors ignored on restore: 1
root@bns-normandy:/var/www/peertube # service peertube start