Add automated dev setup using Gitpod
authorJan Keromnes <jan.keromnes@typefox.io>
Wed, 30 Jan 2019 08:39:42 +0000 (08:39 +0000)
committerChocobozzz <chocobozzz@cpy.re>
Fri, 12 Apr 2019 07:25:43 +0000 (09:25 +0200)
.github/CONTRIBUTING.md
.gitpod.yml [new file with mode: 0644]
client/proxy.config.json [new file with mode: 0644]
client/src/environments/environment.hmr.ts
scripts/watch/client.sh
support/docker/gitpod/Dockerfile [new file with mode: 0644]
support/docker/gitpod/setup_postgres.sql [new file with mode: 0644]

index f0a4043accd8e4247434156b53ecb0d1e4a4140e..b3847b8d742b8d6504f0f9665cfbf2b87b99e6f2 100644 (file)
@@ -57,8 +57,8 @@ before you start working on them :).
 
 First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes.
 
-Make sure that you have followed 
-[the steps](/support/doc/dependencies.md) 
+Make sure that you have followed
+[the steps](/support/doc/dependencies.md)
 to install the dependencies.
 
 Then clone the sources and install node modules:
@@ -93,6 +93,12 @@ $ sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_dev
 
 In dev mode, administrator username is **root** and password is **test**.
 
+### Online development
+
+You can get a complete PeerTube development setup with Gitpod, a free one-click online IDE for GitHub:
+
+[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Chocobozzz/PeerTube)
+
 ### Server side
 
 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 (file)
index 0000000..c2f2fa4
--- /dev/null
@@ -0,0 +1,16 @@
+image:
+  file: support/docker/gitpod/Dockerfile
+ports:
+- port: 3000
+  onOpen: open-preview
+- port: 5432
+  onOpen: ignore
+- port: 6379
+  onOpen: ignore
+- port: 9000
+  onOpen: ignore
+tasks:
+- command: redis-server
+- before: export NODE_CONFIG="{\"import\":{\"videos\":{\"torrent\":{\"enabled\":false}}},\"webserver\":{\"hostname\":\"$(gp url 3000 | cut -d/ -f3)\",\"port\":\"443\",\"https\":true}}"
+  init: yarn install --pure-lockfile
+  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 (file)
index 0000000..d1f3936
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "/api": {
+    "target": "http://localhost:9000",
+    "secure": false
+  },
+  "/static": {
+    "target": "http://localhost:9000",
+    "secure": false
+  }
+}
index 20e2b8fcd1468d2978bd549e86b28e46e18a040a..853e20803863d3dc612be9c4879677df57c5284a 100644 (file)
@@ -1,5 +1,5 @@
 export const environment = {
   production: false,
   hmr: true,
-  apiUrl: 'http://localhost:9000'
+  apiUrl: ''
 }
index f3799d2e9dd1db395c8634c366380b0f60d58476..1d6b8c2aa5d719528d230f139b8e7dfa8fe69910 100755 (executable)
@@ -4,4 +4,4 @@ set -eu
 
 cd client
 
-npm run ng -- serve --hmr --configuration hmr --host 0.0.0.0 --disable-host-check --port 3000
+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 (file)
index 0000000..435370d
--- /dev/null
@@ -0,0 +1,11 @@
+FROM gitpod/workspace-postgres
+
+# Install PeerTube's dependencies.
+RUN sudo apt-get update -q && sudo apt-get install -qy \
+ ffmpeg \
+ openssl \
+ redis-server
+
+# Set up PostgreSQL.
+COPY --chown=gitpod:gitpod setup_postgres.sql /tmp/
+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 (file)
index 0000000..0937f9d
--- /dev/null
@@ -0,0 +1,6 @@
+create database peertube_dev;
+create user peertube password 'peertube';
+grant all privileges on database peertube_dev to peertube;
+\c peertube_dev
+CREATE EXTENSION pg_trgm;
+CREATE EXTENSION unaccent;