|
1 |
| -# cbsd-mq-api |
2 |
| -Simplified API for creating and destroying CBSD virtual environments |
| 1 | +# CBSD RESTFull API |
| 2 | + |
| 3 | +Copyright (c) 2013-2021, The CBSD Development Team |
| 4 | + |
| 5 | +Homepage: https://bsdstore.ru |
| 6 | + |
| 7 | +## Description |
| 8 | + |
| 9 | +Provides a simplified API for creating and destroying CBSD virtual environments. |
| 10 | + |
| 11 | +#### Table of Contents |
| 12 | + |
| 13 | +1. [Project Description - What does the project do?](#project-description) |
| 14 | +2. [Usage - Configuration options and additional functionality](#usage) |
| 15 | +3. [Contributing - Contribute to the project](#contributing) |
| 16 | +4. [Support - Mailing List, Talks, Contacts](#support) |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | + |
| 21 | +Init: |
| 22 | + |
| 23 | +set GOPATH |
| 24 | + |
| 25 | +go get |
| 26 | +go run ./cbsd-mq-api [ -l listen] |
| 27 | + |
| 28 | + |
| 29 | +# Install |
| 30 | + |
| 31 | +mkdir -p /var/db/cbsd-api /usr/jails/var/db/api/map |
| 32 | +chown -R cbsd:cbsd /var/db/cbsd-api /usr/jails/var/db/api/map |
| 33 | + |
| 34 | +Install api.d module + enable in modules.conf, cbsd initenv. |
| 35 | + |
| 36 | +Setup api.d module: make sure |
| 37 | + |
| 38 | + "recomendation": "/usr/local/cbsd/modules/api.d/misc/recomendation.sh", |
| 39 | + "freejname": "/usr/local/cbsd/modules/api.d/misc/freejname.sh", |
| 40 | + |
| 41 | +script works (from cbsd user): chown cbsd:cbsd ~cbsd/etc/api.conf |
| 42 | + |
| 43 | +# On host |
| 44 | + |
| 45 | +1) pkg install -y sysutils/cbsd-mq-router |
| 46 | + |
| 47 | +2) setup cbsd-mq-router.json, e.g: |
| 48 | + |
| 49 | +``` |
| 50 | +{ |
| 51 | + "cbsdenv": "/usr/jails", |
| 52 | + "cbsdcolor": false, |
| 53 | + "broker": "beanstalkd", |
| 54 | + "logfile": "/dev/stdout", |
| 55 | + "beanstalkd": { |
| 56 | + "uri": "127.0.0.1:11300", |
| 57 | + "tube": "cbsd_host1_example_com", |
| 58 | + "reply_tube_prefix": "cbsd_host1_example_com_result_id", |
| 59 | + "reconnect_timeout": 5, |
| 60 | + "reserve_timeout": 5, |
| 61 | + "publish_timeout": 5, |
| 62 | + "logdir": "/var/log/cloudmq" |
| 63 | + } |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +3) service cbsd-mq-router enable |
| 68 | +4) service cbsd-mq-router start |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +Valid endpoints: |
| 73 | + |
| 74 | +``` |
| 75 | +curl -H "cid:<cid>" http://127.0.0.1:65531/api/v1/cluster |
| 76 | +curl -H "cid:<cid>" http://127.0.0.1:65531/api/v1/status/<env> |
| 77 | +curl -H "cid:<cid>" http://127.0.0.1:65531/api/v1/start/<env> |
| 78 | +curl -H "cid:<cid>" http://127.0.0.1:65531/api/v1/stop/<env> |
| 79 | +curl -H "cid:<cid>" http://127.0.0.1:65531/api/v1/destroy/<env> |
| 80 | +``` |
| 81 | + |
| 82 | +## Contributing |
| 83 | + |
| 84 | +* Fork me on GitHub: [https://github.com/cbsd/cbsd-mq-api.git](https://github.com/cbsd/cbsd-mq-api.git) |
| 85 | +* Switch to 'develop' branch |
| 86 | +* Commit your changes (`git commit -am 'Added some feature'`) |
| 87 | +* Push to the branch (`git push`) |
| 88 | +* Create new Pull Request |
| 89 | + |
| 90 | +## Support |
| 91 | + |
| 92 | +* For CBSD-related support, discussion and talks, please join to Telegram CBSD usergroup channel: @cbsdofficial |
| 93 | +* Web link: https://t.me/cbsdofficial |
| 94 | +* Or subscribe to mailing list by sending email to: [email protected] |
| 95 | +* Other contact: https://www.bsdstore.ru/en/feedback.html |
0 commit comments