diff options
author | Jan Keromnes <jan.keromnes@typefox.io> | 2019-01-30 08:39:42 +0000 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-04-12 09:25:43 +0200 |
commit | 0cfcbae8189353a1ad29bafbd520e6965290f367 (patch) | |
tree | 05b3a7c612c2fb8b7be7fc87dc4439b00b4bf6fd | |
parent | cda03765fe366f028897e9b02dd4a0a19af3c935 (diff) | |
download | PeerTube-0cfcbae8189353a1ad29bafbd520e6965290f367.tar.gz PeerTube-0cfcbae8189353a1ad29bafbd520e6965290f367.tar.zst PeerTube-0cfcbae8189353a1ad29bafbd520e6965290f367.zip |
Add automated dev setup using Gitpod
-rw-r--r-- | .github/CONTRIBUTING.md | 10 | ||||
-rw-r--r-- | .gitpod.yml | 16 | ||||
-rw-r--r-- | client/proxy.config.json | 10 | ||||
-rw-r--r-- | client/src/environments/environment.hmr.ts | 2 | ||||
-rwxr-xr-x | scripts/watch/client.sh | 2 | ||||
-rw-r--r-- | support/docker/gitpod/Dockerfile | 11 | ||||
-rw-r--r-- | support/docker/gitpod/setup_postgres.sql | 6 |
7 files changed, 53 insertions, 4 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f0a4043ac..b3847b8d7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md | |||
@@ -57,8 +57,8 @@ before you start working on them :). | |||
57 | 57 | ||
58 | First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes. | 58 | First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes. |
59 | 59 | ||
60 | Make sure that you have followed | 60 | Make sure that you have followed |
61 | [the steps](/support/doc/dependencies.md) | 61 | [the steps](/support/doc/dependencies.md) |
62 | to install the dependencies. | 62 | to install the dependencies. |
63 | 63 | ||
64 | Then clone the sources and install node modules: | 64 | Then clone the sources and install node modules: |
@@ -93,6 +93,12 @@ $ sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_dev | |||
93 | 93 | ||
94 | In dev mode, administrator username is **root** and password is **test**. | 94 | In dev mode, administrator username is **root** and password is **test**. |
95 | 95 | ||
96 | ### Online development | ||
97 | |||
98 | You can get a complete PeerTube development setup with Gitpod, a free one-click online IDE for GitHub: | ||
99 | |||
100 | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Chocobozzz/PeerTube) | ||
101 | |||
96 | ### Server side | 102 | ### Server side |
97 | 103 | ||
98 | You can find a documentation of the server code/architecture [here](/support/doc/development/server/code.md). | 104 | You can find a documentation of the server code/architecture [here](/support/doc/development/server/code.md). |
diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..c2f2fa464 --- /dev/null +++ b/.gitpod.yml | |||
@@ -0,0 +1,16 @@ | |||
1 | image: | ||
2 | file: support/docker/gitpod/Dockerfile | ||
3 | ports: | ||
4 | - port: 3000 | ||
5 | onOpen: open-preview | ||
6 | - port: 5432 | ||
7 | onOpen: ignore | ||
8 | - port: 6379 | ||
9 | onOpen: ignore | ||
10 | - port: 9000 | ||
11 | onOpen: ignore | ||
12 | tasks: | ||
13 | - command: redis-server | ||
14 | - before: export NODE_CONFIG="{\"import\":{\"videos\":{\"torrent\":{\"enabled\":false}}},\"webserver\":{\"hostname\":\"$(gp url 3000 | cut -d/ -f3)\",\"port\":\"443\",\"https\":true}}" | ||
15 | init: yarn install --pure-lockfile | ||
16 | command: npm run dev \ No newline at end of file | ||
diff --git a/client/proxy.config.json b/client/proxy.config.json new file mode 100644 index 000000000..d1f393672 --- /dev/null +++ b/client/proxy.config.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "/api": { | ||
3 | "target": "http://localhost:9000", | ||
4 | "secure": false | ||
5 | }, | ||
6 | "/static": { | ||
7 | "target": "http://localhost:9000", | ||
8 | "secure": false | ||
9 | } | ||
10 | } | ||
diff --git a/client/src/environments/environment.hmr.ts b/client/src/environments/environment.hmr.ts index 20e2b8fcd..853e20803 100644 --- a/client/src/environments/environment.hmr.ts +++ b/client/src/environments/environment.hmr.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | export const environment = { | 1 | export const environment = { |
2 | production: false, | 2 | production: false, |
3 | hmr: true, | 3 | hmr: true, |
4 | apiUrl: 'http://localhost:9000' | 4 | apiUrl: '' |
5 | } | 5 | } |
diff --git a/scripts/watch/client.sh b/scripts/watch/client.sh index f3799d2e9..1d6b8c2aa 100755 --- a/scripts/watch/client.sh +++ b/scripts/watch/client.sh | |||
@@ -4,4 +4,4 @@ set -eu | |||
4 | 4 | ||
5 | cd client | 5 | cd client |
6 | 6 | ||
7 | npm run ng -- serve --hmr --configuration hmr --host 0.0.0.0 --disable-host-check --port 3000 | 7 | npm run ng -- serve --proxy-config proxy.config.json --hmr --configuration hmr --host 0.0.0.0 --disable-host-check --port 3000 |
diff --git a/support/docker/gitpod/Dockerfile b/support/docker/gitpod/Dockerfile new file mode 100644 index 000000000..435370dc4 --- /dev/null +++ b/support/docker/gitpod/Dockerfile | |||
@@ -0,0 +1,11 @@ | |||
1 | FROM gitpod/workspace-postgres | ||
2 | |||
3 | # Install PeerTube's dependencies. | ||
4 | RUN sudo apt-get update -q && sudo apt-get install -qy \ | ||
5 | ffmpeg \ | ||
6 | openssl \ | ||
7 | redis-server | ||
8 | |||
9 | # Set up PostgreSQL. | ||
10 | COPY --chown=gitpod:gitpod setup_postgres.sql /tmp/ | ||
11 | RUN pg_start && psql -h localhost -d postgres --file=/tmp/setup_postgres.sql | ||
diff --git a/support/docker/gitpod/setup_postgres.sql b/support/docker/gitpod/setup_postgres.sql new file mode 100644 index 000000000..0937f9d19 --- /dev/null +++ b/support/docker/gitpod/setup_postgres.sql | |||
@@ -0,0 +1,6 @@ | |||
1 | create database peertube_dev; | ||
2 | create user peertube password 'peertube'; | ||
3 | grant all privileges on database peertube_dev to peertube; | ||
4 | \c peertube_dev | ||
5 | CREATE EXTENSION pg_trgm; | ||
6 | CREATE EXTENSION unaccent; | ||