mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-08-07 07:14:50 +00:00
73831861438f68e098c6b7e683eea817ceab326a
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Manager for Cocos AI
Setup
Create img directory in cmd/manager. Create iso directory in cmd/manager. Save alpine-standard-3.17.2-x86_64.iso in cmd/manager/iso directory.
Run
cd to cmd/manager and run
go run main.go
This will start an HTTP server on port 9021, a gRPC server on port 7001 and will establish a connection to libvirtd.
Domain
To create a libvirt domain - basically a QEMU instance or a virtual machine (VM) - run
curl -i -X POST -H "Content-Type: application/json" localhost:9021/domain -d '{"pool":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/pool.xml", "volume":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/vol.xml", "domain":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/dom.xml"}'
If you have already created a domain, you can remove it with
virsh undefine QEmu-alpine-standard-x86_64; \
virsh shutdown QEmu-alpine-standard-x86_64; \
virsh destroy QEmu-alpine-standard-x86_64; \
rm -rf ~/go/src/github.com/ultravioletrs/manager/cmd/manager/img/boot.img; \
virsh pool-destroy --pool virtimages
This will destroy the domain together with volumes and a pool where the volume was logically stored.
Computation
To run a computation, run
curl -X POST \
http://localhost:9021/run \
-H 'Content-Type: application/json' \
-d '{
"name": "my-run",
"description": "this is a test run",
"owner": "John Doe",
"datasets": ["dataset1", "dataset2"],
"algorithms": ["algorithm1", "algorithm2"],
"dataset_providers": ["provider1", "provider2"],
"algorithm_providers": ["provider3", "provider4"],
"result_consumers": ["consumer1", "consumer2"],
"ttl": 3600
}'
Agent
sudo apt install guestfish
QCOW2_PATH=~/go/src/github.com/ultravioletrs/manager/cmd/manager/img/boot.img
HOST_AGENT_PATH=~/Development/go-playground/hello_world/main
GUEST_AGENT_PATH=/root/agent
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_PATH $GUEST_AGENT_PATH
Description
Languages
Go
95.4%
Shell
2.2%
Makefile
1.7%
Python
0.4%
Rust
0.3%