English | 简体中文
Sample File: dandelion.conf.sample
First of all, you need to copy the configuration file from sample.
cp etc/dandelion/dandelion.conf.sample etc/dandelion/dandelion.conf
Generally, you should change the following values:
[DEFAULT]
debug: true
log_file: dandelion.log
log_dir: /var/log/dandelion
[cors]
origins: *
[database]
connection: mysql+pymysql://dandelion:dandelion@127.0.0.1:3306/dandelion
[mqtt]
host: 127.0.0.1
port: 1883
username: root
password: 123456
[redis]
connection: redis://root:123456@127.0.0.1:6379?db=0&socket_timeout=60&retry_on_timeout=yes
[token]
expire_seconds: 604800
At last, you can link the etc/dandelion/dandelion.conf
to the
/etc/dandelion/dandelion.conf
file.
mkdir -p /etc/dandelion
DANDELION_PATH=`pwd`
cd /etc/dandelion
ln -s ${DANDELION_PATH}/etc/dandelion/dandelion.conf dandelion.conf
Build docker image.
RELEASE_VERSION=`git rev-parse --short HEAD`_`date -u +%Y-%m-%dT%H:%M:%S%z`
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
GIT_COMMIT=`git rev-parse --verify HEAD`
docker build --no-cache --pull --force-rm --build-arg RELEASE_VERSION=${RELEASE_VERSION} --build-arg GIT_BRANCH=${GIT_BRANCH} --build-arg GIT_COMMIT=${GIT_COMMIT} -f Dockerfile -t dandelion:latest .
Run dandelion service as container.
mkdir -p /var/log/dandelion
docker run -d --name dandelion_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/dandelion/dandelion.conf:/etc/dandelion/dandelion.conf --net=host dandelion:latest
docker rm dandelion_bootstrap
docker run -d --name dandelion --restart=always -v /etc/dandelion/dandelion.conf:/etc/dandelion/dandelion.conf -v /var/log/dandelion:/var/log/dandelion --net=host dandelion:latest
Before you run the dandelion server, you need to follow the Configuration section.
tox -e venv
source .tox/venv/bin/activate
uvicorn --reload --reload-dir dandelion --port 28300 --log-level debug dandelion.main:app --host 0.0.0.0
You can visit the OpenAPI swagger document at http://127.0.0.1:28300/docs
Generate the migration script.
tox -e venv
source .tox/venv/bin/activate
alembic revision --autogenerate -m "xxxx"
Run the migration script and update the database.
tox -e venv
source .tox/venv/bin/activate
alembic upgrade head
Generate the latest swagger file.
tox -e genswagger
Generate the latest sample config file.
tox -e genconfig
Code format and style check.
tox -e pep8-format
tox -e pep8
install requirement
pip3 install gabbi
execute test
ls apitest/*.yaml | xargs gabbi-run 139.196.13.9:28300 --
ls apitest/*.yaml | xargs gabbi-run localhost:28300 --
# show verbose
gabbi-run -v all 139.196.13.9:28300 -- apitest/*.yaml
gabbi-run -v all localhost:28300 -- apitest/*.yaml
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。