: PeerTube Runner role

This commit is contained in:
VC
2024-08-19 15:41:05 +02:00
parent 2add080723
commit 578a48b6e1
7 changed files with 128 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
---
peertube_runner_token: !vault |
$ANSIBLE_VAULT;1.1;AES256
32653563393232666430313330373861396232323037343165303138333664623835656331343164
3061313466396463326461663739393832313737623935640a613535343336353766613938366431
35313536343934346232626561363965363463353138343733383866353432343339366633396230
3634383433613263390a616162613530393330313539343136386531396666616263363936303939
33656330663962326435626430646536336162373664303265373262616162343437333737646361
6536643161333732343661396364666233393865316261616239

View File

@@ -0,0 +1,9 @@
---
- name: Deploy peertube runner
hosts: peertuberunners
gather_facts: true
diff: true
roles:
- nodejs
- peertube_runner

View File

@@ -0,0 +1,6 @@
---
- name: Restart PeerTube Runner
ansible.builtin.service:
name: prunner
state: restarted

View File

@@ -0,0 +1,52 @@
---
- name: Install prerequisites
ansible.builtin.package:
name:
- ffmpeg
state: present
- name: Install peertube-runner via npm
community.general.npm:
name: "@peertube/peertube-runner"
global: true
- name: Create PeerTube Runner user
ansible.builtin.user:
comment: PeerTube Runner
home: "{{ peertube_runner_homedir }}"
name: prunner
password: '!'
shell: /bin/bash
state: present
- name: Create PeerTube Runner dir struct
ansible.builtin.file:
path: "{{ peertube_runner_configdir }}"
owner: prunner
group: prunner
mode: "0o750"
state: directory
- name: Create PeerTube Runner config file
ansible.builtin.template:
src: config.toml.j2
dest: "{{ peertube_runner_configdir }}config.toml"
owner: prunner
group: prunner
mode: "0o640"
notify: Restart PeerTube Runner
- name: Put systemd PeerTube Runner service
ansible.builtin.template:
src: prunner.service.j2
dest: /etc/systemd/system/prunner.service
owner: root
group: root
mode: "0o644"
- name: Start PeerTube Runner service
ansible.builtin.systemd_service:
name: prunner
state: started
daemon_reload: true

View File

@@ -0,0 +1,15 @@
[jobs]
concurrency = 2
[ffmpeg]
threads = 0
nice = 20
[transcription]
engine = "whisper-ctranslate2"
model = "small"
[[registeredInstances]]
url = "https://p.nintendojo.fr"
runnerToken = "{{ peertube_runner_token }}"
runnerName = "pt-runner1"

View File

@@ -0,0 +1,32 @@
[Unit]
Description=PeerTube runner daemon
After=network.target
[Service]
Type=simple
Environment=NODE_ENV=production
User=prunner
Group=prunner
ExecStart=peertube-runner server
WorkingDirectory={{ prunner_homedir }}
SyslogIdentifier=prunner
Restart=always
; Some security directives.
; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
ProtectSystem=full
; Sets up a new /dev mount for the process and only adds API pseudo devices
; like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled
; by default because it may not work on devices like the Raspberry Pi.
PrivateDevices=false
; Ensures that the service process and all its children can never gain new
; privileges through execve().
NoNewPrivileges=true
; This makes /home, /root, and /run/user inaccessible and empty for processes invoked
; by this unit. Make sure that you do not depend on data inside these folders.
ProtectHome=true
; Drops the sys admin capability from the daemon.
CapabilityBoundingSet=~CAP_SYS_ADMIN
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,4 @@
---
peertube_runner_homedir: /srv/prunner/
peertube_runner_configdir: "{{ peertube_runner_homedir }}.config/peertube-runner-nodejs/default/"