From 6b2ef589ed8ef5d253f6213e1bb275cbe135f2b4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Jan 2018 11:10:46 +0100 Subject: [PATCH] Prepare production workflow --- .gitignore | 10 +--------- client/package.json | 2 +- config/default.yaml | 16 ++++++++-------- config/production.yaml.example | 16 ++++++++-------- package.json | 4 ++-- scripts/release.sh | 30 ++++++++++++++++++++++++++++-- server/helpers/requests.ts | 7 +++---- support/doc/production.md | 6 ++++++ 8 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index fa7974ae4..13f31db4b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,15 +5,7 @@ /test4/ /test5/ /test6/ -/uploads/ -/videos/ -/avatars/ -/thumbnails/ -/previews/ -/certs/ -/logs/ -/torrents/ -/cache/ +/storage/ /config/production.yaml /ffmpeg/ /*.sublime-project diff --git a/client/package.json b/client/package.json index ad07f31b0..10634c3c4 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "peertube-client", - "version": "0.0.1", + "version": "0.0.0-alpha", "private": true, "licence": "GPLv3", "author": { diff --git a/config/default.yaml b/config/default.yaml index 2c1043067..ee7446826 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -16,14 +16,14 @@ database: # From the project root directory storage: - avatars: 'avatars/' - certs: 'certs/' - videos: 'videos/' - logs: 'logs/' - previews: 'previews/' - thumbnails: 'thumbnails/' - torrents: 'torrents/' - cache: 'cache/' + avatars: 'storage/avatars/' + certs: 'storage/certs/' + videos: 'storage/videos/' + logs: 'storage/logs/' + previews: 'storage/previews/' + thumbnails: 'storage/thumbnails/' + torrents: 'storage/torrents/' + cache: 'storage/cache/' cache: previews: diff --git a/config/production.yaml.example b/config/production.yaml.example index 404d35c16..660477196 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -17,14 +17,14 @@ database: # From the project root directory storage: - avatars: 'avatars/' - certs: 'certs/' - videos: 'videos/' - logs: 'logs/' - previews: 'previews/' - thumbnails: 'thumbnails/' - torrents: 'torrents/' - cache: 'cache/' + avatars: '../storage/avatars/' + certs: '../storage/certs/' + videos: '../storage/videos/' + logs: '../storage/logs/' + previews: '../storage/previews/' + thumbnails: '../storage/thumbnails/' + torrents: '../storage/torrents/' + cache: '../storage/cache/' cache: previews: diff --git a/package.json b/package.json index efe03dc04..213c6e7a6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "peertube", - "description": "Prototype of a decentralized video streaming platform using P2P (bittorent) directly in the web browser with WebTorrent and Angular 2.", - "version": "0.0.1", + "description": "Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.", + "version": "0.0.0-alpha", "private": true, "licence": "GPLv3", "engines": { diff --git a/scripts/release.sh b/scripts/release.sh index 572e6bdca..07fec00b8 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,7 +1,33 @@ #!/bin/bash -npm run build -npm test +shutdown() { + # Get our process group id + PGID=$(ps -o pgid= $$ | grep -o [0-9]*) + + # Kill it in a new new process group + setsid kill -- -$PGID + exit 0 +} + +trap "shutdown" SIGINT SIGTERM + +if [ -z "$1" ]; then + echo "Need version as argument" + exit -1 +fi + +cd ./client || exit -1 +npm version --no-git-tag-version --no-commit-hooks $1 || exit -1 cd ../ || exit -1 +npm version -f --no-git-tag-version --no-commit-hooks $1 || exit -1 + +git commit package.json client/package.json -m "Bumped to version $1" || exit -1 +git tag -s -a "v$1" -m "v$1" + +npm run build || exit -1 +#npm test || exit -1 + +cd ../ || exit -1 +rm -f PeerTube/peertube.zip || exit -1 zip -r PeerTube/peertube.zip PeerTube/{CREDITS.md,node_modules,FAQ.md,LICENSE,README.md,client/dist/,client/yarn.lock,client/package.json,config,dist,package.json,scripts,support,tsconfig.json,yarn.lock} diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index e8d77b15b..eb8a12868 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts @@ -1,8 +1,7 @@ -import * as Promise from 'bluebird' +import * as Bluebird from 'bluebird' import { createWriteStream } from 'fs' import * as request from 'request' import { ACTIVITY_PUB } from '../initializers' -import Bluebird = require('bluebird') function doRequest ( requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } @@ -12,13 +11,13 @@ function doRequest ( requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER } - return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { + return new Bluebird<{ response: request.RequestResponse, body: any }>((res, rej) => { request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) }) } function doRequestAndSaveToFile (requestOptions: request.CoreOptions & request.UriOptions, destPath: string) { - return new Promise((res, rej) => { + return new Bluebird((res, rej) => { request(requestOptions) .on('response', response => res(response as request.RequestResponse)) .on('error', err => rej(err)) diff --git a/support/doc/production.md b/support/doc/production.md index 118704da3..a8ed2af88 100644 --- a/support/doc/production.md +++ b/support/doc/production.md @@ -199,6 +199,12 @@ Tell systemd to reload its config: sudo systemctl daemon-reload ``` +If you want to start PeerTube on boot: + +``` +sudo systemctl enabled peertube +``` + ### Run ```