Giter Club home page Giter Club logo

dplayer-node's Introduction

DPlayer node

Node.js backend for DPlayer

Usage

Start

docker-compose build
docker-compose pull
docker-compose up # -d for run it in the background

Data & logs

Database data: ~/dplayer/db DPlayer logs: ~/dplayer/logs PM2 logs: ~/dplayer/pm2logs

Import

mv dans.json ~/dplayer/db/backup/dans.json
docker exec dplayernode_mongo_1 mongoimport -d danmaku -c dans --file /data/db/backup/dans.json

Export

docker exec dplayernode_mongo_1 mongoexport -d danmaku -c dans -o /data/db/backup/dans.json
cat ~/dplayer/db/backup/dans.json

Stop

docker-compose stop

Communication Groups

Telegram Group

Author

DPlayer-node © DIYgod, Released under the MIT License.
Authored and maintained by DIYgod with help from contributors (list).

Blog @DIYgod · GitHub @DIYgod · Twitter @DIYgod · Telegram Channel @awesomeDIYgod

dplayer-node's People

Contributors

diygod avatar hguandl avatar kslr avatar wooln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dplayer-node's Issues

web1 start error

exec docker-compose up output log:

redis_1  | 1:M 08 Jul 15:37:26.860 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1  | 1:M 08 Jul 15:37:26.860 * DB loaded from disk: 0.000 seconds
redis_1  | 1:M 08 Jul 15:37:26.860 * Ready to accept connections
web_1    | [2018-07-08T15:37:28.135Z] PM2 log: Launching in no daemon mode
mongo_1  | 2018-07-08T15:37:28.162+0000 I STORAGE  [initandlisten] WiredTiger message [1531064248:162785][1:0x7f495e3b3a00], txn-recover: Main recovery loop: starting at 3/6912
mongo_1  | 2018-07-08T15:37:28.283+0000 I STORAGE  [initandlisten] WiredTiger message [1531064248:283646][1:0x7f495e3b3a00], txn-recover: Recovering log 3 through 4
web_1    | [2018-07-08T15:37:28.292Z] PM2 log: Starting execution sequence in -fork mode- for app name:index id:0
web_1    | [2018-07-08T15:37:28.319Z] PM2 log: App name:index id:0 online
mongo_1  | 2018-07-08T15:37:28.382+0000 I STORAGE  [initandlisten] WiredTiger message [1531064248:382178][1:0x7f495e3b3a00], txn-recover: Recovering log 4 through 4
mongo_1  | 2018-07-08T15:37:28.460+0000 I STORAGE  [initandlisten] WiredTiger message [1531064248:460439][1:0x7f495e3b3a00], txn-recover: Set global recovery timestamp: 0
mongo_1  | 2018-07-08T15:37:28.470+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
mongo_1  | 2018-07-08T15:37:28.494+0000 I CONTROL  [initandlisten]
mongo_1  | 2018-07-08T15:37:28.494+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
mongo_1  | 2018-07-08T15:37:28.494+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
mongo_1  | 2018-07-08T15:37:28.494+0000 I CONTROL  [initandlisten]
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten]
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten]
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
mongo_1  | 2018-07-08T15:37:28.495+0000 I CONTROL  [initandlisten]
mongo_1  | 2018-07-08T15:37:28.523+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
mongo_1  | 2018-07-08T15:37:28.529+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
web_1    | /usr/src/app/node_modules/koa-bodyparser/index.js:72
web_1    |   return async function bodyParser(ctx, next) {
web_1    |                ^^^^^^^^
web_1    | SyntaxError: Unexpected token function
web_1    |     at createScript (vm.js:56:10)
web_1    |     at Object.runInThisContext (vm.js:97:10)
web_1    |     at Module._compile (module.js:549:28)
web_1    |     at Object.Module._extensions..js (module.js:586:10)
web_1    |     at Module.load (module.js:494:32)
web_1    |     at tryModuleLoad (module.js:453:12)
web_1    |     at Function.Module._load (module.js:445:3)
web_1    |     at Module.require (module.js:504:17)
web_1    |     at require (internal/module.js:20:19)
web_1    |     at Object.<anonymous> (/usr/src/app/index.js:2:20)
web_1    | [2018-07-08T15:37:28.711Z] PM2 log: App [index] with id [0] and pid [15], exited with code [1] via signal [SIGINT]
web_1    | [2018-07-08T15:37:28.714Z] PM2 log: Starting execution sequence in -fork mode- for app name:index id:0
web_1    | [2018-07-08T15:37:28.724Z] PM2 log: App name:index id:0 online
web_1    | /usr/src/app/node_modules/koa-bodyparser/index.js:72
web_1    |   return async function bodyParser(ctx, next) {
web_1    |                ^^^^^^^^
web_1    | SyntaxError: Unexpected token function
web_1    |     at createScript (vm.js:56:10)
web_1    |     at Object.runInThisContext (vm.js:97:10)
web_1    |     at Module._compile (module.js:549:28)
web_1    |     at Object.Module._extensions..js (module.js:586:10)
web_1    |     at Module.load (module.js:494:32)
web_1    |     at tryModuleLoad (module.js:453:12)
web_1    |     at Function.Module._load (module.js:445:3)
web_1    |     at Module.require (module.js:504:17)
web_1    |     at require (internal/module.js:20:19)
web_1    |     at Object.<anonymous> (/usr/src/app/index.js:2:20)
web_1    | [2018-07-08T15:37:29.021Z] PM2 log: App [index] with id [0] and pid [41], exited with code [1] via signal [SIGINT]
web_1    | [2018-07-08T15:37:29.026Z] PM2 log: Starting execution sequence in -fork mode- for app name:index id:0
web_1    | [2018-07-08T15:37:29.035Z] PM2 log: App name:index id:0 online
web_1    | /usr/src/app/node_modules/koa-bodyparser/index.js:72
web_1    |   return async function bodyParser(ctx, next) {

using pm2 new version(5.x) occurs error

The Dockerfile dons't using a fixed version of pm2, RUN npm install pm2 is 5.x now, it throws the flowing error:

  | /usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:30
web_1    |     import(url.pathToFileURL(process.env.pm_exec_path));

it pass when I set it with RUN npm install [email protected] -g, the latest version about three years ago, as the same time of the latest commit of this project.

mongo_1 fail

E:\prog\DPlayer-node>docker-compose up
Recreating dplayer-node_mongo_1 ... done                                                                                              Starting dplayer-node_redis_1   ... done                                                                                              Recreating dplayer-node_web_1   ... done                                                                                              Attaching to dplayer-node_redis_1, dplayer-node_mongo_1, dplayer-node_web_1
mongo_1  | 2020-06-19T17:15:09.350+0000 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
mongo_1  | 2020-06-19T17:15:09.352+0000 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=954794ab6674
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] db version v4.2.8
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] allocator: tcmalloc
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] modules: none
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] build environment:
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten]     distmod: ubuntu1804
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten]     distarch: x86_64
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten]     target_arch: x86_64
mongo_1  | 2020-06-19T17:15:09.353+0000 I  CONTROL  [initandlisten] options: { net: { bindIp: "*" } }
mongo_1  | 2020-06-19T17:15:09.362+0000 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=483M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
mongo_1  | 2020-06-19T17:15:09.917+0000 E  STORAGE  [initandlisten] WiredTiger error (1) [1592586909:916998][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1592586909:916998][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.933+0000 E  STORAGE  [initandlisten] WiredTiger error (17) [1592586909:933079][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1592586909:933079][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists
mongo_1  | 2020-06-19T17:15:09.934+0000 I  STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.1
mongo_1  | 2020-06-19T17:15:09.936+0000 E  STORAGE  [initandlisten] WiredTiger error (1) [1592586909:936280][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1592586909:936280][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.951+0000 E  STORAGE  [initandlisten] WiredTiger error (17) [1592586909:951303][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1592586909:951303][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists
mongo_1  | 2020-06-19T17:15:09.953+0000 I  STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.2
mongo_1  | 2020-06-19T17:15:09.956+0000 E  STORAGE  [initandlisten] WiredTiger error (1) [1592586909:956054][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1592586909:956054][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.971+0000 E  STORAGE  [initandlisten] WiredTiger error (17) [1592586909:971207][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1592586909:971207][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists
mongo_1  | 2020-06-19T17:15:09.973+0000 I  STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.3
mongo_1  | 2020-06-19T17:15:09.975+0000 E  STORAGE  [initandlisten] WiredTiger error (1) [1592586909:975357][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1592586909:975357][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.989+0000 E  STORAGE  [initandlisten] WiredTiger error (17) [1592586909:989222][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1592586909:989222][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: File exists
mongo_1  | 2020-06-19T17:15:09.990+0000 I  STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.4
mongo_1  | 2020-06-19T17:15:09.993+0000 E  STORAGE  [initandlisten] WiredTiger error (1) [1592586909:993144][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1592586909:993144][1:0x7fc996703b00], connection: __posix_open_file, 667: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.995+0000 W  STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.
mongo_1  | 2020-06-19T17:15:09.996+0000 F  STORAGE  [initandlisten] Reason: 1: Operation not permitted
mongo_1  | 2020-06-19T17:15:09.996+0000 F  -        [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 915
mongo_1  | 2020-06-19T17:15:09.996+0000 F  -        [initandlisten]
mongo_1  |
mongo_1  | ***aborting after fassert() failure
mongo_1  |
mongo_1  |
redis_1  | 1:C 19 Jun 2020 17:15:02.759 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1  | 1:C 19 Jun 2020 17:15:02.759 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1  | 1:C 19 Jun 2020 17:15:02.759 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * Running mode=standalone, port=6379.
redis_1  | 1:M 19 Jun 2020 17:15:02.761 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1  | 1:M 19 Jun 2020 17:15:02.761 # Server initialized
redis_1  | 1:M 19 Jun 2020 17:15:02.761 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * Loading RDB produced by version 6.0.5
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * RDB age 36 seconds
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * RDB memory usage when created 0.77 Mb
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * DB loaded from disk: 0.000 seconds
redis_1  | 1:M 19 Jun 2020 17:15:02.761 * Ready to accept connections
dplayer-node_mongo_1 exited with code 14
web_1    | 2020-06-19T17:15:18: PM2 log: Launching in no daemon mode
web_1    | 2020-06-19T17:15:18: PM2 log: App [index:0] starting in -fork mode-
web_1    | 2020-06-19T17:15:18: PM2 log: App [index:0] online
web_1    | info: 🎉 DPlayer start! Cheers!
web_1    | info: Listening Port 1207
web_1    | info: Redis connected
web_1    | error: Mongodb error:  {"name":"MongoNetworkError"}
web_1    | { MongoNetworkError: failed to connect to server [mongo:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mongo mongo:27017]
web_1    |     at Pool.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:505:11)
web_1    |     at emitOne (events.js:116:13)
web_1    |     at Pool.emit (events.js:211:7)
web_1    |     at Connection.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:329:12)
web_1    |     at Object.onceWrapper (events.js:317:30)
web_1    |     at emitTwo (events.js:126:13)
web_1    |     at Connection.emit (events.js:214:7)
web_1    |     at Socket.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/connection.js:245:50)
web_1    |     at Object.onceWrapper (events.js:315:30)
web_1    |     at emitOne (events.js:116:13)
web_1    |     at Socket.emit (events.js:211:7)
web_1    |     at emitErrorNT (internal/streams/destroy.js:73:8)
web_1    |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
web_1    |     at process._tickCallback (internal/process/next_tick.js:181:9)
web_1    |   name: 'MongoNetworkError',
web_1    |   message: 'failed to connect to server [mongo:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mongo mongo:27017]' }



能否提供以下mongo的初始化脚本

已经有mongo和redis了,想放在一起,现在pm2直接启动连接报这个错

0|index  | error: Promise error: TypeError: Cannot read property 'cid' of undefined
0|index  |     at module.exports (/server/DPlayer-node/routes/bilibili.js:13:29)
0|index  |     at processTicksAndRejections (internal/process/task_queues.js:97:5)
0|index  |     at async module.exports (/server/DPlayer-node/middleware/access-control.js:12:9)
0|index  |     at async module.exports (/server/DPlayer-node/middleware/header.js:13:5)
0|index  |     at async module.exports (/server/DPlayer-node/middleware/onerror.js:5:9)
0|index  |     at async bodyParser (/server/DPlayer-node/node_modules/koa-bodyparser/index.js:86:5)
0|index  | info: /v3/, user IP: ::ffff:192.168.1.10


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.