Run videojs outside angular
[oweals/peertube.git] / README.md
1 <h1 align="center">
2   PeerTube
3 </h1>
4
5 <h4 align="center">
6 Federated (ActivityPub) video streaming platform using P2P (BitTorrent)
7 directly in the web browser with <a href="https://github.com/feross/webtorrent">WebTorrent</a>.
8 </h4>
9
10 **PeerTube is sponsored by [Framasoft](https://framatube.org/#en), a non-profit
11 that promotes, spreads and develops free culture in general, and free-libre
12 software in particular. If you want to support this project, please [consider
13 donating them](https://soutenir.framasoft.org/en/).**
14
15 <p align="center">
16   <strong>Client</strong>
17
18   <br />
19
20   <a href="https://david-dm.org/Chocobozzz/PeerTube?path=client">
21     <img src="https://david-dm.org/Chocobozzz/PeerTube.svg?path=client" alt="Dependency Status" />
22   </a>
23
24   <a href="https://david-dm.org/Chocobozzz/PeerTube?path=client#info=dev">
25     <img src="https://david-dm.org/Chocobozzz/PeerTube/dev-status.svg?path=client" alt="devDependency Status" />
26   </a>
27 </p>
28
29 <p align="center">
30   <strong>Server</strong>
31
32   <br />
33
34   <a href="https://travis-ci.org/Chocobozzz/PeerTube">
35     <img src="https://travis-ci.org/Chocobozzz/PeerTube.svg?branch=develop" alt="Build Status" />
36   </a>
37
38   <a href="https://david-dm.org/Chocobozzz/PeerTube">
39     <img src="https://david-dm.org/Chocobozzz/PeerTube.svg" alt="Dependencies Status" />
40   </a>
41
42   <a href="https://david-dm.org/Chocobozzz/PeerTube#info=dev">
43     <img src="https://david-dm.org/Chocobozzz/PeerTube/dev-status.svg" alt="devDependency Status" />
44   </a>
45
46   <a href="http://standardjs.com/">
47     <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg" alt="JavaScript Style Guide" />
48   </a>
49
50   <a href="https://kiwiirc.com/client/irc.freenode.net/#peertube">
51     <img src="https://img.shields.io/badge/%23peertube-on%20freenode-brightgreen.svg" alt="PeerTube Freenode IRC" />
52   </a>
53 </p>
54
55 <br />
56
57 <p align="center">
58   <a href="https://peertube.cpy.re">
59     <img src="https://lutim.cpy.re/mRdBAdeD.png" alt="screenshot" />
60   </a>
61 </p>
62
63 ## Demonstration
64
65 Want to see it in action?
66
67    * [Demo server](http://peertube.cpy.re)
68    * [Video](https://peertube.cpy.re/videos/watch/f78a97f8-a142-4ce1-a5bd-154bf9386504)
69      to see how the "decentralization feature" looks like
70    * Experimental demo servers that share videos (they are in the same
71      network): [peertube2](http://peertube2.cpy.re),
72      [peertube3](http://peertube3.cpy.re). Since I do experiments with them,
73      sometimes they might not work correctly.
74
75 ## Why
76
77 We can't build a FOSS video streaming alternatives to YouTube, Dailymotion,
78 Vimeo... with a centralized software. One organization alone may not have
79 enough money to pay for bandwidth and video storage of its servers.
80
81 So we need to have a decentralized network of servers seeding videos (as
82 [Diaspora](https://github.com/diaspora/diaspora) for example).  But it's not
83 enough because one video could become famous and overload the server.  It's the
84 reason why we need to use a P2P protocol to limit the server load.  Thanks to
85 [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (thus
86 bittorrent) inside the web browser, as of today.
87
88 ## Features
89
90 - [X] Frontend
91   - [X] Angular frontend
92 - [X] Join the fediverse
93   - [X] Follow other instances
94   - [X] Unfollow an instance
95   - [X] Get for the followers/following list
96 - [X] Upload a video
97   - [X] Seed the video
98   - [X] Send the meta data with ActivityPub to followers
99 - [X] Remove the video
100 - [X] List the videos
101 - [X] View the video in an HTML5 player with WebTorrent
102 - [X] Admin panel
103 - [X] OpenGraph tags
104 - [X] OEmbed
105 - [X] Update video
106 - [X] Videos view counter
107 - [X] Videos likes/dislikes
108 - [X] Transcoding to different definitions
109 - [X] Download file/torrent
110 - [X] User video bytes quota
111 - [X] User video channels
112 - [X] NSFW warnings/settings
113 - [X] Video description in markdown
114 - [X] User roles (administrator, moderator)
115 - [X] User registration
116 - [X] Video privacy settings (public, unlisted or private)
117 - [X] Signaling a video to the admin origin PeerTube instance
118 - [ ] Videos comments
119 - [ ] User playlist
120 - [ ] User subscriptions (by tags, author...)
121 - [ ] Add "DDOS" security
122
123
124 ## Installation
125
126 See [wiki](https://github.com/Chocobozzz/PeerTube/wiki) for complete
127 installation commands.
128
129 ### Front compatibility
130
131   * Chromium
132   * Firefox (>= 42 for MediaSource support)
133
134 ### Dependencies
135
136   * **NodeJS >= 8.x**
137   * yarn
138   * OpenSSL (cli)
139   * PostgreSQL
140   * FFmpeg
141
142 #### Debian
143
144   1. Install NodeJS 8.x (current LTS):
145      [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)
146   2. Install yarn:
147      [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
148   4. Run:
149
150 ```bash
151     $ apt-get update
152     $ apt-get install ffmpeg postgresql openssl
153 ```
154
155 #### Ubuntu 16.04
156
157   1. Install NodeJS 8.x (current LTS): (same as Debian)
158   2. Install yarn: (same as Debian)
159   3. Run:
160
161 ```bash
162     $ apt-get update
163     $ apt-get install ffmpeg postgresql openssl
164 ```
165
166 #### Arch Linux
167
168   1. Run:
169
170 ```bash
171     $ pacman -S nodejs yarn ffmpeg postgresql openssl
172 ```
173
174 #### Other distributions
175
176 Feel free to update this README file in a pull request!
177
178 ### Build from the sources
179
180 ```bash
181     $ git clone -b master https://github.com/Chocobozzz/PeerTube
182     $ cd PeerTube
183     $ yarn install
184     $ npm run build
185 ```
186
187 ## Usage
188
189 ### Production
190
191 If you want to run PeerTube in production (which might be a bad idea for now :) ):
192
193 ```bash
194     $ cp config/production.yaml.example config/production.yaml
195 ```
196
197 Then edit the `config/production.yaml` file according to your webserver
198 configuration. Keys set in this file will override those of
199 `config/default.yml`.
200
201 Finally, run the server with the `NODE_ENV` environment variable set to
202 `production`:
203
204 ```bash
205     $ NODE_ENV=production npm start
206 ```
207
208 The administrator password is automatically generated and can be found in the
209 logs. You can set another password with:
210
211 ```bash
212     $ NODE_ENV=production npm run reset-password -- -u root
213 ```
214
215 **Nginx template** (reverse proxy): https://github.com/Chocobozzz/PeerTube/tree/master/support/nginx <br />
216 **Systemd template**: https://github.com/Chocobozzz/PeerTube/tree/master/support/systemd
217
218 You can check the application (CORS headers, tracker websocket...) by running:
219
220 ```bash
221     $ NODE_ENV=production npm run check
222 ```
223
224 ### Upgrade
225
226 The following commands will upgrade the source (according to your current
227 branch), upgrade node modules and rebuild client application:
228
229 ```bash
230     # systemctl stop peertube
231     $ npm run upgrade-peertube
232     # systemctl start peertube
233 ```
234
235 ### Test with three fresh nodes
236
237 ```bash
238     $ npm run clean:server:test
239     $ npm run play
240 ```
241
242 Then you will get access to the three nodes at `http://localhost:900{1,2,3}`
243 with the `root` as username and `test{1,2,3}` for the password.
244
245 ### Other commands
246
247 To print all available commands, run:
248
249 ```bash
250     $ npm run help
251 ```
252
253 ## Contributing
254
255 See the [contributing
256 guide](https://github.com/Chocobozzz/PeerTube/blob/master/.github/CONTRIBUTING.md)
257 to see how to contribute to PeerTube. Spoiler alert: you don't need to be a
258 coder to help!
259
260 ## Architecture
261
262 See [ARCHITECTURE.md](https://github.com/Chocobozzz/PeerTube/blob/master/ARCHITECTURE.md) for a more detailed explanation.
263
264 ### Backend
265
266   * The backend is a REST API.
267   * Servers communicate with each others with [Activity
268     Pub](https://www.w3.org/TR/activitypub/).
269   * Each server has its own users who query it (search videos, query where the
270     torrent URI of this specific video is...).
271   * If a user uploads a video, the server seeds it and sends its followers some
272     metadata (name, short description, torrent URI...).
273   * A server is a tracker responsible for all the videos uploaded in it.
274   * Even if nobody watches a video, it is seeded by the server (through
275     [WebSeed protocol](http://www.bittorrent.org/beps/bep_0019.html)) where the
276     video was uploaded.
277
278 Here are some simple schemes:
279
280 <p align="center">
281
282 <img src="https://lutim.cpy.re/6Qut3ure.png" alt="Decentralized" />
283
284 <img src="https://lutim.cpy.re/NvRAcv6U.png" alt="Watch a video" />
285
286 <img src="https://lutim.cpy.re/pqKm3Q5S.png" alt="Watch a P2P video" />
287
288 </p>