Peertube: Docker with default plugins

Created on 23 Nov 2020  路  6Comments  路  Source: Chocobozzz/PeerTube

I've been testing Peertube docker images and it works great, but I was wondering how to extend PeerTube image to provide default plugins + configuration and haven't found any topics on GitHub or the forum for that.

I'm currently experiencing an issue when trying to use the install script but I do not know if it's a bug or just me not using it correctly:

+ node dist/scripts/plugin/install.js -n peertube-plugin-auth-ldap
WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
/app/dist/server/initializers/config.js:311
        throw new Error('Invalid config source.');
        ^

Error: Invalid config source.
    at getLocalConfigFilePath (/app/dist/server/initializers/config.js:311:15)
    at Object.<anonymous> (/app/dist/server/initializers/config.js:10:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/app/dist/server/initializers/constants.js:8:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/app/dist/server/helpers/custom-validators/abuses.js:6:21)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Even after specifying the configuration, I get another error:

+ export NODE_CONFIG_DIR=/app/support/docker/production/config
+ export NODE_ENV=production
+ npm run plugin:install -- --npm-name peertube-plugin-auth-ldap

> [email protected] plugin:install /app
> node ./dist/scripts/plugin/install.js "--npm-name" "peertube-plugin-auth-ldap"

/app/node_modules/config/lib/config.js:182
    throw new Error('Configuration property "' + property + '" is not defined');
    ^

Error: Configuration property "database.pool.max" is not defined

What would be the correct way to provide default plugins with env var setup in a custom docker image ?

Here is the link to the WIP docker image: https://github.com/Monogramm/docker-peertube

Question

All 6 comments

Hello,

NODE_CONFIG_DIR= should target the directory where you have the default.yaml and production.yaml config files, so in /config in the official docker compose: https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml#L44

Hi @Chocobozzz

Thanks for the answer, but I think you're misunderstanding my situation here: technically, I do not have the /config directory since I'm trying to build a Docker container based on the official image. This image would add some plugins like LDAP or Matomo.

So, as far as I understand, it seems it's not possible to install plugins before actually running PeerTube. Am I correct ?

If so, is it possible to configure a plugin through command line ?
I know how to install a plugin, but not how to configure it automatically from CLI.

So, as far as I understand, it seems it's not possible to install plugins before actually running PeerTube. Am I correct ?

Yes, because installing a plugin requires a DB insertion. So you'll have to install a plugin after the first run of PeerTube.

ok. thanks @Chocobozzz .

Last thing before I close this then: is it possible to configure a plugin's settings through CLI ?

Just to give a bit more background, our objective is to automate PeerTube deployment with automatic configuration of the LDAP authentication (this would allow us deploy PeerTube on a very large scale very easily).

Yes you can use the REST API (there is no dedicated CLI): https://docs.joinpeertube.org/api-rest-reference.html#tag/Plugins/paths/~1plugins~1{npmName}~1settings/put

Thank you very much @Chocobozzz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kabo picture kabo  路  3Comments

filmaidykai picture filmaidykai  路  3Comments

milleniumbug picture milleniumbug  路  3Comments

JohnXLivingston picture JohnXLivingston  路  3Comments

sschueller picture sschueller  路  3Comments