Browse Source

Add automated dev setup using Gitpod

Jan Keromnes 9 months ago
parent
commit
0cfcbae818

+ 8
- 2
.github/CONTRIBUTING.md View File

@@ -57,8 +57,8 @@ before you start working on them :).
57 57
 
58 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 
61
-[the steps](/support/doc/dependencies.md) 
60
+Make sure that you have followed
61
+[the steps](/support/doc/dependencies.md)
62 62
 to install the dependencies.
63 63
 
64 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 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 102
 ### Server side
97 103
 
98 104
 You can find a documentation of the server code/architecture [here](/support/doc/development/server/code.md).

+ 16
- 0
.gitpod.yml View File

@@ -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

+ 10
- 0
client/proxy.config.json View File

@@ -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
+}

+ 1
- 1
client/src/environments/environment.hmr.ts View File

@@ -1,5 +1,5 @@
1 1
 export const environment = {
2 2
   production: false,
3 3
   hmr: true,
4
-  apiUrl: 'http://localhost:9000'
4
+  apiUrl: ''
5 5
 }

+ 1
- 1
scripts/watch/client.sh View File

@@ -4,4 +4,4 @@ set -eu
4 4
 
5 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

+ 11
- 0
support/docker/gitpod/Dockerfile View File

@@ -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

+ 6
- 0
support/docker/gitpod/setup_postgres.sql View File

@@ -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;

Loading…
Cancel
Save