mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Removed server_ for better overview
This commit is contained in:
33
roles/docker-peertube/README.md
Normal file
33
roles/docker-peertube/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# docker peertube
|
||||
|
||||
## track docker container status
|
||||
```bash
|
||||
watch -n 2 "docker ps -a | grep peertube"
|
||||
```
|
||||
|
||||
## clean rebuild
|
||||
```bash
|
||||
cd {{path_docker_compose_files}}peertube/ &&
|
||||
docker-compose down
|
||||
docker volume rm peertube_assets peertube_config peertube_data peertube_database peertube_redis
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## access terminal
|
||||
```bash
|
||||
docker exec -it peertube-application-1 /bin/bash
|
||||
```
|
||||
|
||||
## update config
|
||||
```bash
|
||||
apt update && apt install nano && nano ./config/default.yaml
|
||||
```
|
||||
|
||||
## get root pasword
|
||||
```bash
|
||||
docker logs peertube-application-1 | grep -A1 root
|
||||
```
|
||||
|
||||
## further information
|
||||
- https://docs.joinpeertube.org/install-docker
|
||||
- https://github.com/Chocobozzz/PeerTube/issues/3091
|
8
roles/docker-peertube/handlers/main.yml
Normal file
8
roles/docker-peertube/handlers/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: recreate peertube
|
||||
command:
|
||||
cmd: docker-compose -p peertube up -d --force-recreate
|
||||
chdir: "{{docker_compose_peertube_path}}"
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 600
|
||||
DOCKER_CLIENT_TIMEOUT: 600
|
2
roles/docker-peertube/meta/main.yml
Normal file
2
roles/docker-peertube/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- server_native-docker-reverse-proxy
|
23
roles/docker-peertube/tasks/main.yml
Normal file
23
roles/docker-peertube/tasks/main.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: recieve {{domain}} certificate
|
||||
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
|
||||
|
||||
- name: configure {{domain}}.conf
|
||||
template: src=templates/peertube.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
|
||||
notify: restart nginx
|
||||
|
||||
- name: "create {{docker_compose_peertube_path}}"
|
||||
file:
|
||||
path: "{{docker_compose_peertube_path}}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: copy docker-compose.yml
|
||||
template: src=docker-compose.yml.j2 dest={{docker_compose_peertube_path}}docker-compose.yml
|
||||
notify: recreate peertube
|
||||
|
||||
- name: copy configuration
|
||||
template:
|
||||
src: env.j2
|
||||
dest: "{{docker_compose_peertube_path}}.env"
|
||||
notify: recreate peertube
|
38
roles/docker-peertube/templates/docker-compose.yml.j2
Normal file
38
roles/docker-peertube/templates/docker-compose.yml.j2
Normal file
@@ -0,0 +1,38 @@
|
||||
version: "3.3"
|
||||
|
||||
services:
|
||||
application:
|
||||
image: chocobozzz/peertube:production-bullseye
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "1935:1935"
|
||||
- "{{http_port}}:9000"
|
||||
volumes:
|
||||
- assets:/app/client/dist
|
||||
- data:/data
|
||||
- config:/config
|
||||
depends_on:
|
||||
- database
|
||||
- redis
|
||||
restart: "always"
|
||||
database:
|
||||
image: postgres:13-alpine
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- database:/var/lib/postgresql/data
|
||||
restart: "always"
|
||||
redis:
|
||||
image: redis:6-alpine
|
||||
volumes:
|
||||
- redis:/data
|
||||
restart: "always"
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
assets:
|
||||
database:
|
||||
data:
|
||||
redis:
|
||||
config:
|
22
roles/docker-peertube/templates/env.j2
Normal file
22
roles/docker-peertube/templates/env.j2
Normal file
@@ -0,0 +1,22 @@
|
||||
# Database / Postgres service configuration
|
||||
POSTGRES_USER=peertube
|
||||
POSTGRES_PASSWORD={{peertube_database_password}}
|
||||
POSTGRES_DB=peertube
|
||||
PEERTUBE_DB_USERNAME=peertube
|
||||
PEERTUBE_DB_PASSWORD={{peertube_database_password}}
|
||||
PEERTUBE_DB_SSL=false
|
||||
PEERTUBE_DB_HOSTNAME=database
|
||||
|
||||
# PeerTube server configuration
|
||||
PEERTUBE_WEBSERVER_HOSTNAME={{domain}}
|
||||
PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback"]
|
||||
|
||||
# E-mail configuration
|
||||
PEERTUBE_SMTP_USERNAME={{system_email_username}}
|
||||
PEERTUBE_SMTP_PASSWORD={{system_email_password}}
|
||||
PEERTUBE_SMTP_HOSTNAME={{system_email_host}}
|
||||
PEERTUBE_SMTP_PORT={{system_email_port}}
|
||||
PEERTUBE_SMTP_FROM={{system_email}}
|
||||
PEERTUBE_SMTP_TLS=false
|
||||
PEERTUBE_SMTP_DISABLE_STARTTLS=false
|
||||
PEERTUBE_ADMIN_EMAIL={{system_email}}
|
83
roles/docker-peertube/templates/peertube.conf.j2
Normal file
83
roles/docker-peertube/templates/peertube.conf.j2
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
upstream backend {
|
||||
server 127.0.0.1:{{http_port}};
|
||||
}
|
||||
|
||||
server {
|
||||
server_name {{domain}};
|
||||
|
||||
{% include 'roles/server_native-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
##
|
||||
# Application
|
||||
##
|
||||
|
||||
location @api {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
client_max_body_size 100k; # default is 1M
|
||||
|
||||
proxy_connect_timeout 10m;
|
||||
proxy_send_timeout 10m;
|
||||
proxy_read_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
#adapt
|
||||
proxy_pass http://127.0.0.1:{{http_port}};
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location = /api/v1/videos/upload-resumable {
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
|
||||
limit_except POST HEAD { deny all; }
|
||||
client_max_body_size 12G; # default is 1M
|
||||
add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
|
||||
client_max_body_size 6M; # default is 1M
|
||||
add_header X-File-Maximum-Size 4M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
##
|
||||
# Websocket
|
||||
##
|
||||
|
||||
location @api_websocket {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
|
||||
location /socket.io {
|
||||
try_files /dev/null @api_websocket;
|
||||
}
|
||||
|
||||
location /tracker/socket {
|
||||
# Peers send a message to the tracker every 15 minutes
|
||||
# Don't close the websocket before then
|
||||
proxy_read_timeout 15m; # default is 60s
|
||||
|
||||
try_files /dev/null @api_websocket;
|
||||
}
|
||||
}
|
1
roles/docker-peertube/vars/main.yml
Normal file
1
roles/docker-peertube/vars/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
docker_compose_peertube_path: "{{path_docker_compose_files}}peertube/"
|
Reference in New Issue
Block a user