Try building peertube locally with a recent node version

This commit is contained in:
Bob Mottram 2018-02-09 15:20:34 +00:00
parent 45ade39c80
commit 12b95f0e76
1 changed files with 32 additions and 14 deletions

View File

@ -200,7 +200,9 @@ function upgrade_peertube {
function_check set_repo_commit function_check set_repo_commit
set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
npm run upgrade-peertube alias npm-exec='PATH=$(npm bin):$PATH'
npm-exec npm run upgrade-peertube
chown -R peertube:peertube $PEERTUBE_DIR chown -R peertube:peertube $PEERTUBE_DIR
systemctl start peertube systemctl start peertube
} }
@ -770,23 +772,39 @@ function install_peertube {
git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
set_completion_param "peertube commit" "$PEERTUBE_COMMIT" set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
npm install -g yarn npm install npm@5.6.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local npm version 5.6.0'
exit 45465774
fi
alias npm-exec='PATH=$(npm bin):$PATH'
npm-exec install node@9.5.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local nodejs version 9.5.0'
exit 54875459
fi
npm install npm@5.6.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local npm version 5.6.0'
exit 678356845684
fi
npm install yarn@1.3.2
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Failed to install yarn' echo $'Failed to install yarn'
exit 79353234 exit 578947946
fi fi
yarn add -D webpack --network-concurrency 1 npm-exec yarn add -D webpack --network-concurrency 1
yarn install #npm-exec yarn install --non-interactive
if [ ! "$?" = "0" ]; then #if [ ! "$?" = "0" ]; then
echo $'Failed to run yarn install' # echo $'Failed to run yarn install'
exit 63754235 # exit 63754235
fi #fi
npm install npm-exec npm install
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Failed to install peertube' echo $'Failed to install peertube'
exit 7835243 exit 7835243
fi fi
npm run build npm-exec npm run build
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Failed to build peertube' echo $'Failed to build peertube'
exit 5293593 exit 5293593
@ -803,13 +821,13 @@ function install_peertube {
echo 'User=peertube' >> /etc/systemd/system/peertube.service echo 'User=peertube' >> /etc/systemd/system/peertube.service
echo 'Group=peertube' >> /etc/systemd/system/peertube.service echo 'Group=peertube' >> /etc/systemd/system/peertube.service
echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service echo "ExecStart=$PEERTUBE_DIR/node_modules/.bin/npm start" >> /etc/systemd/system/peertube.service
echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service echo "ExecStop=$PEERTUBE_DIR/node_modules/.bin/npm stop" >> /etc/systemd/system/peertube.service
echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
echo 'Restart=always' >> /etc/systemd/system/peertube.service echo 'Restart=always' >> /etc/systemd/system/peertube.service
echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service echo "Environment=NODE_ENV=production PATH=\$(npm bin):\$PATH" >> /etc/systemd/system/peertube.service
echo '' >> /etc/systemd/system/peertube.service echo '' >> /etc/systemd/system/peertube.service
echo '[Install]' >> /etc/systemd/system/peertube.service echo '[Install]' >> /etc/systemd/system/peertube.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service