]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - .github/CONTRIBUTING.md
Correctly fix octet stream fallback for video ext
[github/Chocobozzz/PeerTube.git] / .github / CONTRIBUTING.md
CommitLineData
7a7edb72
C
1# Welcome to the contributing guide for PeerTube
2
71607e4a 3Interested in contributing? Awesome!
7a7edb72 4
e2266e4f 5**This guide will present you the following contribution topics:**
7a7edb72 6
6a1787c1 7 * [Translate](#translate)
7a7edb72 8 * [Give your feedback](#give-your-feedback)
7a7edb72 9 * [Write documentation](#write-documentation)
0e62b72b 10 * [Improve the website](#improve-the-website)
bfa1a32b
C
11 * [Develop](#develop)
12 * [Write a plugin or a theme](#plugins--themes)
7a7edb72 13
6a1787c1
C
14## Translate
15
16You can help us to translate the PeerTube interface to many languages! See [the documentation](/support/doc/translation.md) to know how.
17
18
7a7edb72
C
19## Give your feedback
20
e755a63a
BB
21You don't need to know how to code to start contributing to PeerTube! Other
22contributions are very valuable too, among which: you can test the software and
23report bugs, you can give feedback on potential bugs, features that you are
63bfad7e 24interested in, user interface, design, decentralized architecture...
7a7edb72
C
25
26
63bfad7e 27## Write documentation
7a7edb72 28
63bfad7e 29You can help to write the documentation of the REST API, code, architecture,
d59a8da8
C
30demonstrations.
31
32For the REST API you can see the documentation in [/support/doc/api](/support/doc/api) directory.
33Then, you can just open the `openapi.yaml` file in a special editor like [http://editor.swagger.io/](http://editor.swagger.io/) to easily see and edit the documentation.
34
35Some hints:
36 * Routes are defined in [/server/controllers/](/server/controllers/) directory
37 * Parameters validators are defined in [/server/middlewares/validators](/server/middlewares/validators) directory
38 * Models sent/received by the controllers are defined in [/shared/models](/shared/models) directory
39
7a7edb72 40
0e62b72b
TK
41## Improve the website
42
43PeerTube's website is [joinpeertube.org](https://joinpeertube.org), where people can learn about the project and how it works – note that it is not a PeerTube instance, but rather the project's homepage.
44
45You can help us improve it too!
46
47It is not hosted on GitHub but on [Framasoft](https://framasoft.org/)'s own [GitLab](https://about.gitlab.com/) instance, [FramaGit](https://framagit.org): https://framagit.org/framasoft/peertube/joinpeertube
48
49
63bfad7e 50## Develop
7a7edb72 51
7193ad10 52Don't hesitate to talk about features you want to develop by creating/commenting an issue
e755a63a 53before you start working on them :).
7a7edb72 54
63bfad7e 55### Prerequisites
7a7edb72 56
a43e2182 57First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes.
58
0cfcbae8
JK
59Make sure that you have followed
60[the steps](/support/doc/dependencies.md)
297e911b 61to install the dependencies. You'll need to install **NodeJS 10**.
e755a63a 62
e6b04e0e 63Fork the github repository,
64and then clone the sources and install node modules:
e755a63a 65
afe81767 66```
b30acc0e
J
67$ git clone https://github.com/Chocobozzz/PeerTube
68$ git remote add me git@github.com:YOUR_GITHUB_USERNAME/PeerTube.git
63bfad7e
C
69$ cd PeerTube
70$ yarn install --pure-lockfile
71```
e755a63a 72
dd07afa5
FA
73Note that development is done on the `develop` branch. If you want to hack on
74Peertube, you should switch to that branch. Also note that you have to repeat
75the `yarn install --pure-lockfile` command.
76
b30acc0e
J
77When you create a new branch you should also tell to use your repo for upload
78not default one. To do just do:
79```
80$ git push --set-upstream me <your branch name>
81```
82
e755a63a
BB
83Then, create a postgres database and user with the values set in the
84`config/default.yaml` file. For instance, if you do not change the values
85there, the following commands would create a new database called `peertube_dev`
86and a postgres user called `peertube` with password `peertube`:
87
afe81767 88```
63bfad7e
C
89# sudo -u postgres createuser -P peertube
90Enter password for new role: peertube
91# sudo -u postgres createdb -O peertube peertube_dev
e755a63a
BB
92```
93
dd07afa5
FA
94Then enable extensions PeerTube needs:
95
96```
97$ sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_dev
98$ sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_dev
99```
100
63bfad7e
C
101In dev mode, administrator username is **root** and password is **test**.
102
0cfcbae8
JK
103### Online development
104
105You can get a complete PeerTube development setup with Gitpod, a free one-click online IDE for GitHub:
106
107[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Chocobozzz/PeerTube)
108
e755a63a
BB
109### Server side
110
46e9407c 111You can find a documentation of the server code/architecture [here](https://docs.joinpeertube.org/#/contribute-architecture?id=server-code).
63bfad7e 112
e755a63a
BB
113To develop on the server-side:
114
afe81767 115```
63bfad7e 116$ npm run dev:server
e755a63a
BB
117```
118
119Then, the server will listen on `localhost:9000`. When server source files
120change, these are automatically recompiled and the server will automatically
19096851 121restart.
e755a63a
BB
122
123### Client side
124
838f4a79 125You can find a documentation of the client code/architecture
46e9407c 126[here](https://docs.joinpeertube.org/#/contribute-architecture?id=client-code).
63bfad7e
C
127
128
e755a63a
BB
129To develop on the client side:
130
afe81767 131```
63bfad7e 132$ npm run dev:client
e755a63a
BB
133```
134
135The API will listen on `localhost:9000` and the frontend on `localhost:3000`.
136Client files are automatically compiled on change, and the web browser will
137reload them automatically thanks to hot module replacement.
7a7edb72 138
19096851
C
139### Client and server side
140
141The API will listen on `localhost:9000` and the frontend on `localhost:3000`.
142File changes are automatically recompiled, injected in the web browser (no need to refresh manually)
143and the web server is automatically restarted.
144
145```
146$ npm run dev
147```
148
e2266e4f 149### Testing the federation of PeerTube servers
35a12fee 150
a9ab599e
C
151Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user.
152Then, we can create the databases (if they don't already exist):
a2897212
C
153
154```
a9ab599e
C
155$ sudo -u postgres createuser you_username --createdb
156$ createdb -O peertube peertube_test{1,2,3}
a2897212
C
157```
158
159Build the application and flush the old tests data:
7a7edb72 160
afe81767 161```
9ba1d64b 162$ npm run build -- --light
63bfad7e 163$ npm run clean:server:test
a2897212
C
164```
165
166This will run 3 nodes:
167
168```
63bfad7e
C
169$ npm run play
170```
7a7edb72 171
63bfad7e
C
172Then you will get access to the three nodes at `http://localhost:900{1,2,3}`
173with the `root` as username and `test{1,2,3}` for the password.
19096851 174
dbe868c0 175Instance configurations are in `config/test-{1,2,3}.yaml`.
19096851
C
176
177### Unit tests
178
a9ab599e 179Create a PostgreSQL user **with the same name as your username** in order to avoid using the *postgres* user.
6cca7360 180
a9ab599e 181Then, we can create the databases (if they don't already exist):
a2897212
C
182
183```
6d492e56 184$ sudo -u postgres createuser you_username --createdb --superuser
50b4dcce 185$ npm run clean:server:test
a2897212
C
186```
187
188Build the application and run the unit/integration tests:
19096851
C
189
190```
50b4dcce 191$ npm run build -- --light
19096851
C
192$ npm test
193```
76434ec8
C
194
195If you just want to run 1 test:
196
197```
198$ npm run mocha -- --exit --require ts-node/register/type-check --bail server/tests/api/index.ts
199```
dbe868c0
C
200
201Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`.
a43e2182 202Note that only instance 2 has transcoding enabled.
bfa1a32b
C
203
204## Plugins & Themes
205
206See the dedicated documentation: https://docs.joinpeertube.org/#/contribute-plugins