Просмотр исходного кода

Revert recent peertube changes

Bob Mottram 7 лет назад
Родитель
Сommit
43b5121aa0
2 измененных файлов: 12 добавлений и 58 удалений
  1. 11
    57
      src/freedombone-app-peertube
  2. 1
    1
      src/freedombone-utils-nodejs

+ 11
- 57
src/freedombone-app-peertube Просмотреть файл

39
 PEERTUBE_DOMAIN_NAME=
39
 PEERTUBE_DOMAIN_NAME=
40
 PEERTUBE_CODE=
40
 PEERTUBE_CODE=
41
 PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube"
41
 PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube"
42
-PEERTUBE_COMMIT='a7fea183f0f69104b209e7bfdd6435be28165f22'
42
+PEERTUBE_COMMIT='fef2c7164e025b12a64185dbab058ef4129733c6'
43
 PEERTUBE_ONION_PORT=8136
43
 PEERTUBE_ONION_PORT=8136
44
 PEERTUBE_PORT=9004
44
 PEERTUBE_PORT=9004
45
 MESH_PEERTUBE_PORT=8500
45
 MESH_PEERTUBE_PORT=8500
46
 PEERTUBE_DIR=/etc/peertube
46
 PEERTUBE_DIR=/etc/peertube
47
-peertube_npm_version='5.3.0'
48
-peertube_node_version='8.6.0'
49
 
47
 
50
 peertube_variables=(PEERTUBE_DOMAIN_NAME
48
 peertube_variables=(PEERTUBE_DOMAIN_NAME
51
                     PEERTUBE_CODE
49
                     PEERTUBE_CODE
53
                     ONION_ONLY
51
                     ONION_ONLY
54
                     DDNS_PROVIDER
52
                     DDNS_PROVIDER
55
                     MY_USERNAME
53
                     MY_USERNAME
56
-                    ARCHITECTURE
57
                     MY_EMAIL_ADDRESS)
54
                     MY_EMAIL_ADDRESS)
58
 
55
 
59
 function peertube_create_database {
56
 function peertube_create_database {
202
     function_check set_repo_commit
199
     function_check set_repo_commit
203
     set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
200
     set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
204
 
201
 
205
-    PREV_PATH=$PATH
206
-    PATH=$(npm bin):$PATH
207
     npm run upgrade-peertube
202
     npm run upgrade-peertube
208
-    PATH=$PREV_PATH
209
-
210
     chown -R peertube:peertube $PEERTUBE_DIR
203
     chown -R peertube:peertube $PEERTUBE_DIR
211
     systemctl start peertube
204
     systemctl start peertube
212
 }
205
 }
776
     git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
769
     git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
777
     set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
770
     set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
778
 
771
 
779
-    npm install npm@$peertube_npm_version
780
-    if [ ! "$?" = "0" ]; then
781
-        echo $"Failed to install local npm version $peertube_npm_version"
782
-        exit 45465774
783
-    fi
784
-    PREV_PATH=$PATH
785
-    PATH=$(npm bin):$PATH
786
-    npm install node@$peertube_node_version
787
-    if [ ! "$?" = "0" ]; then
788
-        PATH=$PREV_PATH
789
-        echo $"Failed to install local nodejs version $peertube_node_version"
790
-        exit 54875459
791
-    fi
792
-    PATH=$PREV_PATH
793
-    npm install npm@$peertube_npm_version
794
-    if [ ! "$?" = "0" ]; then
795
-        echo $"Failed to install local npm version $peertube_npm_version"
796
-        exit 678356845684
797
-    fi
798
-    npm install yarn@1.3.2
772
+    npm install -g yarn
799
     if [ ! "$?" = "0" ]; then
773
     if [ ! "$?" = "0" ]; then
800
         echo $'Failed to install yarn'
774
         echo $'Failed to install yarn'
801
-        exit 578947946
775
+        exit 79353234
802
     fi
776
     fi
803
-    PATH=$(npm bin):$PATH
804
     yarn add -D webpack --network-concurrency 1
777
     yarn add -D webpack --network-concurrency 1
805
-    #yarn install --non-interactive
806
-    #if [ ! "$?" = "0" ]; then
807
-    #    echo $'Failed to run yarn install'
808
-    #    exit 63754235
809
-    #fi
778
+    yarn install
779
+    if [ ! "$?" = "0" ]; then
780
+        echo $'Failed to run yarn install'
781
+        exit 63754235
782
+    fi
810
     npm install
