Skip to content

Commit 8c3da10

Browse files
LoanRazmeuk
authored andcommitted
Manage ActivityPub interface to broadcast videos and get external ones
1 parent 4aa9144 commit 8c3da10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+6107
-189
lines changed

.env.dev-exemple

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ REDIS_TAG=redis:alpine3.16
1010
### In case of value changing, you have to rebuild and restart your container.
1111
### All yours datas will be kept.
1212
DOCKER_ENV=light
13+
## PEERTUBE SECRETS
14+
POSTGRES_PASSWORD=<PWD>
15+
PEERTUBE_SECRET=<SECRET>

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pod/main/static/custom/img
5050
!pod/custom/settings_local.py.example
5151
settings_local.py
5252
transcription/*
53+
docker-volume
5354

5455
# Unit test utilities #
5556
#######################
@@ -73,6 +74,7 @@ compile-model
7374
*.crt
7475
*.key
7576
*.pem
77+
*.pub
7678

7779
# NPM stuffs #
7880
################

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,9 @@ endif
174174
sudo rm -rf ./pod/db.sqlite3
175175
sudo rm -rf ./pod/db_remote.sqlite3
176176
sudo rm -rf ./pod/media
177+
178+
# Ouvre un shell avec le contexte Django dans le conteneur pod
179+
shell:
180+
docker exec -it pod-activitypub-with-volumes pip install ipython
181+
docker exec -it pod-activitypub-with-volumes env DJANGO_SETTINGS_MODULE=pod.settings ipython --ext=autoreload -c "%autoreload 2" -i
182+
# then it is needed to call import django; django.setup()

docker-compose-full-dev-with-volumes.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ services:
5656
- ./.env.dev
5757
volumes: *pod-volumes
5858

59+
pod-activitypub:
60+
container_name: pod-activitypub-with-volumes
61+
build:
62+
context: .
63+
dockerfile: dockerfile-dev-with-volumes/pod-activitypub/Dockerfile
64+
depends_on:
65+
- pod-back
66+
- redis
67+
env_file:
68+
- ./.env.dev
69+
volumes: *pod-volumes
70+
5971
elasticsearch:
6072
container_name: elasticsearch-with-volumes
6173
hostname: elasticsearch.localhost
@@ -79,6 +91,39 @@ services:
7991
ports:
8092
- 6379:6379
8193

94+
peertube:
95+
container_name: peertube
96+
hostname: peertube.localhost
97+
image: chocobozzz/peertube:v7.1.0-bookworm
98+
ports:
99+
- 9000:9000
100+
- 3000:3000
101+
env_file:
102+
- ./dockerfile-dev-with-volumes/peertube/peertube.env
103+
- ./.env.dev
104+
depends_on:
105+
- postgres
106+
- redis
107+
- postfix
108+
volumes:
109+
- ./dockerfile-dev-with-volumes/peertube/dev.yaml:/app/config/dev.yaml
110+
command: sh -c "yarn install && npm run dev"
111+
restart: "always"
112+
113+
postgres:
114+
image: postgres:13-alpine
115+
env_file:
116+
- ./dockerfile-dev-with-volumes/peertube/peertube.env
117+
- ./.env.dev
118+
restart: "always"
119+
120+
postfix:
121+
image: mwader/postfix-relay
122+
env_file:
123+
- ./dockerfile-dev-with-volumes/peertube/peertube.env
124+
- ./.env.dev
125+
restart: "always"
126+
82127
# redis-commander:
83128
# container_name: redis-commander
84129
# hostname: redis-commander.localhost

dockerfile-dev-with-volumes/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Vous devriez obtenir ce message une fois esup-pod lancé
148148
----
149149
$ pod-dev-with-volumes | Superuser created successfully.
150150
----
151-
L'application esup-pod est dès lors disponible via cette URL : localhost:8000
151+
L'application esup-pod est dès lors disponible via cette URL : pod.localhost:8000
152152

153153
=== Arrêt de la stack
154154
$ CTRL+C dans la fenetre depuis laquelle l'application esup-pod a été lancée
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
listen:
2+
hostname: '::'
3+
port: 9000
4+
5+
webserver:
6+
https: false
7+
8+
secrets:
9+
peertube: 'my super dev secret'
10+
11+
rates_limit:
12+
api:
13+
window: 10 seconds
14+
max: 500
15+
signup:
16+
window: 5 minutes
17+
max: 200
18+
download_generate_video:
19+
window: 5 seconds
20+
max: 500000
21+
22+
database:
23+
hostname: '127.0.0.1'
24+
port: 5432
25+
26+
redis:
27+
hostname: '127.0.0.1'
28+
29+
smtp:
30+
hostname: null
31+
port: 1025
32+
tls: false
33+
disable_starttls: true
34+
from_address: 'test-admin@localhost'
35+
username: null
36+
password: null
37+
38+
log:
39+
level: 'debug'
40+
41+
open_telemetry:
42+
metrics:
43+
enabled: true
44+
playback_stats_interval: '13 seconds'
45+
46+
contact_form:
47+
enabled: true
48+
49+
peertube:
50+
check_latest_version:
51+
enabled: false
52+
53+
redundancy:
54+
videos:
55+
check_interval: '5 minutes'
56+
strategies:
57+
-
58+
size: '1000MB'
59+
min_lifetime: '10 minutes'
60+
strategy: 'most-views'
61+
-
62+
size: '1000MB'
63+
min_lifetime: '10 minutes'
64+
strategy: 'trending'
65+
-
66+
size: '1000MB'
67+
min_lifetime: '10 minutes'
68+
strategy: 'recently-added'
69+
min_views: 1
70+
71+
cache:
72+
previews:
73+
size: 10
74+
captions:
75+
size: 10
76+
torrents:
77+
size: 10
78+
79+
signup:
80+
enabled: true
81+
requires_email_verification: false
82+
83+
live:
84+
enabled: true
85+
86+
allow_replay: true
87+
88+
transcoding:
89+
enabled: true
90+
threads: 2
91+
92+
resolutions:
93+
360p: true
94+
720p: true
95+
96+
import:
97+
videos:
98+
concurrency: 2
99+
http:
100+
enabled: true
101+
torrent:
102+
enabled: true
103+
video_channel_synchronization:
104+
enabled: true
105+
max_per_user: 10
106+
check_interval: 5 minutes
107+
videos_limit_per_synchronization: 3
108+
109+
instance:
110+
default_nsfw_policy: 'display'
111+
112+
# Set by API when the field is not provided and put as default value in client
113+
defaults:
114+
publish:
115+
licence: 2
116+
117+
plugins:
118+
index:
119+
check_latest_versions_interval: '10 minutes'
120+
121+
federation:
122+
prevent_ssrf: false
123+
videos:
124+
cleanup_remote_interactions: false
125+
126+
views:
127+
videos:
128+
remote:
129+
max_age: -1
130+
131+
watching_interval:
132+
anonymous: '6 seconds'
133+
users: '4 seconds'
134+
135+
geo_ip:
136+
enabled: true
137+
138+
video_studio:
139+
enabled: true
140+
141+
transcoding:
142+
keep_original_file: false
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
NODE_VERSION=21.7.1
2+
NODE_ENV=dev
3+
NODE_DB_LOG=false
4+
5+
# Database / Postgres service configuration
6+
POSTGRES_USER=postgres
7+
# Postgres database name "peertube"
8+
POSTGRES_DB=peertube_dev
9+
# The database name used by PeerTube will be PEERTUBE_DB_NAME (only if set) *OR* 'peertube'+PEERTUBE_DB_SUFFIX
10+
#PEERTUBE_DB_NAME=<MY POSTGRES DB NAME>
11+
#PEERTUBE_DB_SUFFIX=_prod
12+
# Database username and password used by PeerTube must match Postgres', so they are copied:
13+
PEERTUBE_DB_USERNAME=$POSTGRES_USER
14+
PEERTUBE_DB_PASSWORD=$POSTGRES_PASSWORD
15+
PEERTUBE_DB_SSL=false
16+
# Default to Postgres service name "postgres" in docker-compose.yml
17+
PEERTUBE_DB_HOSTNAME=postgres
18+
19+
# PeerTube server configuration
20+
# If you test PeerTube in local: use "peertube.localhost" and add this domain to your host file resolving on 127.0.0.1
21+
PEERTUBE_WEBSERVER_HOSTNAME=peertube.localhost
22+
# If you just want to test PeerTube on local
23+
PEERTUBE_WEBSERVER_PORT=9000
24+
PEERTUBE_WEBSERVER_HTTPS=false
25+
# If you need more than one IP as trust_proxy
26+
# pass them as a comma separated array:
27+
PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.18.0.0/16"]
28+
29+
# E-mail configuration
30+
# If you use a Custom SMTP server
31+
#PEERTUBE_SMTP_USERNAME=
32+
#PEERTUBE_SMTP_PASSWORD=
33+
# Default to Postfix service name "postfix" in docker-compose.yml
34+
# May be the hostname of your Custom SMTP server
35+
PEERTUBE_SMTP_HOSTNAME=postfix
36+
PEERTUBE_SMTP_PORT=25
37+
PEERTUBE_SMTP_FROM=[email protected]
38+
PEERTUBE_SMTP_TLS=false
39+
PEERTUBE_SMTP_DISABLE_STARTTLS=false
40+
PEERTUBE_ADMIN_EMAIL=[email protected]
41+
42+
# Postfix service configuration
43+
POSTFIX_myhostname=example.org
44+
# If you need to generate a list of sub/DOMAIN keys
45+
# pass them as a whitespace separated string <DOMAIN>=<selector>
46+
OPENDKIM_DOMAINS=example.org=peertube
47+
# see https://github.com/wader/postfix-relay/pull/18
48+
OPENDKIM_RequireSafeKeys=no
49+
50+
PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PUBLIC="public-read"
51+
PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PRIVATE="private"
52+
53+
#PEERTUBE_LOG_LEVEL=info
54+
55+
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
56+
#PEERTUBE_SIGNUP_ENABLED=true
57+
#PEERTUBE_TRANSCODING_ENABLED=true
58+
#PEERTUBE_CONTACT_FORM_ENABLED=true
59+
60+
PEERTUBE_REDIS_HOSTNAME=redis-with-volumes
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#------------------------------------------------------------------------------------------------------------------------------
2+
# (\___/)
3+
# (='.'=) Dockerfile multi-stages node & python
4+
# (")_(")
5+
#------------------------------------------------------------------------------------------------------------------------------
6+
# Conteneur node
7+
ARG PYTHON_VERSION
8+
# TODO
9+
#FROM harbor.urba.univ-lille.fr/store/node:19 as source-build-js
10+
11+
#------------------------------------------------------------------------------------------------------------------------------
12+
# Conteneur python
13+
FROM $PYTHON_VERSION
14+
WORKDIR /tmp/pod
15+
COPY ./pod/ .
16+
# TODO
17+
#FROM harbor.urba.univ-lille.fr/store/python:3.7-buster
18+
19+
RUN apt-get clean && apt-get update && apt-get install -y netcat
20+
21+
WORKDIR /usr/src/app
22+
23+
COPY ./requirements.txt .
24+
COPY ./requirements-conteneur.txt .
25+
COPY ./requirements-encode.txt .
26+
COPY ./requirements-dev.txt .
27+
28+
RUN pip3 install --no-cache-dir -r requirements-dev.txt \
29+
&& pip3 install elasticsearch==7.17.9
30+
31+
# ENTRYPOINT :
32+
COPY ./dockerfile-dev-with-volumes/pod-activitypub/my-entrypoint-activitypub.sh /tmp/my-entrypoint-activitypub.sh
33+
RUN chmod 755 /tmp/my-entrypoint-activitypub.sh
34+
35+
ENTRYPOINT ["bash", "/tmp/my-entrypoint-activitypub.sh"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
echo "Launching commands into pod-dev"
3+
until nc -z pod.localhost 8000; do echo waiting for pod-back; sleep 10; done;
4+
# Worker ActivityPub
5+
celery --app pod.activitypub.tasks worker --loglevel INFO --queues activitypub --concurrency 1 --hostname activitypub
6+
sleep infinity

0 commit comments

Comments
 (0)