diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-07 11:01:28 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-07 11:01:28 +0200 |
commit | 82e624233f22eba0230383c7de8a9ed3b69791a6 (patch) | |
tree | 9b9df6547149145ca6d7216e252e825cfb5a4951 | |
parent | aff36eb063573532498979c83be1c279c84f2d53 (diff) | |
download | PeerTube-82e624233f22eba0230383c7de8a9ed3b69791a6.tar.gz PeerTube-82e624233f22eba0230383c7de8a9ed3b69791a6.tar.zst PeerTube-82e624233f22eba0230383c7de8a9ed3b69791a6.zip |
Update documentations now we use webseed instead of electron/webrtc
-rw-r--r-- | .github/ISSUE_TEMPLATE.md | 2 | ||||
-rw-r--r-- | ARCHITECTURE.md | 10 | ||||
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | support/doc/server/code.md | 14 | ||||
-rw-r--r-- | support/doc/server/upload-video.png | bin | 58712 -> 56458 bytes |
5 files changed, 19 insertions, 27 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index c19c3cf8f..74ea70939 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md | |||
@@ -1,5 +1,5 @@ | |||
1 | <!-- | 1 | <!-- |
2 | Problem with the demonstration server? | 2 | Problem with the demonstration server? |
3 | -> Please retry in a few hours or send me directly an email: https://github.com/Chocobozzz | 3 | -> Please retry in a few hours or send me directly an email: https://github.com/Chocobozzz |
4 | Bug? | 4 | Bug? |
5 | -> Please check first you're running on the latest version of Firefox/Chromium | 5 | -> Please check first you're running on the latest version of Firefox/Chromium |
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 1454f9427..cc6864fac 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md | |||
@@ -5,7 +5,7 @@ | |||
5 | - **Network:** several servers communicating each others with this software compose a network | 5 | - **Network:** several servers communicating each others with this software compose a network |
6 | - **Pod:** a server of the network (inspired from Diaspora, no really signification) | 6 | - **Pod:** a server of the network (inspired from Diaspora, no really signification) |
7 | - **Friend:** a pod that communicates with yours | 7 | - **Friend:** a pod that communicates with yours |
8 | - **Origin pod:** the pod on which the video was uploaded and which is seeding the video | 8 | - **Origin pod:** the pod on which the video was uploaded and which is seeding (throught WebSeed protocol) the video |
9 | - **Make friend:** the action of a server which will join a network (and so become friend with all pods that compose this network) | 9 | - **Make friend:** the action of a server which will join a network (and so become friend with all pods that compose this network) |
10 | 10 | ||
11 | ## Base | 11 | ## Base |
@@ -55,9 +55,9 @@ | |||
55 | * A pod has an administrator that can add/remove users, make friends and quit friends | 55 | * A pod has an administrator that can add/remove users, make friends and quit friends |
56 | * A pod has different user accounts that can upload videos | 56 | * A pod has different user accounts that can upload videos |
57 | * All pods have an index of all videos of the network (name, origin pod url, small description, uploader username, magnet Uri, thumbnail name, created date and the thumbnail file). For example, a test with 1000000 videos with alphanum characters and the following lengths: name = 50, author = 50, url = 25, description = 250, magnerUri = 200, thumbnail name = 50 has a mongodb size of ~ 4GB. To this, we add 1 000 000 thumbnails of 5-15 KB so 15GB maximum | 57 | * All pods have an index of all videos of the network (name, origin pod url, small description, uploader username, magnet Uri, thumbnail name, created date and the thumbnail file). For example, a test with 1000000 videos with alphanum characters and the following lengths: name = 50, author = 50, url = 25, description = 250, magnerUri = 200, thumbnail name = 50 has a mongodb size of ~ 4GB. To this, we add 1 000 000 thumbnails of 5-15 KB so 15GB maximum |
58 | * After having uploaded a video, the server seeds it, adds the meta data in its database and makes a secure request to all of its friends | 58 | * After having uploaded a video, the server seeds it (WebSeed protocol), adds the meta data in its database and makes a secure request to all of its friends |
59 | * If a user wants to watch a video, he asks its pod the magnetUri and the frontend adds the torrent (with WebTorrent), creates the HTML5 video tag and streams the file into it | 59 | * If a user wants to watch a video, he asks its pod the magnetUri and the frontend adds the torrent (with WebTorrent), creates the HTML5 video tag and streams the file into it |
60 | * A user watching a video seeds it too (bittorent) so another user who is watching the same video can get the data from the origin server and the user 1 (etc) | 60 | * A user watching a video seeds it too (BitTorrent) so another user who is watching the same video can get the data from the origin server and the user 1 (etc) |
61 | 61 | ||
62 | ## Ideas | 62 | ## Ideas |
63 | 63 | ||
@@ -65,10 +65,6 @@ | |||
65 | user asks its pod -> user pod asks origin video pod -> origin video pod responds with the informations -> user pod responds to the user (and puts in cache the informations ?). We could extend this scheme with other informations | 65 | user asks its pod -> user pod asks origin video pod -> origin video pod responds with the informations -> user pod responds to the user (and puts in cache the informations ?). We could extend this scheme with other informations |
66 | * Redondance: if the origin pod is down, the video is not accessible anymore (no tracker/seeds). We could imagine a redondance between pods that keep seeding the video | 66 | * Redondance: if the origin pod is down, the video is not accessible anymore (no tracker/seeds). We could imagine a redondance between pods that keep seeding the video |
67 | * Server could transcode the video to lower qualities (cost in CPU and disk space) | 67 | * Server could transcode the video to lower qualities (cost in CPU and disk space) |
68 | * Server could seed at the demand: for now the server seeds all the videos but it has two drawbacks: | ||
69 | - Seeding has a cost (if a pod has 1000 videos it could be an issue) | ||
70 | - After a restart the server has to reseed all the videos (with 1000 videos it could long) | ||
71 | If this solution is choosen, the frontend has to notify the origin pod that it has to seed the video | ||
72 | * Add subtitles to videos | 68 | * Add subtitles to videos |
73 | * Avoid stocking friends URL schemes (http/https) | 69 | * Avoid stocking friends URL schemes (http/https) |
74 | 70 | ||
@@ -121,14 +121,13 @@ Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (t | |||
121 | 121 | ||
122 | #### Debian | 122 | #### Debian |
123 | 123 | ||
124 | * Install NodeJS 4.2: [https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) | 124 | * Install NodeJS 4.x (actual LTS): [https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) |
125 | * Add jessie backports to your *source.list*: http://backports.debian.org/Instructions/ | 125 | * Add jessie backports to your *source.list*: http://backports.debian.org/Instructions/ |
126 | * Run: | 126 | * Run: |
127 | 127 | ||
128 | # apt-get update | 128 | # apt-get update |
129 | # apt-get install ffmpeg mongodb openssl xvfb curl sudo git build-essential libgtk2.0-0 libgconf-2-4 libnss3 libasound2 libxtst6 libxss1 libnotify-bin | 129 | # apt-get install ffmpeg mongodb |
130 | # npm install -g npm@3 | 130 | # npm install -g npm@3 |
131 | # npm install -g electron | ||
132 | 131 | ||
133 | #### Other distribution... (PR welcome) | 132 | #### Other distribution... (PR welcome) |
134 | 133 | ||
@@ -201,9 +200,8 @@ See [ARCHITECTURE.md](https://github.com/Chocobozzz/PeerTube/blob/master/ARCHITE | |||
201 | * If a user upload a video, the server seeds it and sends the video informations (name, short description, torrent URI...) to each server of the network | 200 | * If a user upload a video, the server seeds it and sends the video informations (name, short description, torrent URI...) to each server of the network |
202 | * Each server has a RSA key to encrypt and sign communications with other servers | 201 | * Each server has a RSA key to encrypt and sign communications with other servers |
203 | * A server is a tracker responsible for all the videos uploaded in it | 202 | * A server is a tracker responsible for all the videos uploaded in it |
204 | * Even if nobody watches a video, it is seeded by the server where the video was uploaded | 203 | * Even if nobody watches a video, it is seeded by the server (throught [WebSeed protocol](http://www.bittorrent.org/beps/bep_0019.html)) where the video was uploaded |
205 | * A network can live and evolve by expelling bad pod (with too many downtimes for example) | 204 | * A network can live and evolve by expelling bad pod (with too many downtimes for example) |
206 | * A server **would** run webtorrent-hybrid to be a bridge with webrtc/standard bittorrent protocol | ||
207 | 205 | ||
208 | See the ARCHITECTURE.md for more informations. Do not hesitate to give your opinion :) | 206 | See the ARCHITECTURE.md for more informations. Do not hesitate to give your opinion :) |
209 | 207 | ||
@@ -211,19 +209,19 @@ Here are some simple schemes: | |||
211 | 209 | ||
212 | <p align="center"> | 210 | <p align="center"> |
213 | 211 | ||
214 | <img src="https://lutim.cpy.re/Q7mnNdJP" alt="Decentralized" /> | 212 | <img src="https://lutim.cpy.re/isWwz8tt" alt="Decentralized" /> |
215 | 213 | ||
216 | <img src="https://lutim.cpy.re/0riSzAp1" alt="Watch a video" /> | 214 | <img src="https://lutim.cpy.re/VLheltQk" alt="Watch a video" /> |
217 | 215 | ||
218 | <img src="https://lutim.cpy.re/OzMSOtxG" alt="Watch a P2P video" /> | 216 | <img src="https://lutim.cpy.re/worHQwKv" alt="Watch a P2P video" /> |
219 | 217 | ||
220 | <img src="https://lutim.cpy.re/uVjNNRa9" alt="Join a network" /> | 218 | <img src="https://lutim.cpy.re/MyeS4q1g" alt="Join a network" /> |
221 | 219 | ||
222 | <img src="https://lutim.cpy.re/udTMqcb0" alt="Many networks" | 220 | <img src="https://lutim.cpy.re/PqpTTzdP" alt="Many networks" |
223 | 221 | ||
224 | </p> | 222 | </p> |
225 | 223 | ||
226 | ### Frontend | 224 | ### Frontend |
227 | 225 | ||
228 | There already is a frontend (Angular 2) but the backend is a REST API so anybody can build a frontend (Web application, desktop application...). | 226 | There already is a frontend (Angular 2) but the backend is a REST API so anybody can build a frontend (Web application, desktop application...). |
229 | The backend uses bittorrent protocol, so users could use their favorite bittorrent client to download/play the video with its torrent URI. | 227 | The backend uses BitTorrent protocol, so users could use their favorite BitTorrent client to download/play the video with its torrent URI. |
diff --git a/support/doc/server/code.md b/support/doc/server/code.md index 130d30136..652bd53df 100644 --- a/support/doc/server/code.md +++ b/support/doc/server/code.md | |||
@@ -9,8 +9,7 @@ The server is a web server developed with [NodeJS](https://nodejs.org)/[Express] | |||
9 | * [MongoDB](https://www.mongodb.com/) -> Database | 9 | * [MongoDB](https://www.mongodb.com/) -> Database |
10 | * [Express](http://expressjs.com) -> Web server framework | 10 | * [Express](http://expressjs.com) -> Web server framework |
11 | * [Mongoose](http://mongoosejs.com/) -> MongoDB object modeling | 11 | * [Mongoose](http://mongoosejs.com/) -> MongoDB object modeling |
12 | * [WebTorrent](https://webtorrent.io/) -> BitTorrent over WebRTC | 12 | * [WebTorrent](https://webtorrent.io/) -> BitTorrent tracker and torrent creation |
13 | * [Electron](http://electron.atom.io/) -> To make WebRTC inside NodeJS | ||
14 | * [Mocha](https://mochajs.org/) -> Test framework | 13 | * [Mocha](https://mochajs.org/) -> Test framework |
15 | 14 | ||
16 | 15 | ||
@@ -45,7 +44,7 @@ Uses [JavaScript Standard Style](http://standardjs.com/). | |||
45 | * Run MongoDB | 44 | * Run MongoDB |
46 | * Run `npm run dev` to compile the client and automatically run the server. If the client files are already compiled you can simply run `NODE_ENV=test node server` | 45 | * Run `npm run dev` to compile the client and automatically run the server. If the client files are already compiled you can simply run `NODE_ENV=test node server` |
47 | 46 | ||
48 | The `NODE_ENV=test` is set to speed up communications between pods (see [constants.js](https://github.com/Chocobozzz/PeerTube/blob/master/server/initializers/constants.js#L71)). | 47 | The `NODE_ENV=test` is set to speed up communications between pods (see [constants.js](https://github.com/Chocobozzz/PeerTube/blob/master/server/initializers/constants.js)). |
49 | 48 | ||
50 | `npm run help` gives you all available commands. | 49 | `npm run help` gives you all available commands. |
51 | 50 | ||
@@ -56,17 +55,16 @@ If you want to test the decentralization feature, you can easily run 3 pods by r | |||
56 | 55 | ||
57 | The server is composed by: | 56 | The server is composed by: |
58 | 57 | ||
59 | * a REST API | 58 | * a REST API (throught Express framework) |
60 | * a WebTorrent Tracker | 59 | * a WebTorrent Tracker |
61 | * A separate Electron process | ||
62 | 60 | ||
63 | The seperate Electron process has the goal to seed videos through WebRTC because WebRTC directly in NodeJS is not usable for now. | 61 | A video is seeded by the server throught the [WebSeed](http://www.bittorrent.org/beps/bep_0019.html) protocol (HTTP). |
64 | 62 | ||
65 | ![Architecture scheme](https://github.com/Chocobozzz/PeerTube/blob/master/support/doc/server/upload-video.png) | 63 | ![Architecture scheme](https://github.com/Chocobozzz/PeerTube/blob/master/support/doc/server/upload-video.png) |
66 | 64 | ||
67 | When a user uploads a video, the rest API asks the Electron process to seed it (communicate with IPC) and then adds it to its Mongo database. | 65 | When a user uploads a video, the rest API create the torrent file and then adds it to its Mongo database. |
68 | 66 | ||
69 | If a user wants to watch the video, the tracker will indicate all other users that are watching the video + the Electron process. | 67 | If a user wants to watch the video, the tracker will indicate all other users that are watching the video + the HTTP url for the WebSeed. |
70 | 68 | ||
71 | ## Newcomers | 69 | ## Newcomers |
72 | 70 | ||
diff --git a/support/doc/server/upload-video.png b/support/doc/server/upload-video.png index b3a867a42..730e68cc4 100644 --- a/support/doc/server/upload-video.png +++ b/support/doc/server/upload-video.png | |||
Binary files differ | |||