PeerTube: Difference between revisions

From NixOS Wiki
add correct database owner
Klinger (talk | contribs)
 
Line 68: Line 68:




[[Category:Applications]]
[[Category:Web Applications]]
[[Category:Server]]

Latest revision as of 18:48, 10 May 2024

PeerTube is a web application to host, browse and share uploaded videos via P2P in a federated network.

Installation

Following example code initializes a simple PeerTube instance

/etc/nixos/configuration.nix
networking.extraHosts = ''
  127.0.0.1 peertube.local
'';

environment.etc = {
  "peertube/password-posgressql-db".text = "test123";
  "peertube/password-redis-db".text = "test123";
};

services = {

  peertube = {
    enable = true;
    localDomain = "peertube.local";
    enableWebHttps = false;
    database = {
      host = "127.0.0.1";
      name = "peertube_local";
      user = "peertube_test";
      passwordFile = "/etc/peertube/password-posgressql-db";
    };
    redis = {
      host = "127.0.0.1";
      port = 31638;
      passwordFile = "/etc/peertube/password-redis-db";
    };
    settings = {
      listen.hostname = "0.0.0.0";
      instance.name = "PeerTube Test Server";
    };
  };

  postgresql = {
    enable = true;
    enableTCPIP = true;
    authentication = ''
      hostnossl peertube_local peertube_test 127.0.0.1/32 md5
    '';
    initialScript = pkgs.writeText "postgresql_init.sql" ''
      CREATE ROLE peertube_test LOGIN PASSWORD 'test123';
      CREATE DATABASE peertube_local TEMPLATE template0 ENCODING UTF8;
      GRANT ALL PRIVILEGES ON DATABASE peertube_local TO peertube_test;
      ALTER DATABASE peertube_local OWNER TO peertube_test;
      \connect peertube_local
      CREATE EXTENSION IF NOT EXISTS pg_trgm;
      CREATE EXTENSION IF NOT EXISTS unaccent;
    '';
  };

  redis.servers.peertube = {
    enable = true;
    bind = "0.0.0.0";
    requirePass = "test123";
    port = 31638;
  };

};

After that open http://peertube.local:9000 in your browser to access PeerTube. The default administrator username is root. The initial password will be logged into the system journal, see the output of journalctl -u peertube.