GithubHelp home page GithubHelp logo

web-logs2 / dandelion-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qiaolei1/dandelion

0.0 0.0 0.0 1.21 MB

OpenV2X Device Management - APIServer (Manage wherever the wind goes)

License: Apache License 2.0

Shell 0.14% Python 99.59% Mako 0.07% Dockerfile 0.19%

dandelion-1's Introduction

OpenV2X Device Management - APIServer

pep8 ci issue star license

English | 简体中文

Table of contents

Configuration

  • 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:[email protected]:3306/dandelion
    
    [mqtt]
    host: 127.0.0.1
    port: 1883
    username: root
    password: 123456
    
    [redis]
    connection: redis://root:[email protected]: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 && Run (Linux)

  • 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

Local Development (Linux)

Run server

  • 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

Alembic (Database Migration)

  • 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

Tox Tools

  • 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

Apitest

  • 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

Notice

  • Please run dprint fmt to format markdown files before creating PR.

dandelion-1's People

Contributors

qiaolei1 avatar dlsuqin avatar zhubx007 avatar cmycoups avatar wu-wenxiang avatar sacredartr avatar frankgty avatar srx0914 avatar

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.