Calculate Forum

Установка peertube, ошибка nginx - 403 forbidden

Добрый день! Насколько я понимаю, тут можно правильно задавать вопросы, чтобы получить ответы. Установил peertube по инструкции, на шаге Откройте сайт peertube.example.org в браузере получаю страницу

403 forbidden
nginx

В лог-файле /var/log/nginx/peertube.example.com.error.log вижу такую ошибку

2020/02/17 10:01:24 [error] 10587#10587: *1 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com" (реальные ip-адрес и доменно имя заменены пустышками).

Просьба помочь исправить…

UPD. Проблема, по-видимому, в том, что в катклоге /var/calculate/www/peertube/storage пусто. Тогда такой вопрос, на каком шаге инструкции должны создаваться файлы/подкаталоги в нем?

UPD2 Кандидат на такую команду, которая создает файлы и каталоги в storage, это
cd /var/calculate/www/peertube/peertube-latest
yarn install --production --pure-lockfile

в ответ же на ее получаю

(.node-10) peertube@calculate ~/peertube-latest $ yarn install --production --pure-lockfile
yarn install v1.22.0
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > marked-man@0.7.0" has incorrect peer dependency "marked@^0.7.0".
warning " > mocha-parallel-tests@2.2.2" has incorrect peer dependency "mocha@3.0.0 - 6.x.x".
error An unexpected error occurred: "EACCES: permission denied, unlink '/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/.bin/bittorrent-tracker'".
info If you think this is a bug, please open a bug report with the information provided in "/var/calculate/www/peertube/versions/peertube-v2.1.0/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

А вы можете приложить конфиг nginx для peertube, заменив ip и доменные имена на пустышки? Если можно, то хотелось бы также увидеть файл /var/calculate/www/peertube/config/production.yaml?

   server {                                                                 
  listen 80;                                                             
  listen [::]:80;                                                        
  server_name peertube.example.com;                                      
                                                                         
  access_log /var/log/nginx/peertube.example.com.access.log;             
  error_log /var/log/nginx/peertube.example.com.error.log;               
                                                                         
  location /.well-known/acme-challenge/ {                                
    default_type "text/plain";                                           
    root /var/www/certbot;                                               
  }                                                                      
  location / { return 301 https://$host$request_uri; }                   
}          

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name peertube.example.com;

    ssl_certificate /etc/letsencrypt/live/peertube.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/peertube.example.com/privkey.pem;

 # Security hardening (as of 11/02/2018)                                
  ssl_protocols TLSv1.2; # TLSv1.3, TLSv1.2 if nginx >= 1.13.0           
  ssl_prefer_server_ciphers on;                                          
  # Remove ECDHE-RSA-AES256-SHA if you don't want compatibility with Android 4                                                                    
  ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA';                                                      
  # ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0, not compatible with import-videos script                                                 
  ssl_session_timeout  10m;                                              
  ssl_session_cache shared:SSL:10m;                                      
  ssl_session_tickets off; # Requires nginx >= 1.5.9                     
  ssl_stapling on; # Requires nginx >= 1.3.7                             
  ssl_stapling_verify on; # Requires nginx => 1.3.7                      
                                                                         
  # Configure with your resolvers                                        
  # resolver $DNS-IP-1 $DNS-IP-2 valid=300s;                             
  # resolver_timeout 5s;                                                 
                                                                         
  # Enable compression for JS/CSS/HTML bundle, for improved client load times.                                                                    
  # It might be nice to compress JSON, but leaving that out to protect against potential                                                          
  # compression+encryption information leak attacks like BREACH.         
  gzip on;                                                               
  gzip_types text/css application/javascript;                            
  gzip_vary on;                                                          
                                                                         
  # If you have a small /var/lib partition, it could be interesting to store temp nginx uploads in a different place                              
  # See https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path                                                            
  # client_body_temp_path /var/www/peertube/storage/nginx/;              
                                                                         
  # Enable HSTS                                                          
  # Tells browsers to stick with HTTPS and never visit the insecure HTTP 
  # version. Once a browser sees this header, it will only visit the site over                                                                    
  # HTTPS for the next 2 years: (read more on hstspreload.org)           
  #add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";                

 access_log /var/log/nginx/peertube.example.com.access.log;             
  error_log /var/log/nginx/peertube.example.com.error.log;               
                                                                         
  location ^~ '/.well-known/acme-challenge' {                            
    default_type "text/plain";                                           
    root /var/www/certbot;                                               
  }       

    # Bypass PeerTube for performance reasons. Could be removed
    location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ {
        add_header Cache-Control "public, max-age=31536000, immutable";
        alias /var/calculate/www/peertube/peertube-latest/client/dist/$1;
    }

  # Bypass PeerTube for performance reasons. Could be removed            
  location ~ ^/static/(thumbnails|avatars)/ {                            
    if ($request_method = 'OPTIONS') {                                   
      add_header 'Access-Control-Allow-Origin' '*';                      
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';          
      add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';                                                            
      add_header 'Access-Control-Max-Age' 1728000;                       
      add_header 'Content-Type' 'text/plain charset=UTF-8';              
      add_header 'Content-Length' 0;                                     
      return 204;                                                        
    }                                                                    
                                                                         
    add_header 'Access-Control-Allow-Origin' '*';                        
    add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';            
    add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';          

    # Cache 2 hours
    add_header Cache-Control "public, max-age=7200";
    root /var/calculate/www/peertube/storage;
    rewrite ^/static/(thumbnails|avatars)/(.*)$ /$1/$2 break;
    try_files $uri
    ...
        # Don't spam access log file with byte range requests
        access_log off;
    }
    root /var/calculate/www/peertube/storage;
    rewrite ^/static/webseed/(.*)$ /videos/$1 break;
    rewrite ^/static/redundancy/(.*)$ /redundancy/$1 break;
}

