add preliminary files for peertube
This commit is contained in:
parent
c15cbd9a28
commit
78e36d76ac
9 changed files with 96 additions and 5 deletions
|
@ -11,19 +11,25 @@
|
||||||
block:
|
block:
|
||||||
- name: Create PeerTube data directory
|
- name: Create PeerTube data directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/{{ peertube.data_directory }}"
|
path: "{{ peertube.base_directory }}/data"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Create PeerTube config directory
|
- name: Create PeerTube config directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/{{ peertube.config_directory }}"
|
path: "{{ peertube.base_directory }}/config"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0754"
|
mode: "0754"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Create PostgresSQL directory
|
- name: Create PostgresSQL directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/{{ postgres.postgres_directory }}"
|
path: "{{ postgres.postgres_directory }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0754"
|
||||||
|
ignore_errors: true
|
||||||
|
- name: Create Backups directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ peertube.backups_directory }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0754"
|
mode: "0754"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
11
peertube-server/templates/backup/backup.sh.j2
Normal file
11
peertube-server/templates/backup/backup.sh.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
name=$(date '+%Y-%m-%d')
|
||||||
|
cd {{ peertube.base_directory }}
|
||||||
|
tar -zcvf "$name.config.tar.gz" config
|
||||||
|
tar -zcvf "$name.data.tar.gz" data
|
||||||
|
mkdir -p {{ peertube.backups_directory }}
|
||||||
|
mv *.tar.gz {{ peertube.backups_directory }}
|
||||||
|
cd {{ postgres.postgres_directory }}/..
|
||||||
|
systemctl stop postgres.service
|
||||||
|
tar -zcvf "$name.postgres.tar.gz" postgres
|
||||||
|
systemctl start postgres.service
|
||||||
|
mv *.tar.gz {{ peertube.backups_directory }}
|
8
peertube-server/templates/backup/peertube-backup.service
Normal file
8
peertube-server/templates/backup/peertube-backup.service
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# TODO
|
||||||
|
[Unit]
|
||||||
|
Description=peertube-backup
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=root
|
||||||
|
ExecStart=/bin/bash TODO/backup.sh
|
9
peertube-server/templates/backup/peertube-backup.timer
Normal file
9
peertube-server/templates/backup/peertube-backup.timer
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=peertube-backup
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=weekly
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
20
peertube-server/templates/services/peertube.container.j2
Normal file
20
peertube-server/templates/services/peertube.container.j2
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Requires=redis.service
|
||||||
|
After=redis.service
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
ContainerName=peertube
|
||||||
|
EnvironmentFile={{ peertube.base_directory }}/{{ peertube.env_file }}
|
||||||
|
Image={{ peertube.image_name}}
|
||||||
|
PublishPort=1935:1935
|
||||||
|
PublishPort=9000:9000
|
||||||
|
Volume={{ peertube.base_directory }}/data:/data
|
||||||
|
Volume={{ peertube.base_directory }}/config:/config
|
||||||
|
SecurityLabelType=peertube.process
|
||||||
|
Network=peertube.network
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
7
peertube-server/templates/services/peertube.network
Normal file
7
peertube-server/templates/services/peertube.network
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Peertube Network
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
Subnet=173.18.0.42/16
|
||||||
|
Gateway=173.18.0.1
|
||||||
|
Label=app=peertube
|
18
peertube-server/templates/services/postgres.container.j2
Normal file
18
peertube-server/templates/services/postgres.container.j2
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[Unit]
|
||||||
|
Requires=redis.service
|
||||||
|
After=redis.service
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
ServiceName=postgres
|
||||||
|
ContainerName=postgres
|
||||||
|
EnvironmentFile={{ peertube.base_directory }}/{{ peertube.env_file }}
|
||||||
|
Image={{ postgres.image_name }}
|
||||||
|
Volume={{ postgres.postgres_directory }}:/var/lib/postgresql/data
|
||||||
|
Network=peertube.network
|
||||||
|
SecurityLabelType=postgres.process
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
11
peertube-server/templates/services/redis.container.j2
Normal file
11
peertube-server/templates/services/redis.container.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[Container]
|
||||||
|
ContainerName=redis
|
||||||
|
ServiceName=redis
|
||||||
|
Image={{ redis.image_name }}
|
||||||
|
Network=peertube.network
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
|
@ -1,6 +1,7 @@
|
||||||
peertube:
|
peertube:
|
||||||
data_directory: "/peertube/data"
|
base_directory: "/peertube"
|
||||||
config_directory: "/peertube/config"
|
env_file: "environment_file"
|
||||||
|
backups_directory: "/peertube/backups"
|
||||||
image_name: "docker.io/chocobozzz/peertube:v7.0.1-bookworm"
|
image_name: "docker.io/chocobozzz/peertube:v7.0.1-bookworm"
|
||||||
postgres:
|
postgres:
|
||||||
postgres_directory: "/peertube/postgres"
|
postgres_directory: "/peertube/postgres"
|
||||||
|
|
Loading…
Add table
Reference in a new issue