Skip to content

Instantly share code, notes, and snippets.

@rngadam
Last active February 10, 2025 18:49
Show Gist options
  • Select an option

  • Save rngadam/456ee6fe9263f2867cd4f97ed533088b to your computer and use it in GitHub Desktop.

Select an option

Save rngadam/456ee6fe9263f2867cd4f97ed533088b to your computer and use it in GitHub Desktop.
Installation of peertube on nixos

https://nixos.wiki/wiki/PeerTube

error:

Feb 10 11:09:02 nixos02 postgres[21626]: [21626] ERROR:  permission denied for schema public
Feb 10 11:09:02 nixos02 postgres[21626]: [21626] STATEMENT:  CREATE OR REPLACE FUNCTION immutable_unaccent(text)
Feb 10 11:09:02 nixos02 postgres[21626]:           RETURNS text AS
Feb 10 11:09:02 nixos02 postgres[21626]:         $func$
Feb 10 11:09:02 nixos02 postgres[21626]:         SELECT public.unaccent('public.unaccent', $1::text)
Feb 10 11:09:02 nixos02 postgres[21626]:         $func$  LANGUAGE sql IMMUTABLE;

the call is a setup executed by

CREATE OR REPLACE FUNCTION immutable_unaccent(text)  RETURNS text AS $func$ SELECT public.unaccent('public.unaccent', $1::text) $func$  LANGUAGE sql IMMUTABLE;```

workaround is to create a owner role:

$ sudo su - postgres
# psql
postgres=# CREATE ROLE peertubedbowner NOLOGIN 
postgres-# ;
CREATE ROLE
postgres=# alter database peertube_local owner to peertubedbowner;
ALTER DATABASE
postgres=# grant peertubedbowner to peertube_test;
GRANT ROLE

as soon as this is fixed, peertube service starts:

❯ journalctl -n 25 -u peertube
Feb 10 11:16:59 nixos02 systemd[1]: peertube.service: Main process exited, code=exited, status=255/EXCEPTION
Feb 10 11:16:59 nixos02 systemd[1]: peertube.service: Failed with result 'exit-code'.
Feb 10 11:16:59 nixos02 systemd[1]: peertube.service: Consumed 2.486s CPU time, 137.3M memory peak, 23.6K incoming IP traffic, 3.9K outgoing IP traffic.
Feb 10 11:17:19 nixos02 systemd[1]: peertube.service: Scheduled restart job, restart counter is at 95.
Feb 10 11:17:19 nixos02 systemd[1]: Started PeerTube daemon.
Feb 10 11:17:21 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:21.884 info: Using following configuration file hierarchy: /var/lib/peertube>
Feb 10 11:17:21 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:21.886 warn: SMTP is not configured so the contact form will not work.
Feb 10 11:17:22 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:22.097 info: Database peertube_local is ready.
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.451 info: Creating application account.
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.458 info: Creating a default OAuth Client.
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.467 info: Creating the administrator.
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.484 info: Client id: REDACTED
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.484 info: Client secret: REDACTED
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.554 info: Generating a RSA key...
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.634 info: Generating a RSA key...
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.635 info: Generating a RSA key...
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.732 info: Username: REDACTED
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.732 info: User password: REDACTED
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.737 info: Connecting to redis standalone...
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.740 error: Cannot use SMTP server because of lack of configuration. PeerT>
Feb 10 11:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:24.788 info: Connected to redis.
Feb 10 11:17:25 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:25.043 info: HTTP server listening on 0.0.0.0:9000
Feb 10 11:17:25 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 11:17:25.047 info: Web server: http://peertube.local:9000
Feb 10 12:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 12:17:24.969 info: Removing bad actor follows (scheduler).
Feb 10 12:17:24 nixos02 peertube[22358]: [peertube.local:9000] 2025-02-10 12:17:24.987 info: Processing viewer statistics.

the example config gives peertube.local as an example.

Trying to use localhost does not even connect:

❯ peertube-cli token --url http://localhost:9000 --username root --password  $PASSWORD_FROM_JOURNALCTL_LOGS                                        
Cannot get access token: ECONNREFUSED: Connection refused

Using 127.0.0.1 connects but returns a 403 because the name does not match the internal name peertube is expecting:

❯ peertube-cli token --url http://127.0.0.1:9000 --username root --password $PASSWORD_FROM_JOURNALCTL_LOGS
Cannot get access token: Expected status 200, got 403. 
The server responded: "Getting client tokens for host 127.0.0.1:9000 is forbidden".

peertube.local seems to interfere with (Avahi) mdns; ping just hangs:

rngadam in 🌐 nixos02 in ~ 
❯ ping peertube.local
^C

changing the /etc/hosts declaration and localDomain to peertube fixes this and allows:

peertube-cli auth add -u http://peertube:9000 -U root --password $PASSWORD_FROM_JOURNALCTL_LOGS
peertube-cli token --url http://peertube:9000 --username root --password $PASSWORD_FROM_JOURNALCTL_LOGS
<REDACTED TOKEN OUTPUT>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment