--- title: 'Machine' --- # Feature ![](https://i.imgur.com/ECbE22H.png) * POST /machines * add machine * 1. Check ssh // Try ls command * 2. Join docker swarm * init IAE server swarm manager, use environment variable ADVERTISE_ADDR * join swarm * 3. Make machine path directory * 4. Set db-extractor docker * 5. Set BO Watch Host * 6. Set BO Watch docker Service * 7. Restart BO watch machine name 不可以用 "base" 會跟 bowatch 沖到,建議避開 每次IAE啟動時,init 會去list machine並且去加 bowatch 的 config 應該要不能重複建立machine 目前一啟動,會 swarm init 和 join,並且 create 一個 overlay 的 network docker network create --opt encrypted --driver overlay --attachable IAE 這邊 join 重複 join 會吐 warring 搞不清楚是無法 join 還是 join 過了,swarm 的架構要很清楚,未來這邊要丟更好的 warring message # FAQ **Q. ?** A. # Testcase ## **Add Machine** url: post /machines description: 新增機器資訊(單純資訊,不包含自動開機等動作) ### 200 success case: request body: ``` { "name": "string", "description": "description of description", "ip": "127.0.0.1", "port": "80", "username": "string", "password": "string", "key": "string", "path": "/" } ``` response: ``` { "description": "description of description", "id": "11f8aa4c-ea72-4a7e-91db-d44248310d6e", "ip": "127.0.0.1", "key": "string", "name": "string", "password": "string", "path": "/", "port": "80", "username": "string" } ``` screanshut: ![](https://i.imgur.com/N1mZZ9X.png) ![](https://i.imgur.com/8nTBiL5.png) ## **Get Machine** url: get /machines/{machineID} ## **List Machine** url: get /machines description: 列出全部或部分機器資訊 parameters: * key: 用於query機器名稱與機器描述 * limit: 一次要列出多少筆資料,若輸入-1則列出全部 * offset: 從第幾筆資料開始列出 ### 200 success case: #### default case: request URL: http://192.168.1.67:8081/api/machines response: ``` { "data": [ { "description": "", "id": "7b3ca077-51a9-4ed7-a44b-4bd4acab68ed", "ip": "192.168.1.67", "key": "", "name": "67", "password": "bigobject", "path": "/", "port": "22", "username": "cs" }, { "description": "", "id": "7b3ca077-51a9-4ed8-a44b-4bd4acab68ed", "ip": "192.168.1.68", "key": "", "name": "68", "password": "bigobject", "path": "/", "port": "22", "username": "cs" }, { "description": "test machine", "id": "00000000-0000-0000-0000-000000000000", "ip": "127.0.0.1", "key": "", "name": "test-machine", "password": "test", "path": "/", "port": "80", "username": "test" }, { "description": "description of description", "id": "11f8aa4c-ea72-4a7e-91db-d44248310d6e", "ip": "127.0.0.1", "key": "string", "name": "string", "password": "string", "path": "/", "port": "80", "username": "string" } ], "metadata": { "limit": 5, "offset": 0, "total": 4 } } ``` #### list all case(limit=-1, offset=0): request URL: http://192.168.1.67:8081/api/machines?limit=-1 response: ``` { "data": [ { "description": "", "id": "7b3ca077-51a9-4ed7-a44b-4bd4acab68ed", "ip": "192.168.1.67", "key": "", "name": "67", "password": "bigobject", "path": "/", "port": "22", "username": "cs" }, { "description": "", "id": "7b3ca077-51a9-4ed8-a44b-4bd4acab68ed", "ip": "192.168.1.68", "key": "", "name": "68", "password": "bigobject", "path": "/", "port": "22", "username": "cs" }, { "description": "test machine", "id": "00000000-0000-0000-0000-000000000000", "ip": "127.0.0.1", "key": "", "name": "test-machine", "password": "test", "path": "/", "port": "80", "username": "test" }, { "description": "description of description", "id": "11f8aa4c-ea72-4a7e-91db-d44248310d6e", "ip": "127.0.0.1", "key": "string", "name": "string", "password": "string", "path": "/", "port": "80", "username": "string" } ], "metadata": { "limit": -1, "offset": 0, "total": 4 } } ``` ## **Edit Machine** url: put /machines/{machineID} ## **Delete Machine** url: delete /machines/{machineID} # MEMO ## 10/05 ![](https://i.imgur.com/m5C8o17.png)