diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/api/openapi.yaml | 37 | ||||
-rw-r--r-- | support/doc/api/quickstart.md | 10 | ||||
-rw-r--r-- | support/doc/docker.md | 89 | ||||
-rw-r--r-- | support/doc/production.md | 2 | ||||
-rw-r--r-- | support/doc/tools.md | 32 | ||||
-rw-r--r-- | support/docker/production/.env | 23 | ||||
-rw-r--r-- | support/docker/production/config/traefik.toml | 11 | ||||
-rw-r--r-- | support/docker/production/docker-compose.yml | 5 | ||||
-rw-r--r-- | support/openapi/go/README.mustache | 121 | ||||
-rw-r--r-- | support/openapi/go/def.yaml | 3 | ||||
-rw-r--r-- | support/openapi/kotlin/README.mustache | 97 | ||||
-rw-r--r-- | support/openapi/kotlin/def.yaml | 6 | ||||
-rw-r--r-- | support/openapi/python/README.mustache | 47 | ||||
-rw-r--r-- | support/openapi/python/def.yaml | 5 |
14 files changed, 445 insertions, 43 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index f1cfb81a4..42430ba40 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -13,6 +13,7 @@ info: | |||
13 | altText: PeerTube Project Homepage | 13 | altText: PeerTube Project Homepage |
14 | description: | | 14 | description: | |
15 | # Introduction | 15 | # Introduction |
16 | |||
16 | The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable | 17 | The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable |
17 | resource URLs. It returns HTTP response codes to indicate errors. It also | 18 | resource URLs. It returns HTTP response codes to indicate errors. It also |
18 | accepts and returns JSON in the HTTP body. You can use your favorite | 19 | accepts and returns JSON in the HTTP body. You can use your favorite |
@@ -22,11 +23,13 @@ info: | |||
22 | which generates a client SDK in the language of your choice. | 23 | which generates a client SDK in the language of your choice. |
23 | 24 | ||
24 | # Authentication | 25 | # Authentication |
26 | |||
25 | When you sign up for an account, you are given the possibility to generate | 27 | When you sign up for an account, you are given the possibility to generate |
26 | sessions, and authenticate using this session token. One session token can | 28 | sessions, and authenticate using this session token. One session token can |
27 | currently be used at a time. | 29 | currently be used at a time. |
28 | 30 | ||
29 | # Errors | 31 | # Errors |
32 | |||
30 | The API uses standard HTTP status codes to indicate the success or failure | 33 | The API uses standard HTTP status codes to indicate the success or failure |
31 | of the API call. The body of the response will be JSON in the following | 34 | of the API call. The body of the response will be JSON in the following |
32 | format. | 35 | format. |
@@ -977,6 +980,12 @@ paths: | |||
977 | application/json: | 980 | application/json: |
978 | schema: | 981 | schema: |
979 | $ref: '#/components/schemas/VideoUploadResponse' | 982 | $ref: '#/components/schemas/VideoUploadResponse' |
983 | '403': | ||
984 | description: 'The user video quota is exceeded with this video.' | ||
985 | '408': | ||
986 | description: 'Upload has timed out' | ||
987 | '422': | ||
988 | description: 'Invalid input file.' | ||
980 | requestBody: | 989 | requestBody: |
981 | content: | 990 | content: |
982 | multipart/form-data: | 991 | multipart/form-data: |
@@ -2378,6 +2387,16 @@ components: | |||
2378 | type: string | 2387 | type: string |
2379 | css: | 2388 | css: |
2380 | type: string | 2389 | type: string |
2390 | search: | ||
2391 | type: object | ||
2392 | properties: | ||
2393 | remoteUri: | ||
2394 | type: object | ||
2395 | properties: | ||
2396 | users: | ||
2397 | type: boolean | ||
2398 | anonymous: | ||
2399 | type: boolean | ||
2381 | plugin: | 2400 | plugin: |
2382 | type: object | 2401 | type: object |
2383 | properties: | 2402 | properties: |
@@ -2423,6 +2442,11 @@ components: | |||
2423 | properties: | 2442 | properties: |
2424 | enabled: | 2443 | enabled: |
2425 | type: boolean | 2444 | type: boolean |
2445 | webtorrent: | ||
2446 | type: object | ||
2447 | properties: | ||
2448 | enabled: | ||
2449 | type: boolean | ||
2426 | enabledResolutions: | 2450 | enabledResolutions: |
2427 | type: array | 2451 | type: array |
2428 | items: | 2452 | items: |
@@ -2526,6 +2550,17 @@ components: | |||
2526 | properties: | 2550 | properties: |
2527 | enabled: | 2551 | enabled: |
2528 | type: boolean | 2552 | type: boolean |
2553 | followings: | ||
2554 | type: object | ||
2555 | properties: | ||
2556 | instance: | ||
2557 | type: object | ||
2558 | properties: | ||
2559 | autoFollowIndex: | ||
2560 | type: object | ||
2561 | properties: | ||
2562 | indexUrl: | ||
2563 | type: string | ||
2529 | ServerConfigAbout: | 2564 | ServerConfigAbout: |
2530 | properties: | 2565 | properties: |
2531 | instance: | 2566 | instance: |
@@ -2772,7 +2807,7 @@ components: | |||
2772 | description: 'The user username ' | 2807 | description: 'The user username ' |
2773 | password: | 2808 | password: |
2774 | type: string | 2809 | type: string |
2775 | description: 'The user password ' | 2810 | description: 'The user password. If the smtp server is configured, you can leave empty and an email will be sent ' |
2776 | email: | 2811 | email: |
2777 | type: string | 2812 | type: string |
2778 | description: 'The user email ' | 2813 | description: 'The user email ' |
diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md index 2222be741..677745969 100644 --- a/support/doc/api/quickstart.md +++ b/support/doc/api/quickstart.md | |||
@@ -52,3 +52,13 @@ $ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https | |||
52 | ```bash | 52 | ```bash |
53 | $ curl https://peertube.example.com/api/v1/videos | 53 | $ curl https://peertube.example.com/api/v1/videos |
54 | ``` | 54 | ``` |
55 | |||
56 | ## Libraries | ||
57 | |||
58 | [Convenience libraries](https://framagit.org/framasoft/peertube/clients) are generated automatically from the [OpenAPI specification](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/api/openapi.yaml) for the following languages: | ||
59 | |||
60 | - [python](https://framagit.org/framasoft/peertube/clients/python) | ||
61 | - [go](https://framagit.org/framasoft/peertube/clients/go) | ||
62 | - [kotlin](https://framagit.org/framasoft/peertube/clients/kotlin) | ||
63 | |||
64 | Other [languages supported by the OpenAPI generator](https://openapi-generator.tech/docs/generators/#client-generators) can be added to the generation, provided they make a common enough use case. | ||
diff --git a/support/doc/docker.md b/support/doc/docker.md index d7059d285..2ee922b87 100644 --- a/support/doc/docker.md +++ b/support/doc/docker.md | |||
@@ -14,44 +14,95 @@ PeerTube needs a PostgreSQL and a Redis instance to work correctly. If you want | |||
14 | to quickly set up a full environment, either for trying the service or in | 14 | to quickly set up a full environment, either for trying the service or in |
15 | production, you can use a `docker-compose` setup. | 15 | production, you can use a `docker-compose` setup. |
16 | 16 | ||
17 | #### Go to your peertube workdir | ||
17 | ```shell | 18 | ```shell |
18 | $ cd /your/peertube/directory | 19 | cd /your/peertube/directory |
19 | $ mkdir ./docker-volume && mkdir ./docker-volume/traefik | ||
20 | $ curl "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/config/traefik.toml" > ./docker-volume/traefik/traefik.toml | ||
21 | $ touch ./docker-volume/traefik/acme.json && chmod 600 ./docker-volume/traefik/acme.json | ||
22 | $ curl -s "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml" -o docker-compose.yml "https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env" -o .env | ||
23 | ``` | 20 | ``` |
24 | View the source of the files you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml) and the [traefik.toml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/config/traefik.toml) and the [.env] | ||
25 | (https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/.env) | ||
26 | 21 | ||
27 | Update the reverse proxy configuration: | 22 | #### Create the reverse proxy configuration directory |
28 | 23 | ||
29 | ```shell | 24 | ```shell |
30 | $ vim ./docker-volume/traefik/traefik.toml | 25 | mkdir -p ./docker-volume/traefik |
31 | ``` | 26 | ``` |
32 | 27 | ||
33 | Tweak the `docker-compose.yml` file there according to your needs: | 28 | #### Get the latest reverse proxy configuration |
34 | 29 | ||
35 | ```shell | 30 | ```shell |
36 | $ vim ./docker-compose.yml | 31 | curl https://raw.github.com/chocobozzz/PeerTube/master/support/docker/production/config/traefik.toml > ./docker-volume/traefik/traefik.toml |
37 | ``` | 32 | ``` |
38 | 33 | ||
39 | Then tweak the `.env` file to change the environment variables: | 34 | View the source of the file you're about to download: [traefik.toml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/config/traefik.toml) |
35 | |||
36 | #### Create Let's Encrypt ACME certificates as JSON file | ||
40 | 37 | ||
41 | ```shell | 38 | ```shell |
42 | $ vim ./.env | 39 | touch ./docker-volume/traefik/acme.json |
43 | ``` | 40 | ``` |
44 | If you did not download the .env file above, here you can look at the variables that can be set: | 41 | Needs to have file mode 600: |
45 | https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/.env | 42 | ```shell |
43 | chmod 600 ./docker-volume/traefik/acme.json | ||
44 | ``` | ||
45 | |||
46 | #### Get the latest Compose file | ||
47 | |||
48 | ```shell | ||
49 | curl https://raw.github.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml | ||
50 | ``` | ||
51 | |||
52 | View the source of the file you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/docker-compose.yml) | ||
53 | |||
54 | |||
55 | #### Get the latest env_file | ||
56 | |||
57 | ```shell | ||
58 | curl https://raw.github.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env | ||
59 | ``` | ||
60 | |||
61 | View the source of the file you're about to download: [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env) | ||
62 | |||
63 | #### Update the reverse proxy configuration | ||
64 | |||
65 | ```shell | ||
66 | vim ./docker-volume/traefik/traefik.toml | ||
67 | ``` | ||
68 | |||
69 | ~~You must replace `<MY EMAIL ADDRESS>` and `<MY DOMAIN>` to enable Let's Encrypt SSL Certificates creation.~~ Now included in `.env` file with `TRAEFIK_ACME_EMAIL` and `TRAEFIK_ACME_DOMAINS` variables used through traefik service command value of `docker-compose.yml` file. | ||
70 | |||
71 | More at: https://docs.traefik.io/v1.7 | ||
72 | |||
73 | #### Tweak the `docker-compose.yml` file there according to your needs | ||
74 | |||
75 | ```shell | ||
76 | vim ./docker-compose.yml | ||
77 | ``` | ||
78 | |||
79 | #### Then tweak the `.env` file to change the environment variables | ||
80 | |||
81 | ```shell | ||
82 | vim ./.env | ||
83 | ``` | ||
84 | In the downloaded example [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env), you must replace: | ||
85 | - `<MY POSTGRES USERNAME>` | ||
86 | - `<MY POSTGRES PASSWORD>` | ||
87 | - `<MY POSTGRES DB>` | ||
88 | - `<MY DOMAIN>` without 'https://' | ||
89 | - `<MY EMAIL ADDRESS>` | ||
46 | 90 | ||
47 | Other environment variables are used in | 91 | Other environment variables are used in |
48 | `support/docker/production/config/custom-environment-variables.yaml` and can be | 92 | [/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/config/custom-environment-variables.yaml) and can be |
49 | intuited from usage. | 93 | intuited from usage. |
50 | 94 | ||
51 | You can use the regular `up` command to set it up: | 95 | #### Testing local Docker setup |
96 | |||
97 | To test locally your Docker setup, you must add your domain (`<MY DOMAIN>`) in `/etc/hosts`: | ||
98 | ``` | ||
99 | 127.0.0.1 localhost mydomain.tld | ||
100 | ``` | ||
101 | |||
102 | #### You can use the regular `up` command to set it up | ||
52 | 103 | ||
53 | ```shell | 104 | ```shell |
54 | $ docker-compose up | 105 | docker-compose up |
55 | ``` | 106 | ``` |
56 | ### Obtaining Your Automatically Generated Admin Credentials | 107 | ### Obtaining Your Automatically Generated Admin Credentials |
57 | Now that you've installed your PeerTube instance you'll want to grep your peertube container's logs for the `root` password. | 108 | Now that you've installed your PeerTube instance you'll want to grep your peertube container's logs for the `root` password. |
@@ -89,5 +140,5 @@ $ docker build . -f ./support/docker/production/Dockerfile.buster | |||
89 | 140 | ||
90 | ## Development | 141 | ## Development |
91 | 142 | ||
92 | We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#develop) | 143 | We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/master/.github/CONTRIBUTING.md#develop) |
93 | for more information on how you can hack PeerTube! | 144 | for more information on how you can hack PeerTube! |
diff --git a/support/doc/production.md b/support/doc/production.md index 8f061f868..6febaba5d 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -39,7 +39,7 @@ Create the production database and a peertube user inside PostgreSQL: | |||
39 | 39 | ||
40 | ``` | 40 | ``` |
41 | $ sudo -u postgres createuser -P peertube | 41 | $ sudo -u postgres createuser -P peertube |
42 | $ sudo -u postgres createdb -O peertube peertube_prod | 42 | $ sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod |
43 | ``` | 43 | ``` |
44 | 44 | ||
45 | Then enable extensions PeerTube needs: | 45 | Then enable extensions PeerTube needs: |
diff --git a/support/doc/tools.md b/support/doc/tools.md index d5427b5b7..1f1e52c36 100644 --- a/support/doc/tools.md +++ b/support/doc/tools.md | |||
@@ -12,6 +12,7 @@ | |||
12 | - [peertube-upload.js](#peertube-uploadjs) | 12 | - [peertube-upload.js](#peertube-uploadjs) |
13 | - [peertube-watch.js](#peertube-watchjs) | 13 | - [peertube-watch.js](#peertube-watchjs) |
14 | - [peertube-plugins.js](#peertube-pluginsjs) | 14 | - [peertube-plugins.js](#peertube-pluginsjs) |
15 | - [peertube-redundancy.js](#peertube-redundancyjs) | ||
15 | - [Server tools](#server-tools) | 16 | - [Server tools](#server-tools) |
16 | - [parse-log](#parse-log) | 17 | - [parse-log](#parse-log) |
17 | - [create-transcoding-job.js](#create-transcoding-jobjs) | 18 | - [create-transcoding-job.js](#create-transcoding-jobjs) |
@@ -77,7 +78,8 @@ You can access it as `peertube` via an alias in your `.bashrc` like `alias peert | |||
77 | import-videos|import import a video from a streaming platform | 78 | import-videos|import import a video from a streaming platform |
78 | watch|w watch a video in the terminal ✩°。⋆ | 79 | watch|w watch a video in the terminal ✩°。⋆ |
79 | repl initiate a REPL to access internals | 80 | repl initiate a REPL to access internals |
80 | plugins|p [action] manag instance plugins | 81 | plugins|p [action] manage instance plugins |
82 | redundancy|r [action] manage video redundancies | ||
81 | help [cmd] display help for [cmd] | 83 | help [cmd] display help for [cmd] |
82 | ``` | 84 | ``` |
83 | 85 | ||
@@ -200,6 +202,34 @@ $ node dist/server/tools/peertube-plugins.js install --path /my/plugin/path | |||
200 | $ node dist/server/tools/peertube-plugins.js install --npm-name peertube-theme-example | 202 | $ node dist/server/tools/peertube-plugins.js install --npm-name peertube-theme-example |
201 | ``` | 203 | ``` |
202 | 204 | ||
205 | #### peertube-redundancy.js | ||
206 | |||
207 | Manage (list/add/remove) video redundancies: | ||
208 | |||
209 | To list your videos that are duplicated by remote instances: | ||
210 | |||
211 | ``` | ||
212 | $ node dist/server/tools/peertube.js redundancy list-remote-redundancies | ||
213 | ``` | ||
214 | |||
215 | To list remote videos that your instance duplicated: | ||
216 | |||
217 | ``` | ||
218 | $ node dist/server/tools/peertube.js redundancy list-my-redundancies | ||
219 | ``` | ||
220 | |||
221 | To duplicate a specific video in your redundancy system: | ||
222 | |||
223 | ``` | ||
224 | $ node dist/server/tools/peertube.js redundancy add --video 823 | ||
225 | ``` | ||
226 | |||
227 | To remove a video redundancy: | ||
228 | |||
229 | ``` | ||
230 | $ node dist/server/tools/peertube.js redundancy remove --video 823 | ||
231 | ``` | ||
232 | |||
203 | ## Server tools | 233 | ## Server tools |
204 | 234 | ||
205 | These scripts should be run on the server, in `peertube-latest` directory. | 235 | These scripts should be run on the server, in `peertube-latest` directory. |
diff --git a/support/docker/production/.env b/support/docker/production/.env index 95ca42d69..0321b04ae 100644 --- a/support/docker/production/.env +++ b/support/docker/production/.env | |||
@@ -1,10 +1,11 @@ | |||
1 | POSTGRES_USER=peertube | 1 | POSTGRES_USER=<MY POSTGRES USERNAME> |
2 | POSTGRES_PASSWORD=peertube | 2 | POSTGRES_PASSWORD=<MY POSTGRES PASSWORD> |
3 | POSTGRES_DB=peertube | 3 | POSTGRES_DB=<MY POSTGRES DB> |
4 | PEERTUBE_DB_USERNAME=$(POSTGRES_USER) | 4 | PEERTUBE_DB_USERNAME=<MY POSTGRES USERNAME> |
5 | PEERTUBE_DB_PASSWORD=$(POSTGRES_PASSWORD) | 5 | PEERTUBE_DB_PASSWORD=<MY POSTGRES PASSWORD> |
6 | # PEERTUBE_DB_HOSTNAME is the Postgres service name in docker-compose.yml | ||
6 | PEERTUBE_DB_HOSTNAME=postgres | 7 | PEERTUBE_DB_HOSTNAME=postgres |
7 | PEERTUBE_WEBSERVER_HOSTNAME=domain.tld | 8 | PEERTUBE_WEBSERVER_HOSTNAME=<MY DOMAIN> |
8 | PEERTUBE_WEBSERVER_PORT=443 | 9 | PEERTUBE_WEBSERVER_PORT=443 |
9 | PEERTUBE_WEBSERVER_HTTPS=true | 10 | PEERTUBE_WEBSERVER_HTTPS=true |
10 | # If you need more than one IP as trust_proxy | 11 | # If you need more than one IP as trust_proxy |
@@ -14,11 +15,15 @@ PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.18.0.0/16"] | |||
14 | #PEERTUBE_SMTP_PASSWORD= | 15 | #PEERTUBE_SMTP_PASSWORD= |
15 | PEERTUBE_SMTP_HOSTNAME=postfix | 16 | PEERTUBE_SMTP_HOSTNAME=postfix |
16 | PEERTUBE_SMTP_PORT=25 | 17 | PEERTUBE_SMTP_PORT=25 |
17 | PEERTUBE_SMTP_FROM=noreply@domain.tld | 18 | PEERTUBE_SMTP_FROM=noreply@<MY DOMAIN> |
18 | PEERTUBE_SMTP_TLS=false | 19 | PEERTUBE_SMTP_TLS=false |
19 | PEERTUBE_SMTP_DISABLE_STARTTLS=false | 20 | PEERTUBE_SMTP_DISABLE_STARTTLS=false |
20 | PEERTUBE_ADMIN_EMAIL=admin@domain.tld | 21 | PEERTUBE_ADMIN_EMAIL=<MY EMAIL ADDRESS> |
21 | POSTFIX_myhostname=${PEERTUBE_WEBSERVER_HOSTNAME} | 22 | POSTFIX_myhostname=<MY DOMAIN> |
23 | TRAEFIK_ACME_EMAIL=<MY EMAIL ADDRESS> | ||
24 | # If you need to obtain ACME certificates for more than one DOMAIN | ||
25 | # pass them as a comma separated string | ||
26 | TRAEFIK_ACME_DOMAINS=<MY DOMAIN> | ||
22 | # /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\ | 27 | # /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\ |
23 | #PEERTUBE_SIGNUP_ENABLED=true | 28 | #PEERTUBE_SIGNUP_ENABLED=true |
24 | #PEERTUBE_TRANSCODING_ENABLED=true | 29 | #PEERTUBE_TRANSCODING_ENABLED=true |
diff --git a/support/docker/production/config/traefik.toml b/support/docker/production/config/traefik.toml index 6abced3db..1d7d207fd 100644 --- a/support/docker/production/config/traefik.toml +++ b/support/docker/production/config/traefik.toml | |||
@@ -37,12 +37,6 @@ defaultEntryPoints = ["http", "https"] | |||
37 | # Enable ACME (Let's Encrypt): automatic SSL. | 37 | # Enable ACME (Let's Encrypt): automatic SSL. |
38 | [acme] | 38 | [acme] |
39 | 39 | ||
40 | # Email address used for registration. | ||
41 | # | ||
42 | # Required | ||
43 | # | ||
44 | email = "<MY EMAIL ADDRESS>" | ||
45 | |||
46 | # File or key used for certificates storage. | 40 | # File or key used for certificates storage. |
47 | # | 41 | # |
48 | # Required | 42 | # Required |
@@ -57,11 +51,6 @@ storage = "/etc/acme.json" | |||
57 | # | 51 | # |
58 | entryPoint = "https" | 52 | entryPoint = "https" |
59 | 53 | ||
60 | # Domains list. | ||
61 | # | ||
62 | [[acme.domains]] | ||
63 | main = "<MY DOMAIN>" | ||
64 | |||
65 | # Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge | 54 | # Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge |
66 | # | 55 | # |
67 | # Optional but recommend | 56 | # Optional but recommend |
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml index b81a8745b..72b08b855 100644 --- a/support/docker/production/docker-compose.yml +++ b/support/docker/production/docker-compose.yml | |||
@@ -5,7 +5,10 @@ services: | |||
5 | reverse-proxy: | 5 | reverse-proxy: |
6 | image: traefik:v1.7 | 6 | image: traefik:v1.7 |
7 | network_mode: "host" | 7 | network_mode: "host" |
8 | command: --docker # Tells Træfik to listen to docker | 8 | command: |
9 | - "--docker" # Tells Træfik to listen to docker | ||
10 | - "--acme.email=${TRAEFIK_ACME_EMAIL}" # Let's Encrypt ACME email | ||
11 | - "--acme.domains=${TRAEFIK_ACME_DOMAINS}" # Let's Encrypt ACME domain list | ||
9 | ports: | 12 | ports: |
10 | - "80:80" # The HTTP port | 13 | - "80:80" # The HTTP port |
11 | - "443:443" # The HTTPS port | 14 | - "443:443" # The HTTPS port |
diff --git a/support/openapi/go/README.mustache b/support/openapi/go/README.mustache new file mode 100644 index 000000000..d0fc0fa33 --- /dev/null +++ b/support/openapi/go/README.mustache | |||
@@ -0,0 +1,121 @@ | |||
1 | # Go API client for {{appName}} | ||
2 | |||
3 | This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html), | ||
4 | using the [OpenAPI Generator](https://openapi-generator.tech) project: | ||
5 | |||
6 | - API version: {{appVersion}} | ||
7 | - Package version: {{packageVersion}} | ||
8 | {{^hideGenerationTimestamp}} | ||
9 | - Build date: {{generatedDate}} | ||
10 | {{/hideGenerationTimestamp}} | ||
11 | - Build package: {{generatorClass}} | ||
12 | |||
13 | {{#infoUrl}} | ||
14 | For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
15 | {{/infoUrl}} | ||
16 | |||
17 | ## Installation | ||
18 | |||
19 | Install the following dependencies: | ||
20 | |||
21 | ```shell | ||
22 | go get github.com/stretchr/testify/assert | ||
23 | go get golang.org/x/oauth2 | ||
24 | go get golang.org/x/net/context | ||
25 | go get github.com/antihax/optional | ||
26 | ``` | ||
27 | |||
28 | Put the package under your project folder and add the following in import: | ||
29 | |||
30 | ```golang | ||
31 | import "./{{packageName}}" | ||
32 | ``` | ||
33 | |||
34 | ## Documentation for API Endpoints | ||
35 | |||
36 | All URIs are relative to *{{basePath}}* | ||
37 | |||
38 | Class | Method | HTTP request | Description | ||
39 | ------------ | ------------- | ------------- | ------------- | ||
40 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} | ||
41 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} | ||
42 | |||
43 | ## Documentation For Models | ||
44 | |||
45 | {{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) | ||
46 | {{/model}}{{/models}} | ||
47 | |||
48 | ## Documentation For Authorization | ||
49 | |||
50 | {{^authMethods}} Endpoints do not require authorization. | ||
51 | {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} | ||
52 | {{#authMethods}} | ||
53 | |||
54 | ## {{{name}}} | ||
55 | |||
56 | {{#isApiKey}}- **Type**: API key | ||
57 | |||
58 | Example | ||
59 | |||
60 | ```golang | ||
61 | auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ | ||
62 | Key: "APIKEY", | ||
63 | Prefix: "Bearer", // Omit if not necessary. | ||
64 | }) | ||
65 | r, err := client.Service.Operation(auth, args) | ||
66 | ``` | ||
67 | |||
68 | {{/isApiKey}} | ||
69 | {{#isBasic}}- **Type**: HTTP basic authentication | ||
70 | |||
71 | Example | ||
72 | |||
73 | ```golang | ||
74 | auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ | ||
75 | UserName: "username", | ||
76 | Password: "password", | ||
77 | }) | ||
78 | r, err := client.Service.Operation(auth, args) | ||
79 | ``` | ||
80 | |||
81 | {{/isBasic}} | ||
82 | {{#isOAuth}} | ||
83 | |||
84 | - **Type**: OAuth | ||
85 | - **Flow**: {{{flow}}} | ||
86 | - **Authorization URL**: {{{authorizationUrl}}} | ||
87 | - **Scopes**: {{^scopes}}N/A{{/scopes}} | ||
88 | {{#scopes}} - **{{{scope}}}**: {{{description}}} | ||
89 | {{/scopes}} | ||
90 | |||
91 | Example | ||
92 | |||
93 | ```golang | ||
94 | auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") | ||
95 | r, err := client.Service.Operation(auth, args) | ||
96 | ``` | ||
97 | |||
98 | Or via OAuth2 module to automatically refresh tokens and perform user authentication. | ||
99 | |||
100 | ```golang | ||
101 | import "golang.org/x/oauth2" | ||
102 | |||
103 | /* Perform OAuth2 round trip request and obtain a token */ | ||
104 | |||
105 | tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) | ||
106 | auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) | ||
107 | r, err := client.Service.Operation(auth, args) | ||
108 | ``` | ||
109 | |||
110 | {{/isOAuth}} | ||
111 | {{/authMethods}} | ||
112 | |||
113 | ## License | ||
114 | |||
115 | Copyright (C) 2015-2020 PeerTube Contributors | ||
116 | |||
117 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
118 | |||
119 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. | ||
120 | |||
121 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses. | ||
diff --git a/support/openapi/go/def.yaml b/support/openapi/go/def.yaml new file mode 100644 index 000000000..7136da912 --- /dev/null +++ b/support/openapi/go/def.yaml | |||
@@ -0,0 +1,3 @@ | |||
1 | # https://openapi-generator.tech/docs/generators/go | ||
2 | |||
3 | packageName: peertube | ||
diff --git a/support/openapi/kotlin/README.mustache b/support/openapi/kotlin/README.mustache new file mode 100644 index 000000000..ac7fbdea9 --- /dev/null +++ b/support/openapi/kotlin/README.mustache | |||
@@ -0,0 +1,97 @@ | |||
1 | # Kotlin API client for {{appName}} | ||
2 | |||
3 | ## Requires | ||
4 | |||
5 | {{#jvm}} | ||
6 | * Kotlin 1.3.41 | ||
7 | * Gradle 4.9 | ||
8 | {{/jvm}} | ||
9 | {{#multiplatform}} | ||
10 | * Kotlin 1.3.50 | ||
11 | {{/multiplatform}} | ||
12 | |||
13 | ## Build | ||
14 | |||
15 | {{#jvm}} | ||
16 | First, create the gradle wrapper script: | ||
17 | |||
18 | ``` | ||
19 | gradle wrapper | ||
20 | ``` | ||
21 | |||
22 | Then, run: | ||
23 | |||
24 | {{/jvm}} | ||
25 | ``` | ||
26 | ./gradlew check assemble | ||
27 | ``` | ||
28 | |||
29 | This runs all tests and packages the library. | ||
30 | |||
31 | ## Features/Implementation Notes | ||
32 | |||
33 | {{#generateApiDocs}} | ||
34 | <a name="documentation-for-api-endpoints"></a> | ||
35 | ## Documentation for API Endpoints | ||
36 | |||
37 | All URIs are relative to *{{{basePath}}}*. Change it when instanciating `ApiClient(basePath)`. | ||
38 | |||
39 | Class | Method | HTTP request | Description | ||
40 | ------------ | ------------- | ------------- | ------------- | ||
41 | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}} | ||
42 | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} | ||
43 | {{/generateApiDocs}} | ||
44 | |||
45 | {{#generateModelDocs}} | ||
46 | <a name="documentation-for-models"></a> | ||
47 | ## Documentation for Models | ||
48 | |||
49 | {{#modelPackage}} | ||
50 | {{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) | ||
51 | {{/model}}{{/models}} | ||
52 | {{/modelPackage}} | ||
53 | {{^modelPackage}} | ||
54 | No model defined in this package | ||
55 | {{/modelPackage}} | ||
56 | {{/generateModelDocs}} | ||
57 | |||
58 | <a name="documentation-for-authorization"></a>{{! TODO: optional documentation for authorization? }} | ||
59 | ## Documentation for Authorization | ||
60 | |||
61 | {{^authMethods}} | ||
62 | All endpoints do not require authorization. | ||
63 | {{/authMethods}} | ||
64 | {{#authMethods}} | ||
65 | {{#last}} | ||
66 | Authentication schemes defined for the API: | ||
67 | {{/last}} | ||
68 | {{/authMethods}} | ||
69 | {{#authMethods}} | ||
70 | <a name="{{name}}"></a> | ||
71 | ### {{name}} | ||
72 | |||
73 | {{#isApiKey}}- **Type**: API key | ||
74 | - **API key parameter name**: {{keyParamName}} | ||
75 | - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} | ||
76 | {{/isApiKey}} | ||
77 | {{#isBasic}}- **Type**: HTTP basic authentication | ||
78 | {{/isBasic}} | ||
79 | {{#isOAuth}}- **Type**: OAuth | ||
80 | - **Flow**: {{flow}} | ||
81 | - **Authorization URL**: {{authorizationUrl}} | ||
82 | - **Scopes**: {{^scopes}}N/A{{/scopes}} | ||
83 | {{#scopes}} - {{scope}}: {{description}} | ||
84 | {{/scopes}} | ||
85 | {{/isOAuth}} | ||
86 | |||
87 | {{/authMethods}} | ||
88 | |||
89 | ## License | ||
90 | |||
91 | Copyright (C) 2015-2020 PeerTube Contributors | ||
92 | |||
93 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
94 | |||
95 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. | ||
96 | |||
97 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses. | ||
diff --git a/support/openapi/kotlin/def.yaml b/support/openapi/kotlin/def.yaml new file mode 100644 index 000000000..7a01ae6e5 --- /dev/null +++ b/support/openapi/kotlin/def.yaml | |||
@@ -0,0 +1,6 @@ | |||
1 | # https://openapi-generator.tech/docs/generators/kotlin | ||
2 | |||
3 | artifactId: peertube-api | ||
4 | groupId: org.peertube | ||
5 | packageName: org.peertube.client | ||
6 | |||
diff --git a/support/openapi/python/README.mustache b/support/openapi/python/README.mustache new file mode 100644 index 000000000..93dcd5ab6 --- /dev/null +++ b/support/openapi/python/README.mustache | |||
@@ -0,0 +1,47 @@ | |||
1 | # Python API client for {{appName}} | ||
2 | |||
3 | This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html), | ||
4 | using the [OpenAPI Generator](https://openapi-generator.tech) project: | ||
5 | |||
6 | - API version: {{appVersion}} | ||
7 | - Package version: {{packageVersion}} | ||
8 | {{^hideGenerationTimestamp}} | ||
9 | - Build date: {{generatedDate}} | ||
10 | {{/hideGenerationTimestamp}} | ||
11 | - Build package: {{generatorClass}} | ||
12 | |||
13 | {{#infoUrl}} | ||
14 | For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
15 | {{/infoUrl}} | ||
16 | |||
17 | ## Requirements. | ||
18 | |||
19 | Python 2.7 and 3.4+ | ||
20 | |||
21 | ## Installation & Usage | ||
22 | |||
23 | ```sh | ||
24 | pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git | ||
25 | ``` | ||
26 | (you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`) | ||
27 | |||
28 | Then import the package: | ||
29 | ```python | ||
30 | import {{{packageName}}} | ||
31 | ``` | ||
32 | |||
33 | ## Getting Started | ||
34 | |||
35 | Please follow the [installation procedure](#installation--usage) and then run the following: | ||
36 | |||
37 | {{> common_README }} | ||
38 | |||
39 | ## License | ||
40 | |||
41 | Copyright (C) 2015-2020 PeerTube Contributors | ||
42 | |||
43 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
44 | |||
45 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. | ||
46 | |||
47 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses. | ||
diff --git a/support/openapi/python/def.yaml b/support/openapi/python/def.yaml new file mode 100644 index 000000000..819a466eb --- /dev/null +++ b/support/openapi/python/def.yaml | |||
@@ -0,0 +1,5 @@ | |||
1 | # https://openapi-generator.tech/docs/generators/python | ||
2 | |||
3 | packageName: peertube | ||
4 | projectName: peertube | ||
5 | |||