Error: running `update-host` script: database "peertube_dev" does not exist

Hi,

I’m attempting to revive an instance that hasn’t been given attention in a few months on a FreeBSD11 jail. I updated the server software (node10, nginx, postgres, etc) and pulled peertube 2.2 and overwrote production.yaml and then edited it again.

When starting the server I get this error:

[peertube.csb.sh:443] 2020-06-19 20:01:39.803 ESC[33mwarnESC[39m: It seems PeerTube was started (and created some data) with another domain name. This means you will not be able to federate! Please use NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host to fix this.

And when I try running the npm command:

root@bns-peertube:/var/www/peertube/peertube-latest # npm run update-host

> peertube@2.2.0 update-host /var/www/peertube/versions/peertube-v2.2.0
> node ./dist/scripts/update-host.js

{ SequelizeConnectionError: database "peertube_dev" does not exist
    at connection.connect.err (/var/www/peertube/versions/peertube-v2.2.0/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:182:24)
    at Connection.connectingErrorHandler (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/client.js:194:14)
    at Connection.emit (events.js:198:13)
    at Socket.<anonymous> (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:134:12)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'SequelizeConnectionError',
  parent:
   { error: database "peertube_dev" does not exist
       at Connection.parseE (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:614:13)
       at Connection.parseMessage (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:413:19)
       at Socket.<anonymous> (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:129:22)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead (internal/stream_base_commons.js:94:17)
     name: 'error',
     length: 97,
     severity: 'FATAL',
     code: '3D000',
     detail: undefined,
     hint: undefined,
     position: undefined,
     internalPosition: undefined,
     internalQuery: undefined,
     where: undefined,
     schema: undefined,
     table: undefined,
     column: undefined,
     dataType: undefined,
     constraint: undefined,
     file: 'postinit.c',
     line: '843',
     routine: 'InitPostgres' },
  original:
   { error: database "peertube_dev" does not exist
       at Connection.parseE (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:614:13)
       at Connection.parseMessage (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:413:19)
       at Socket.<anonymous> (/var/www/peertube/versions/peertube-v2.2.0/node_modules/pg/lib/connection.js:129:22)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead (internal/stream_base_commons.js:94:17)
     name: 'error',
     length: 97,
     severity: 'FATAL',
     code: '3D000',
     detail: undefined,
     hint: undefined,
     position: undefined,
     internalPosition: undefined,
     internalQuery: undefined,
     where: undefined,
     schema: undefined,
     table: undefined,
     column: undefined,
     dataType: undefined,
     constraint: undefined,
     file: 'postinit.c',
     line: '843',
     routine: 'InitPostgres' } }
memory: high-water mark 0 bytes
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! peertube@2.2.0 update-host: `node ./dist/scripts/update-host.js`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the peertube@2.2.0 update-host script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-20T03_00_38_821Z-debug.log

Searching for « error database peertube_dev » brings up discussions of docker, but this system is using the extracted zip files. I have previously tried setting docker up (and then deleting it) though.

is there a peertube_dev database ?
what does following command returns ?

sudo -u postgres psql -l

Thanks plhardy.

There’s no _dev database, only _prod:

# sudo -u postgres psql -l
                       List of databases
 Name      |  Owner   | Encoding | Collate | Ctype |   Access privileges   
---------------+----------+----------+---------+-------+-----------------------
 peertube_prod | peertube | UTF8     | C       | C     | 
 postgres      | postgres | UTF8     | C       | C     | 
 template0     | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1     | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
(4 rows)

Edit: The _prod suffix is set in production.yaml, but default.yaml specifies database.suffix to be _dev.

Are you running the command as documented? https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/tools.md#update-hostjs

I was not! I ran the command as the peertube user and it completed successfully. Thank you rigelk!

1 « J'aime »