783
     npm install
811
     if [ ! "$?" = "0" ]; then
784
     if [ ! "$?" = "0" ]; then
812
-        PATH=$PREV_PATH
813
         echo $'Failed to install peertube'
785
         echo $'Failed to install peertube'
814
         exit 7835243
786
         exit 7835243
815
     fi
787
     fi
816
     npm run build
788
     npm run build
817
     if [ ! "$?" = "0" ]; then
789
     if [ ! "$?" = "0" ]; then
818
-        PATH=$PREV_PATH
819
         echo $'Failed to build peertube'
790
         echo $'Failed to build peertube'
820
         exit 5293593
791
         exit 5293593
821
     fi
792
     fi
822
-    PATH=$PREV_PATH
823
-    npm install npm@$peertube_npm_version
824
-    if [ ! "$?" = "0" ]; then
825
-        echo $"Failed to install local npm version $peertube_npm_version"
826
-        exit 678356845684
827
-    fi
828
-
829
-    # Hacky stuff to fix runtime errors
830
-    sed -i 's|const url_1 = require("url");|const url_1 = require("url").Url;|g' dist/server/helpers/core-utils.js
831
-    sed -i 's|const urlObject = new url_1.URL(url);|const urlObject = new url_1(url);|g' dist/server/helpers/core-utils.js
832
-    sed -i 's|return urlObject.href.replace.*|return urlObject.href;|g' dist/server/helpers/core-utils.js
833
 
793
 
834
     PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
794
     PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
835
 
795
 
836
-    echo '#!/bin/bash' > $PEERTUBE_DIR/start
837
-    echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/start
838
-    echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/start
839
-    echo 'npm start' >> $PEERTUBE_DIR/start
840
-    chmod +x $PEERTUBE_DIR/start
841
-
842
     echo '[Unit]' > /etc/systemd/system/peertube.service
796
     echo '[Unit]' > /etc/systemd/system/peertube.service
843
     echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service
797
     echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service
844
     echo 'After=syslog.target' >> /etc/systemd/system/peertube.service
798
     echo 'After=syslog.target' >> /etc/systemd/system/peertube.service
848
     echo 'User=peertube' >> /etc/systemd/system/peertube.service
802
     echo 'User=peertube' >> /etc/systemd/system/peertube.service
849
     echo 'Group=peertube' >> /etc/systemd/system/peertube.service
803
     echo 'Group=peertube' >> /etc/systemd/system/peertube.service
850
     echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
804
     echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
851
-    echo "ExecStart=$PEERTUBE_DIR/start" >> /etc/systemd/system/peertube.service
805
+    echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service
806
+    echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service
852
     echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
807
     echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
853
     echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
808
     echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
854
     echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
809
     echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
855
     echo 'Restart=always' >> /etc/systemd/system/peertube.service
810
     echo 'Restart=always' >> /etc/systemd/system/peertube.service
856
-    echo 'Environment=NODE_ENV=production' >> /etc/systemd/system/peertube.service
857
-    echo "Environment=NODE_CONFIG_DIR=$PEERTUBE_DIR/config" >> /etc/systemd/system/peertube.service
811
+    echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service
858
     echo '' >> /etc/systemd/system/peertube.service
812
     echo '' >> /etc/systemd/system/peertube.service
859
     echo '[Install]' >> /etc/systemd/system/peertube.service
813
     echo '[Install]' >> /etc/systemd/system/peertube.service
860
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service
814
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service

+ 1
- 1
src/freedombone-utils-nodejs Просмотреть файл

205
         npm upgrade -g n@${NODEJS_N_VERSION} --save
205
         npm upgrade -g n@${NODEJS_N_VERSION} --save
206
     fi
206
     fi
207
     if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
207
     if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
208
-        n {NODEJS_VERSION}
208
+        n ${NODEJS_VERSION}
209
     fi
209
     fi
210
     cp /usr/local/bin/n /usr/bin/n
210
     cp /usr/local/bin/n /usr/bin/n
211
     if [ -f /usr/local/bin/npm ]; then
211
     if [ -f /usr/local/bin/npm ]; then