Это был /etc/nginx/sites-enabled/peertube.conf, а вот production.yaml
# Correspond to your reverse proxy server_name/listen configuration
webserver:
https: true
hostname: ‘peertube.example.com
port: 443
# Your database name will be “peertube”+database.suffix
database:
hostname: ‘localhost’
port: 5432
suffix: ‘_prod’
username: ‘peertube’
password: ‘secret’
pool:
max: 5
# SMTP server to send emails
smtp:
hostname: mail.peertube.example.com
port: 465 # If you use StartTLS: 587
username: null
password: null
tls: true # If you use StartTLS: false
disable_starttls: false
ca_file: null # Used for self signed certificates
from_address: ‘postmaster@peertube.example.com’
# From the project root directory
storage:
tmp: ‘/var/calculate/www/peertube/storage/tmp/’ # Used to download data (imports etc), store uploaded files before processing…
avatars: ‘/var/calculate/www/peertube/storage/avatars/’
videos: ‘/var/calculate/www/peertube/storage/videos/’
streaming_playlists: ‘/var/calculate/www/peertube/storage/streaming-playlists/’
redundancy: ‘/var/calculate/www/peertube/storage/videos/’
logs: ‘/var/calculate/www/peertube/storage/logs/’
previews: ‘/var/calculate/www/peertube/storage/previews/’
thumbnails: ‘/var/calculate/www/peertube/storage/thumbnails/’
torrents: ‘/var/calculate/www/peertube/storage/torrents/’
captions: ‘/var/calculate/www/peertube/storage/captions/’
cache: ‘/var/calculate/www/peertube/storage/cache/’
plugins: ‘/var/calculate/www/peertube/storage/plugins/’
admin:
# Used to generate the root user at first startup
# And to receive emails from the contact form
email: ‘pi@peertube.example.com’

Вот еще фрагмент лога yarn-error.log
Arguments:
/var/calculate/www/peertube/.node-10/bin/node /var/calculate/www/peertube/.node-10/bin/yarn install --production --pure-lockfile

PATH: 
  /var/calculate/www/peertube/.node-10/lib/node_modules/.bin:/var/calculate/www/peertube/.node-10/bin:/usr/lib/llvm/9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/games/bin

Yarn version: 
  1.22.0

Node version: 
  10.19.0

Platform: 
  linux x64

Trace: 
  Error: EACCES: permission denied, unlink '/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/.bin/bittorrent-tracker'

