Open xmonader opened 3 years ago
Currently, the server is supporting the following:
twinserver.twins.create
'{"ip": "<yggdrasil ip>"}'
twinserver.twins.get
payload: '{"id": <twin id>}'
twinserver.twins.list
payload: ''
twinserver.twins.delete
payload: '{"id": <twin id>}'
twinserver.contracts.create
'{"node_id": "<zos node id>", "hash": "<deployment challenge hash>", "data": "<deployment data>", "public_ip": <number of public IPs>}'
twinserver.contracts.get
payload: '{"id": <contract id>}'
twinserver.contracts.update
payload: '{"id": <contract id>, "hash": "<deployment challenge hash>", "data": "<deployment data>"}'
twinserver.contracts.cancel
payload: '{"id": <contract id>}'
twinserver.zos.deploy
payload: the same as zos deployment without signing with additional parameters '{"node_id": <zos node id> }'
Note: node_id
will be optional when the grid3_proxy_server is ready to be used.twinserver.machine.deploy
payload:
{
"node_id": 5,
"disks": [
{
"name": "hamadadisk",
"size": 10,
"mountpoint": "/hamada"
}
],
"network": {
"ip_range": "10.200.0.0/16",
"name": "hamada"
},
"public_ip": true,
"cpu": 1,
"memory": 1024,
"name": "hamada",
"flist": "https://hub.grid.tf/tf-official-apps/base:latest.flist",
"entrypoint": "/sbin/zinit init",
"metadata": "",
"description": "",
"env": {
"SSH_KEY": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmm8OzLt+lTdGaMUwMFcw0P+vr+a/h/UsR//EzzeQsgNtC0bdls4MawVEhb3hNcycEQNd2P/+tXdLC4qcaJ6iABYip4xqqAeY098owGDYhUKYwmnMyo+NwSgpjZs8taOhMxh5XHRI+Ifr4l/GmzbqExS0KVD21PI+4sdiLspbcnVBlg9Eg9enM///zx6rSkulrca/+MnSYHboC5+y4XLYboArD/gpWy3zwIUyxX/1MjJwPeSnd5LFBIWvPGrm3cl+dAtADwTZRkt5Yuet8y5HI73Q5/NSlCdYXMtlsKBLpJu3Ar8nz1QfSQL7dB8pa7/sf/s8wO17rXqWQgZG6JzvZ root@ahmed-Inspiron-3576"
}
}
Note: disk size in GB, memory in MB, disk name should be different than the machine name
single master and multiple workers.
twinserver.k8s.deploy
payload:
{
"name": "mon69t5",
"secret": "hamadaellol",
"network": {
"name": "hamadanet",
"ip_range": "10.201.0.0/16"
},
"masters": [
{
"name": "master1",
"node_id": 3,
"cpu": 1,
"memory": 1024,
"disk_size": 15,
"public_ip": true
}
],
"workers": [
{
"name":"worker1" ,
"node_id": 2,
"cpu": 1,
"memory": 1024,
"disk_size": 15,
"public_ip": false
}
],
"metadata": "",
"description": "",
"ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmm8OzLt+lTdGaMUwMFcw0P+vr+a/h/UsR//EzzeQsgNtC0bdls4MawVEhb3hNcycEQNd2P/+tXdLC4qcaJ6iABYip4xqqAeY098owGDYhUKYwmnMyo+NwSgpjZs8taOhMxh5XHRI+Ifr4l/GmzbqExS0KVD21PI+4sdiLspbcnVBlg9Eg9enM///zx6rSkulrca/+MnSYHboC5+y4XLYboArD/gpWy3zwIUyxX/1MjJwPeSnd5LFBIWvPGrm3cl+dAtADwTZRkt5Yuet8y5HI73Q5/NSlCdYXMtlsKBLpJu3Ar8nz1QfSQL7dB8pa7/sf/s8wO17rXqWQgZG6JzvZ root@ahmed-Inspiron-3576"
}
Note: disk size in GB, memory in MB, masters and workers names should be different
twinserver.zdbs.deploy
payload:
{
"name": "hamada",
"zdbs": [{
"name": "zdb1",
"node_id": 3,
"mode": "seq",
"disk_size": 10,
"disk_type": "hdd",
"public": true,
"namespace": "hamadaspace",
"password": "hamadaellol",
}, {
"name": "zdb2",
"node_id": 3,
"mode": "seq",
"disk_size": 10,
"disk_type": "hdd",
"public": true,
"namespace": "hamadaspace",
"password": "hamadaellol",
}],
"metadata": "",
"description": ""
}
Note: disk size in GB, zdb names should be different
The twin server now stores the deployments (machines, k8s, zdb)
Also get and delete methods are add on the server
cmds: [
twinserver.machine.get
,
twinserver.k8s.get
,
twinserver.zdbs.get
,
twinserver.machine.delete
,
twinserver.k8s.delete
,
twinserver.zdbs.delete
]
all with payload: {"name": "<deployment name>"}
The server now handles network updates which allow deploying more than one machine on different nodes.
Also, a list method is added for machines, k8s, and zdbs.
cmds: [
twinserver.machine.list
,
twinserver.k8s.list
,
twinserver.zdbs.list
]
all with empty string payload
some methods added
Add zdb
cmd: twinserver.zdbs.add_zdb
payload:
{
"deployment_name": "sun199t1",
"name": "hamada1",
"node_id": 2,
"mode": "seq",
"disk_size": 10,
"disk_type": "hdd",
"public": true,
"namespace": "hamadaspace",
"password": "hamada12345",
}
Delete zdb
cmd: twinserver.zdbs.delete_zdb
payload:
{
"deployment_name": "sun199t1",
"name": "hamada1",
}
Add worker
cmd: twinserver.k8s.add_worker
payload:
{
"deployment_name": "sun199t2",
"name": "sun199t1worker5",
"node_id": 5,
"cpu": 2,
"memory": 1024,
"disk_size": 15,
"public_ip": false
}
Delete worker
cmd: twinserver.k8s.delete_worker
payload:
{
"deployment_name": "sun199t2",
"name": "sun199t1worker5",
}
twin server 1.0
based on node.js rich ecosystem, we provide all necessary grid primitives and expose them over message bus
the functionality exposed in this version should cover the following
the primtives should be covered (zdb, disk, vm, public ip) and a higher level abstraction for kubernetes
and the needed interactions with substrate in the form of
vlang client
Build a client in vlang that uses that twin server to create deployments on the grid.