Original link: https://blog.saky.site/post/ninja-install/
Ninja only supports qinglong 2.8.2+
DEMO: https://jd.moelove.tk/ (can be used directly)
inside the container
-
The container maps port 5701 and the ninja directory to the host (host Qinglong does not need this step, just jump to step 2)
Example (docker-compose):
version: "3" services: qinglong: image: whyour/qinglong:latest container_name: qinglong restart: unless-stopped tty: true ports: - 5700:5700 + - 5701:5701 environment: - ENABLE_HANGUP=true - ENABLE_WEB_PANEL=true volumes: - ./config:/ql/config - ./log:/ql/log - ./db:/ql/db - ./repo:/ql/repo - ./raw:/ql/raw - ./scripts:/ql/scripts - ./jbot:/ql/jbot + - ./ninja:/ql/ninja
Example (docker-run):
docker run -dit \ -v $PWD/ql/config:/ql/config \ -v $PWD/ql/log:/ql/log \ -v $PWD/ql/db:/ql/db \ -v $PWD/ql/repo:/ql/repo \ -v $PWD/ql/raw:/ql/raw \ -v $PWD/ql/scripts:/ql/scripts \ -v $PWD/ql/jbot:/ql/jbot \ + -v $PWD/ql/ninja:/ql/ninja \ -p 5700:5700 \ + -p 5701:5701 \ --name qinglong \ --hostname qinglong \ --restart unless-stopped \ whyour/qinglong:latest
-
Execute the following command inside the container
Execute the following command inside the container
git clone https://ghproxy.com/https://github.com/MoonBegonia/ninja.git /ql/ninja cd /ql/data/ninja/backend pnpm install pm2 start cp sendNotify.js /ql/scripts/sendNotify.js
-
Paste the following into
extra.sh
(auto-update and start Ninja after reboot)cd /ql/data/ninja/backend git checkout . git pull pnpm install pm2 start cp sendNotify.js /ql/scripts/sendNotify.js
outside the container
This method requires the host to install node
pnpm
and other environments, so I won’t introduce it too much.
If you use this method, you can’t start with Qinglong, and you can’t send scan code notifications , please be aware.
git clone git clone https://ghproxy.com/https://github.com/MoonBegonia/ninja.git cd ninja/backend pnpm install # 复制sendNotify.js 到容器内scripts 目录,`qinglong` 为容器名sudo docker cp sendNotify.js qinglong:/ql/scripts/sendNotify.js cp .env.example .env # 修改env文件vi .env node app.js
Add the following to your .env
file:
QL_DIR=qinglong 容器的本地路径QL_URL=http://localhost:5700
node app.js
want to run in the background can use commands like &
nohup
screen
.
Ninja environment variables
Currently supported environment variables are:
-
ALLOW_ADD
: Whether to allow adding an account or not, only allow existing accounts to log in if adding is not allowed (defaulttrue
) -
ALLOW_NUM
: the maximum number of accounts allowed to be added (default40
) -
NINJA_PORT
: Ninja running port (default5701
) -
NINJA_NOTIFY
: Whether to enable the notification function (defaulttrue
) -
NINJA_UA
: custom UA, default is random
Configuration method:
cd /ql/ninja/backend cp .env.example .env vi .env pm2 start
After the modification is completed, pm2 start
is required to restart to take effect! ! !
SendNotify environment variable
This environment variable is configured in Qinglong! ! !
-
NOTIFY_SKIP_LIST
: Notification blacklist, separated by&
, such as东东乐园&东东萌宠
;
Ninja custom
Custom push QR code: add the push.jpg
file to the /ql/ninja/backend/static/
directory and refresh the web page.
Customize common activities: modify /ql/backend/static/activity.json
Precautions
-
Be sure to execute a
ql extra
after restarting to ensure that Ninja is successfully configured. -
To update Ninja just do a
git pull
in theninja/backend
directory in the container and thenpm2 start
-
Qinglong needs to be in the login state (there is a token in
auth.json
)
common problem
Q: Why did my git pull
fail?
A: Generally, if the file has been modified, first run git checkout .
Then git pull
. If it still doesn’t work, delete it.
Q: Why can’t I access it?
A: Usually port mapping error/failure, please check the configuration file by yourself.
Q: Why access the white screen?
A: Use a modern browser, not an ancient one.
This article is reprinted from: https://blog.saky.site/post/ninja-install/
This site is for inclusion only, and the copyright belongs to the original author.