npm manifest: 
  {
    "name": "peertube",
    "description": "Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.",
    "version": "2.1.0",
    "private": true,
    "licence": "AGPL-3.0",
    "engines": {
      "node": ">=8.x"
    },
    "bin": {
      "peertube": "dist/server/tools/peertube.js"
    },
    "author": {
      "name": "Chocobozzz",
      "email": "chocobozzz@cpy.re",
      "url": "http://github.com/Chocobozzz"
    },
    "repository": {
      "type": "git",
      "url": "git+https://github.com/Chocobozzz/PeerTube.git"
    },
    "typings": "*.d.ts",
    "scripts": {
      "e2e": "scripty",
      "e2e:local": "scripty",
      "setup:cli": "scripty",
      "build": "scripty",
      "build:embed": "scripty",
      "build:server": "scripty",
      "build:client": "scripty",
      "clean:client": "scripty",
      "clean:server": "scripty",
      "clean:server:test": "scripty",
      "danger:clean:dev": "scripty",
      "danger:clean:prod": "scripty",
      "danger:clean:modules": "scripty",
      "i18n:generate": "scripty",
      "plugin:install": "node ./dist/scripts/plugin/install.js",
      "plugin:uninstall": "node ./dist/scripts/plugin/uninstall.js",
      "i18n:xliff2json": "node ./dist/scripts/i18n/xliff2json.js",
      "i18n:create-custom-files": "node ./dist/scripts/i18n/create-custom-files.js",
      "reset-password": "node ./dist/scripts/reset-password.js",
      "play": "scripty",
      "dev": "scripty",
      "dev:server": "sh ./scripts/dev/server.sh",
      "dev:embed": "scripty",
      "dev:client": "sh ./scripts/dev/client.sh",
      "dev:cli": "scripty",
      "start": "node dist/server",
      "start:server": "node dist/server --no-client",
      "update-host": "node ./dist/scripts/update-host.js",
      "create-transcoding-job": "node ./dist/scripts/create-transcoding-job.js",
      "create-import-video-file-job": "node ./dist/scripts/create-import-video-file-job.js",
      "test": "scripty",
      "help": "scripty",
      "generate-cli-doc": "scripty",
      "parse-log": "node ./dist/scripts/parse-log.js",
      "prune-storage": "node ./dist/scripts/prune-storage.js",
      "optimize-old-videos": "node ./dist/scripts/optimize-old-videos.js",
      "postinstall": "test -n \"$NOCLIENT\" || (cd client && yarn install --pure-lockfile)",
      "tsc": "tsc",
      "commander": "commander",
      "lint": "npm run ci -- lint",
      "ng": "ng",
      "nodemon": "nodemon",
      "ts-node": "ts-node",
      "tslint": "tslint",
      "concurrently": "concurrently",
      "mocha-parallel-tests": "mocha-parallel-tests",
      "sasslint": "sass-lint --verbose --no-exit",
      "sasslint:fix": "sass-lint-auto-fix -c .sass-lint.yml --verbose",
      "mocha": "mocha",
      "ci": "scripty",
      "release": "scripty",
      "release-embed-api": "scripty",
      "nightly": "scripty",
      "client-report": "scripty",
      "swagger-cli": "swagger-cli",
      "sass-lint": "sass-lint"
    },
    "resolutions": {
      "@types/bluebird": "3.5.27"
    },
    "dependencies": {
      "apicache": "^1.4.0",
      "async": "^3.0.1",
      "async-lru": "^1.1.1",
      "bcrypt": "3.0.7",
      "bittorrent-tracker": "^9.0.0",
      "bluebird": "^3.5.0",
      "body-parser": "^1.12.4",
      "bull": "^3.4.2",
      "bytes": "^3.0.0",
      "commander": "^4.0.1",
      "config": "^3.0.0",
      "cookie-parser": "^1.4.3",
      "cors": "^2.8.1",
      "create-torrent": "^4.0.0",
      "deep-object-diff": "^1.1.0",
      "express": "^4.12.4",
      "express-oauth-server": "^2.0.0",
      "express-rate-limit": "^4.0.4",
      "express-validator": "^6.1.1",
      "flat": "^5.0.0",
      "fluent-ffmpeg": "^2.1.0",
      "fs-extra": "^8.0.1",
      "helmet": "^3.12.1",
      "http-signature": "1.3.1",
      "ip-anonymize": "^0.1.0",
      "ipaddr.js": "1.9.1",
      "is-cidr": "^3.0.0",
      "iso-639-3": "^1.0.1",
      "js-yaml": "^3.5.4",
      "jsonld": "~2.0.1",
      "lodash": "^4.17.10",
      "lru-cache": "^5.1.1",
      "magnet-uri": "^5.1.4",
      "memoizee": "^0.4.14",
      "morgan": "^1.5.3",
      "multer": "^1.1.0",
      "nodemailer": "^6.0.0",
      "parse-torrent": "^7.0.0",
      "password-generator": "^2.0.2",
      "pem": "^1.12.3",
      "pfeed": "1.1.11",
      "pg": "^7.4.1",
      "prompt": "^1.0.0",
      "redis": "^2.8.0",
      "reflect-metadata": "^0.1.12",
      "request": "^2.81.0",
      "scripty": "^1.5.0",
      "sequelize": "5.21.3",
      "sequelize-typescript": "^1.0.0-beta.4",
      "sharp": "^0.23.3",
      "sitemap": "^5.0.0",
      "socket.io": "^2.2.0",
      "srt-to-vtt": "^1.1.2",
      "tsconfig-paths": "^3.9.0",
      "useragent": "^2.3.0",
      "uuid": "^3.1.0",
      "validator": "^12.1.0",
      "webfinger.js": "^2.6.6",
      "webtorrent": "^0.107.16",
      "winston": "3.2.1",
      "ws": "^7.0.0",
      "youtube-dl": "^2.0.0"
    },
    "devDependencies": {
      "@types/apicache": "^1.2.0",
      "@types/async": "^3.0.0",
      "@types/async-lock": "^1.1.0",
      "@types/bcrypt": "^3.0.0",
      "@types/bluebird": "3.5.21",
      "@types/body-parser": "^1.16.3",
      "@types/bull": "3.4.0",
      "@types/bytes": "^3.0.0",
      "@types/chai": "^4.0.4",
      "@types/chai-json-schema": "^1.4.3",
      "@types/chai-xml": "^0.3.1",
      "@types/config": "^0.0.36",
      "@types/express": "^4.0.35",
      "@types/express-rate-limit": "^3.3.0",
      "@types/fluent-ffmpeg": "^2.1.8",
      "@types/fs-extra": "^8.0.0",
      "@types/libxmljs": "^0.18.0",
      "@types/lodash": "^4.14.64",
      "@types/lru-cache": "^5.1.0",
      "@types/magnet-uri": "^5.1.1",
      "@types/maildev": "^0.0.1",
      "@types/memoizee": "^0.4.2",
      "@types/mkdirp": "^0.5.1",
      "@types/mocha": "^5.0.0",
      "@types/morgan": "^1.7.32",
      "@types/multer": "^1.3.3",
      "@types/node": "^10.0.8",
      "@types/nodemailer": "^6.2.0",
      "@types/oauth2-server": "^3.0.8",
      "@types/pem": "^1.9.3",
      "@types/redis": "^2.8.5",
      "@types/request": "^2.0.3",
      "@types/sharp": "^0.23.0",
      "@types/socket.io": "^2.1.2",
      "@types/supertest": "^2.0.3",
      "@types/validator": "^12.0.1",
      "@types/webtorrent": "^0.107.0",
      "@types/ws": "^6.0.0",
      "chai": "^4.1.1",
      "chai-json-schema": "^1.5.0",
      "chai-xml": "^0.3.2",
      "concurrently": "^5.0.0",
      "libxmljs": "0.19.7",
      "lint-staged": "^9.2.0",
      "maildev": "^1.0.0-rc3",
      "marked": "^0.8.0",
      "marked-man": "^0.7.0",
      "mocha": "^7.0.0",
      "mocha-parallel-tests": "^2.2.1",
      "nodemon": "^2.0.1",
      "source-map-support": "^0.5.0",
      "supertest": "^4.0.2",
      "swagger-cli": "^2.2.0",
      "ts-node": "8.5.4",
      "tslint": "^5.7.0",
      "tslint-config-standard": "^9.0.0",
      "typescript": "^3.7.2",
      "xliff": "^4.0.0"
    },
    "scripty": {
      "silent": true
    },
    "sasslintConfig": "client/.sass-lint.yml",
    "_moduleAliases": {
      "@server": "dist/server"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
  # yarn lockfile v1
  
  
  "@babel/code-frame@^7.0.0":
    version "7.5.5"
    resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d"
    integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==
    dependencies:
      "@babel/highlight" "^7.0.0"
  
  "@babel/highlight@^7.0.0":
    version "7.5.0"
    resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540"
    integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==
    dependencies:
      chalk "^2.0.0"
      esutils "^2.0.2"
      js-tokens "^4.0.0"
  
  "@nodelib/fs.scandir@2.1.3":
    version "2.1.3"
    resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
    integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==
    dependencies:
      "@nodelib/fs.stat" "2.0.3"
      run-parallel "^1.1.9"

Спасибо!

Еще фрагмент из /var/log/nginx/error_log!
2020/02/18 11:42:42 [warn] 29556#29556: no resolver defined to resolve ocsp.int-x3.letsencrypt.org while requesting certificate status, responder: ocsp.int-x3.letsencrypt.org, certificate: "/etc/letsencrypt/live/peertube.example.com/fullchain.pem"

Исправил production.yaml (в нем, кроме вышеприведенного фрагмента ничего не было, даже listen port), обратил внимание на смену имени хоста, переустановил peertube с нуля, теперь получаю ошибкку при выполнении update-host

vi /var/calculate/www/peertube/.npm/_logs/2020-02-20T03_17_51_027Z-debug.log

0 info it worked if it ends with ok                                                                                                                           
1 verbose cli [ '/var/calculate/www/peertube/.node-10/bin/node',                                                                                              
1 verbose cli   '/var/calculate/www/peertube/.node-10/bin/npm',                                                                                               
1 verbose cli   'run',                                                                                                                                        
1 verbose cli   'update-host' ]                                                                                                                               
2 info using npm@6.13.4                                                                                                                                       
3 info using node@v10.19.0                                                                                                                                    
4 verbose run-script [ 'preupdate-host', 'update-host', 'postupdate-host' ]                                                                                   
5 info lifecycle peertube@2.1.0~preupdate-host: peertube@2.1.0                                                                                                
6 info lifecycle peertube@2.1.0~update-host: peertube@2.1.0                                                                                                   
7 verbose lifecycle peertube@2.1.0~update-host: unsafe-perm in lifecycle true                                                                                 
8 verbose lifecycle peertube@2.1.0~update-host: PATH: /var/calculate/www/peertube/.node-10/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/.bin:/var/calculate/www/peertube/.node-10/lib/node_modules/.bin:/var/calculate/www/peertube/.node-10/bin:/usr/lib/llvm/9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/games/bin                                               
9 verbose lifecycle peertube@2.1.0~update-host: CWD: /var/calculate/www/peertube/versions/peertube-v2.1.0                                                     
10 silly lifecycle peertube@2.1.0~update-host: Args: [ '-c', 'node ./dist/scripts/update-host.js' ]                                                           
11 silly lifecycle peertube@2.1.0~update-host: Returned: code: 255  signal: null                                                                              
12 info lifecycle peertube@2.1.0~update-host: Failed to exec update-host script                                                                               
13 verbose stack Error: peertube@2.1.0 update-host: `node ./dist/scripts/update-host.js`                                                                      
13 verbose stack Exit status 255                                                                                                                              
13 verbose stack     at EventEmitter.<anonymous> (/var/calculate/www/peertube/.node-10/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)       
13 verbose stack     at EventEmitter.emit (events.js:198:13)                                                                                                  
13 verbose stack     at ChildProcess.<anonymous> (/var/calculate/www/peertube/.node-10/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)    
13 verbose stack     at ChildProcess.emit (events.js:198:13)                                                                                                  
13 verbose stack     at maybeClose (internal/child_process.js:982:16)                                                                                         
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)                                                                 
14 verbose pkgid peertube@2.1.0                                                                                                                               
15 verbose cwd /var/calculate/www/peertube/versions/peertube-v2.1.0                                                                                           
16 verbose Linux 5.4.12-calculate                                                                                                                             
17 verbose argv "/var/calculate/www/peertube/.node-10/bin/node" "/var/calculate/www/peertube/.node-10/bin/npm" "run" "update-host"                            
18 verbose node v10.19.0                                                                                                                                      
19 verbose npm  v6.13.4                                                                                                                                       
20 error code ELIFECYCLE                                                                                                                                      
21 error errno 255                                                                                                                                            
22 error peertube@2.1.0 update-host: `node ./dist/scripts/update-host.js`                                                                                     
22 error Exit status 255                                                                                                                                      
23 error Failed at the peertube@2.1.0 update-host script.                                                                                                     
23 error This is probably not a problem with npm. There is likely additional logging output above.                                                            
24 verbose exit [ 255, true ]                                                                                                                                 
~                                                                                                                                                             
~                                     

featherpad config/production.yaml

listen:
  hostname: 'localhost'
  port: 9000

# Correspond to your reverse proxy server_name/listen configuration
webserver:
  https: true
  hostname: 'peertube.example.com'
  port: 443

rates_limit:
  api:
    # 50 attempts in 10 seconds
    window: 10 seconds
    max: 50
  login:
    # 15 attempts in 5 min
    window: 5 minutes
    max: 15
  signup:
    # 2 attempts in 5 min (only succeeded attempts are taken into account)
    window: 5 minutes
    max: 2
  ask_send_email:
    # 3 attempts in 5 min
    window: 5 minutes
    max: 3

# Proxies to trust to get real client IP
# If you run PeerTube just behind a local proxy (nginx), keep 'loopback'
# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet)
trust_proxy:
  - 'loopback'

# Your database name will be "peertube"+database.suffix
database:
  hostname: 'localhost'
  port: 5432
  suffix: '_prod'
  username: 'peertube'
  password: 'secret'
  pool:
    max: 5

# Redis server for short time storage
# You can also specify a 'socket' path to a unix socket but first need to
# comment out hostname and port
redis:
  hostname: 'localhost'
  port: 6379
  auth: null
  db: 0

# SMTP server to send emails
smtp:
  hostname: null
  port: 465 # If you use StartTLS: 587
  username: null
  password: null
  tls: true # If you use StartTLS: false
  disable_starttls: false
  ca_file: null # Used for self signed certificates
  from_address: 'admin@example.com'

email:
  body:
    signature: "PeerTube"
  subject:
    prefix: "[PeerTube]"

# From the project root directory
storage:
#  tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before processing...
#  avatars: '/var/www/peertube/storage/avatars/'
#  videos: '/var/www/peertube/storage/videos/'
#  streaming_playlists: '/var/www/peertube/storage/streaming-playlists/'
#  redundancy: '/var/www/peertube/storage/redundancy/'
#  logs: '/var/www/peertube/storage/logs/'
#  previews: '/var/www/peertube/storage/previews/'
#  thumbnails: '/var/www/peertube/storage/thumbnails/'
#  torrents: '/var/www/peertube/storage/torrents/'
#  captions: '/var/www/peertube/storage/captions/'
#  cache: '/var/www/peertube/storage/cache/'
#  plugins: '/var/www/peertube/storage/plugins/'

  tmp: '/var/calculate/www/peertube/storage/tmp/' # Used to download data (imports etc), store uploaded files before processing...
  avatars: '/var/calculate/www/peertube/storage/avatars/'
  videos: '/var/calculate/www/peertube/storage/videos/'
  streaming_playlists: '/var/calculate/www/peertube/storage/streaming-playlists/'
  redundancy: '/var/calculate/www/peertube/storage/videos/'
  logs: '/var/calculate/www/peertube/storage/logs/'
  previews: '/var/calculate/www/peertube/storage/previews/'
  thumbnails: '/var/calculate/www/peertube/storage/thumbnails/'
  torrents: '/var/calculate/www/peertube/storage/torrents/'
  captions: '/var/calculate/www/peertube/storage/captions/'
  cache: '/var/calculate/www/peertube/storage/cache/'
  plugins: '/var/calculate/www/peertube/storage/plugins/'


log:
  level: 'info' # debug/info/warning/error
  rotation:
    enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate
    maxFileSize: 12MB
    maxFiles: 20
  anonymizeIP: false

search:
  # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
  # If enabled, the associated group will be able to "escape" from the instance follows
  # That means they will be able to follow channels, watch videos, list videos of non followed instances
  remote_uri:
    users: true
    anonymous: false

trending:
  videos:
    interval_days: 7 # Compute trending videos for the last x days

# Cache remote videos on your server, to help other instances to broadcast the video
# You can define multiple caches using different sizes/strategies
# Once you have defined your strategies, choose which instances you want to cache in admin -> manage follows -> following
redundancy:
  videos:
    check_interval: '1 hour' # How often you want to check new videos to cache
    strategies: # Just uncomment strategies you want
#      -
#        size: '10GB'
#        # Minimum time the video must remain in the cache. Only accept values > 10 hours (to not overload remote instances)
#        min_lifetime: '48 hours'
#        strategy: 'most-views' # Cache videos that have the most views
#      -
#        size: '10GB'
#        # Minimum time the video must remain in the cache. Only accept values > 10 hours (to not overload remote instances)
#        min_lifetime: '48 hours'
#        strategy: 'trending' # Cache trending videos
#      -
#        size: '10GB'
#        # Minimum time the video must remain in the cache. Only accept values > 10 hours (to not overload remote instances)
#        min_lifetime: '48 hours'
#        strategy: 'recently-added' # Cache recently added videos
#        min_views: 10 # Having at least x views

csp:
  enabled: false
  report_only: true # CSP directives are still being tested, so disable the report only mode at your own risk!
  report_uri:

tracker:
  # If you disable the tracker, you disable the P2P aspect of PeerTube
  enabled: true
  # Only handle requests on your videos.
  # If you set this to false it means you have a public tracker.
  # Then, it is possible that clients overload your instance with external torrents
  private: true
  # Reject peers that do a lot of announces (could improve privacy of TCP/UDP peers)
  reject_too_many_announces: false

history:
  videos:
    # If you want to limit users videos history
    # -1 means there is no limitations
    # Other values could be '6 months' or '30 days' etc (PeerTube will periodically delete old entries from database)
    max_age: -1

views:
  videos:
    # PeerTube creates a database entry every hour for each video to track views over a period of time
    # This is used in particular by the Trending page
    # PeerTube could remove old remote video views if you want to reduce your database size (video view counter will not be altered)
    # -1 means no cleanup
    # Other values could be '6 months' or '30 days' etc (PeerTube will periodically delete old entries from database)
    remote:
      max_age: -1

plugins:
  # The website PeerTube will ask for available PeerTube plugins and themes
  # This is an unmoderated plugin index, so only install plugins/themes you trust
  index:
    enabled: true
    check_latest_versions_interval: '12 hours' # How often you want to check new plugins/themes versions
    url: 'https://packages.joinpeertube.org'


###############################################################################
#
# From this point, all the following keys can be overridden by the web interface
# (local-production.json file). If you need to change some values, prefer to
# use the web interface because the configuration will be automatically
# reloaded without any need to restart PeerTube.
#
# /!\ If you already have a local-production.json file, the modification of the
# following keys will have no effect /!\.
#
###############################################################################

cache:
  previews:
    size: 500 # Max number of previews you want to cache
  captions:
    size: 500 # Max number of video captions/subtitles you want to cache

admin:
  # Used to generate the root user at first startup
  # And to receive emails from the contact form
  email: 'admin@example.com'

contact_form:
  enabled: true

signup:
  enabled: false
  limit: 10 # When the limit is reached, registrations are disabled. -1 == unlimited
  requires_email_verification: false
  filters:
    cidr: # You can specify CIDR ranges to whitelist (empty = no filtering) or blacklist
      whitelist: []
      blacklist: []

user:
  # Default value of maximum video BYTES the user can upload (does not take into account transcoded files).
  # -1 == unlimited
  video_quota: -1
  video_quota_daily: -1

# If enabled, the video will be transcoded to mp4 (x264) with "faststart" flag
# In addition, if some resolutions are enabled the mp4 video file will be transcoded to these new resolutions.
# Please, do not disable transcoding since many uploaded videos will not work
transcoding:
  enabled: true
  # Allow your users to upload .mkv, .mov, .avi, .flv videos
  allow_additional_extensions: true
  # If a user uploads an audio file, PeerTube will create a video by merging the preview file and the audio file
  allow_audio_files: true
  threads: 1
  resolutions: # Only created if the original video has a higher resolution, uses more storage!
    0p: false # audio-only (creates mp4 without video stream, always created when enabled)
    240p: false
    360p: false
    480p: false
    720p: false
    1080p: false
    2160p: false

  # Generate videos in a WebTorrent format (what we do since the first PeerTube release)
  # If you also enabled the hls format, it will multiply videos storage by 2
  # If disabled, breaks federation with PeerTube instances < 2.1
  webtorrent:
    enabled: true

  # /!\ Requires ffmpeg >= 4.1
  # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent:
  #     * Resolution change is smoother
  #     * Faster playback in particular with long videos
  #     * More stable playback (less bugs/infinite loading)
  # If you also enabled the webtorrent format, it will multiply videos storage by 2
  hls:
    enabled: false

import:
  # Add ability for your users to import remote videos (from YouTube, torrent...)
  videos:
    http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
      enabled: false
      # You can use an HTTP/HTTPS/SOCKS proxy with youtube-dl
      proxy:
        enabled: false
        url: ""
    torrent: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
      enabled: false

auto_blacklist:
  # New videos automatically blacklisted so moderators can review before publishing
  videos:
    of_users:
      enabled: false

# Instance settings
instance:
  name: 'PeerTube'
  short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
  description: 'Welcome to this PeerTube instance!' # Support markdown
  terms: 'No terms for now.' # Support markdown
  code_of_conduct: '' # Supports markdown

  # Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
  moderation_information: '' # Supports markdown

  # Why did you create this instance?
  creation_reason: ''

  # Who is behind the instance? A single person? A non profit?
  administrator: ''

  # How long do you plan to maintain this instance?
  maintenance_lifetime: ''

  # How will you pay the PeerTube instance server? With your own funds? With users donations? Advertising?
  business_model: ''

  # If you want to explain on what type of hardware your PeerTube instance runs
  # Example: "2 vCore, 2GB RAM..."
  hardware_information: '' # Supports Markdown

  # What are the main languages of your instance? To interact with your users for example
  # Uncomment or add the languages you want
  # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages
  languages:
#    - en
#    - es
#    - fr

  # You can specify the main categories of your instance (dedicated to music, gaming or politics etc)
  # Uncomment or add the category ids you want
  # List of supported categories: https://peertube.cpy.re/api/v1/videos/categories
  categories:
#    - 1  # Music
#    - 2  # Films
#    - 3  # Vehicles
#    - 4  # Art
#    - 5  # Sports
#    - 6  # Travels
#    - 7  # Gaming
#    - 8  # People
#    - 9  # Comedy
#    - 10 # Entertainment
#    - 11 # News & Politics
#    - 12 # How To
#    - 13 # Education
#    - 14 # Activism
#    - 15 # Science & Technology
#    - 16 # Animals
#    - 17 # Kids
#    - 18 # Food

  default_client_route: '/videos/trending'

  # Whether or not the instance is dedicated to NSFW content
  # Enabling it will allow other administrators to know that you are mainly federating sensitive content
  # Moreover, the NSFW checkbox on video upload will be automatically checked by default
  is_nsfw: false
  # By default, "do_not_list" or "blur" or "display" NSFW videos
  # Could be overridden per user with a setting
  default_nsfw_policy: 'do_not_list'

  customizations:
    javascript: '' # Directly your JavaScript code (without <script> tags). Will be eval at runtime
    css: '' # Directly your CSS code (without <style> tags). Will be injected at runtime
  # Robot.txt rules. To disallow robots to crawl your instance and disallow indexation of your site, add '/' to "Disallow:'
  robots: |
    User-agent: *
    Disallow:
  # Security.txt rules. To discourage researchers from testing your instance and disable security.txt integration, set this to an empty string.
  securitytxt:
    "# If you would like to report a security issue\n# you may report it to:\nContact: https://github.com/Chocobozzz/PeerTube/blob/develop/SECURITY.md\nContact: mailto:"

services:
  # Cards configuration to format video in Twitter
  twitter:
    username: '@Chocobozzz' # Indicates the Twitter account for the website or platform on which the content was published
    # If true, a video player will be embedded in the Twitter feed on PeerTube video share
    # If false, we use an image link card that will redirect on your PeerTube instance
    # Change it to "true", and then test on https://cards-dev.twitter.com/validator to see if you are whitelisted
    whitelisted: false

followers:
  instance:
    # Allow or not other instances to follow yours
    enabled: true
    # Whether or not an administrator must manually validate a new follower
    manual_approval: false

followings:
  instance:
    # If you want to automatically follow back new instance followers
    # If this option is enabled, use the mute feature instead of deleting followings
    # /!\ Don't enable this if you don't have a reactive moderation team /!\
    auto_follow_back:
      enabled: false

    # If you want to automatically follow instances of the public index
    # If this option is enabled, use the mute feature instead of deleting followings
    # /!\ Don't enable this if you don't have a reactive moderation team /!\
    auto_follow_index:
      enabled: false
      index_url: 'https://instances.joinpeertube.org'

theme:
  default: 'default'

После добавления IP-адреса, который должен слушать сервер PostgreSQL в формате 192.168.x.x в /etc/postgresql-12/postgresql.conf и очередной переустановки peertube с нуля (начиная с создания пользователя peertube) update-host выполнилась без ошибок

(.node-10) peertube@calculate ~/peertube-latest $ NODE_CONFIG_DIR=/var/calculate/www/peertube/config NODE_ENV=production npm run update-host

> peertube@2.1.0 update-host /var/calculate/www/peertube/versions/peertube-v2.1.0

> node ./dist/scripts/update-host.js

Updating actors.

Updating actor https://peertube.example.com/video-channels/root_channel

Updating actor https://peertube.example.com/accounts/root

Updating actor https://peertube.example.com/accounts/peertube

Updating video shares.

Updating video comments.

Updating video and torrent files.

Появилась какая-никакая структура каталогов в storage

(.node-10) peertube@calculate ~ $ ls --full storage/
итого 44
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 avatars
drwxr-xr-x 4 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 cache
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 captions
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:50.222448267 +0300 logs
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 plugins
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 previews
drwxr-xr-x 3 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 streaming-playlists
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 thumbnails
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.252448161 +0300 tmp
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 torrents
drwxr-xr-x 2 peertube peertube 4096 2020-02-20 07:05:52.253448161 +0300 videos

Однако индексного файла как не было, так и нет, и

tail /var/log/nginx/peertube.example.com.error.log 
2020/02/19 22:33:15 [error] 4286#4286: *3 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"                                                                                  
2020/02/19 23:05:28 [error] 4286#4286: *6 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"                                                                                  
2020/02/19 23:05:30 [error] 4286#4286: *6 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"                                                                                  
2020/02/19 23:05:32 [error] 4286#4286: *6 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/19 23:05:55 [error] 6604#6604: *1 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/19 23:05:58 [error] 6604#6604: *1 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/19 23:05:59 [error] 6604#6604: *1 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/19 23:06:06 [error] 6604#6604: *1 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/20 07:13:14 [error] 7964#7964: *5 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 1.2.3.4, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"
2020/02/20 07:13:19 [error] 7964#7964: *5 directory index of "/var/calculate/www/peertube/storage/" is forbidden, client: 111.222.333.444, server: peertube.example.com, request: "GET / HTTP/2.0", host: "peertube.example.com"

[Решено].
а. Исправил /etc/nginx/sites-enabled/peertube.conf (в нем еще оставалась строка “…”), и вместо ошибки 403 в браузере получил ошибку 502; в /var/log/nginx/peertube.example.com.access.log -

1.2.3.4 - - [22/Feb/2020:22:07:49 +0300] "GET / HTTP/2.0" 502 150 "-" "Mozilla/5.0 (Maemo; Linux; U; Sailfish; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0 SailfishBrowser/1.0" - - [22/Feb/2020:22:07:49 +0300] "GET / HTTP/2.0" 502 150 "-" "Mozilla/5.0 (Maemo; Linux; U; Sailfish; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0 SailfishBrowser/1.0"

а в /var/log/nginx/peertube.example.com.error.log -

2020/02/22 22:07:49 [error] 7859#7859: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 1.2.3.4, server: peertube.example.com, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:9000/", host: "peertube.example.com"

Затем

нашел файл /var/log/peertube.log , а в нем строки

> peertube@2.1.0 start /var/calculate/www/peertube/versions/peertube-v2.1.0                                                                                   
> node dist/server                                                                                                                                            
                                                                                                                                                              
[peertube.example.com:443] 2020-02-22 22:19:37.226 ^[[33mwarn^[[39m: Redundancy directory should be different than the videos folder.                   
[peertube.example.com:443] 2020-02-22 22:19:37.659 ^[[32minfo^[[39m: Database peertube_prod is ready.                                                   
[peertube.example.com:443] 2020-02-22 22:19:37.792 ^[[32minfo^[[39m: Using mail.peertube.example.com:25 as SMTP server.                           
[peertube.example.com:443] 2020-02-22 22:19:37.794 ^[[32minfo^[[39m: Testing SMTP server...                                                             
[peertube.example.com:443] 2020-02-22 22:21:37.819 ^[[31merror^[[39m: Connection timeout {                                                              
  "component": "smtp-connection",                                                                                                                             
  "sid": "CkM2BiPa5xI"                                                                                                                                        
}                                                                                                                                                             
[peertube.example.com:443] 2020-02-22 22:21:37.823 ^[[31merror^[[39m: Failed to connect to SMTP mail.peertube.example.com:25. {                   
  "err": {                                                                                                                                                    
    "stack": "Error: Connection timeout\n    at SMTPConnection._formatError (/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)\n    at SMTPConnection._onError (/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/nodemailer/lib/smtp-connection/index.js:770:20)\n    at Timeout._connectionTimeout.setTimeout (/var/calculate/www/peertube/versions/peertube-v2.1.0/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)\n    at ontimeout (timers.js:436:11)\n    at tryOnTimeout (timers.js:300:5)\n    at listOnTimeout (timers.js:263:5)\n    at Timer.processTimers (timers.js:223:10)",                                                                                                                               
    "message": "Connection timeout",                                                                                                                          
    "code": "ETIMEDOUT",                                                                                                                                      
    "command": "CONN"                                                                                                                                         
  }                                                                                                                                                           
}                                                                                                                                                             
npm ERR! code ELIFECYCLE                                                                                                                                      
npm ERR! errno 255                                                                                                                                            
npm ERR! peertube@2.1.0 start: `node dist/server`                                                                                                             
npm ERR! Exit status 255                                                                                                                                      
npm ERR!                                                                                                                                                      
npm ERR! Failed at the peertube@2.1.0 start script.                                                                                                           
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                                            
                                                                                                                                                              
npm ERR! A complete log of this run can be found in:                                                                                                          
npm ERR!     /var/calculate/www/peertube/.npm/_logs/2020-02-22T19_21_37_830Z-debug.log  

б. Заменил значение smtp hostname на null в файле /var/calculate/www/peertube/config/production.yaml

> peertube@2.1.0 start /var/calculate/www/peertube/versions/peertube-v2.1.0                                                                                   
> node dist/server                                                                                                                                            
                                                                                                                                                              
[peertube.example.com:443] 2020-02-22 22:27:37.594 ^[[33mwarn^[[39m: Emailer is disabled so the contact form will not work.                             
[peertube.example.com:443] 2020-02-22 22:27:37.597 ^[[33mwarn^[[39m: Redundancy directory should be different than the videos folder.                   
[peertube.example.com:443] 2020-02-22 22:27:38.015 ^[[32minfo^[[39m: Database peertube_prod is ready.                                                   
[peertube.example.com:443] 2020-02-22 22:27:38.159 ^[[31merror^[[39m: Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!                                                                                                                                               
[peertube.example.com:443] 2020-02-22 22:27:38.210 ^[[32minfo^[[39m: Cleaning HTML cache.                                                               
[peertube.example.com:443] 2020-02-22 22:27:38.276 ^[[32minfo^[[39m: Server listening on localhost:9000                                                 
[peertube.example.com:443] 2020-02-22 22:27:38.276 ^[[32minfo^[[39m: Web server: https://peertube.example.com
© 2007-2020 Calculate Ltd.
Mastodon Mastodon