Plugin develop environment for BT
Install venv:
python3 -m venv venv
source venv/bin/activate
pip install -r www/server/panel/requirements.txtFor PyCharm, add class to path, then run test.py in PyCharm:
- Open
PyCharm > Settings > Project > Python Interpretertab. - Click the list of interpreters, then click
Show Allitem. - Choose the
venvand clickShow Interpreter Pathsicon. - Click
+and add thewww/server/panel/classto path.
For CLI, setup the PYTHONPATH and run test.py in CLI:
export PYTHONPATH=$(pwd)/www/server/panel/class
python test.py
#setup path: /www/serverNow you are able to develop the example plugin, or link srs-stack and develop it:
ln -sf ~/git/srs-stack/scripts/setup-bt
ln -sf ~/git/srs-stack/scripts/setup-aapanelThen, run BT docker and mount the plugin to the container.
Create a docker container in daemon:
docker rm -f bt 2>/dev/null || echo 'OK' &&
docker run -p 7800:7800 -v $(pwd)/example:/www/server/panel/plugin/example \
--privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host \
-d --rm -it -v $(pwd):/g -w /g --name=bt ossrs/bt-plugin-dev:1Note: For user in China, you can use
registry.cn-hangzhou.aliyuncs.com/ossrs/bt-plugin-dev:1instead.
Open http://localhost:7800/srsstack and login:
- Username:
ossrs - Password:
12345678
Note: Or you can use
docker exec -it bt bt defaultto show the login info.
Register a BT account and bind to the container, in the application store, there is a example plugin.
Build a image from the latest BT:
docker build --progress=plain -f Dockerfile -t bt .Copy the /www/server from the docker:
docker run --rm -it -v $(pwd):/g -w /g --name=update bt topThen, copy the /www/server to the host:
rm -rf www && mkdir www &&
docker exec -it update cp -rf /www/server /g/www/Update the permission of files:
for ((i=0;i<8;i++)); do find www -type d -exec chmod 755 "{}" \; ; done &&
find www -type f -exec chmod u+rw "{}" \; &&
find www -type f -exec chmod g+r "{}" \; &&
find www -type f -exec chmod o+r "{}" \; &&
echo OK