This document is a continues WIP
#Core0/CoreX communication protocol
First process to start on bare metal. It works as a simple process manager. When starts it first configure the networking then. It also starts a local redis instance to dispatch commands to CoreX Cores.
{
"id": "command-id",
"command": "command-name",
"arguments": {}, //command arguments depends on the command itself
"queue": "optional-queue",
"stats_interval": 0, //optional stats gathering interval (falls to default if not set)
"max_time": 0, //Max run time of the command, if exceeded command will be killed
"max_restart": 0, //Max number of retries to start the command if failed before giving up
"recurring_period": 0, //If provided command is considered recurring
"log_levels": [int] //Log levels to store locally and not discard.
}
The Core0
Core understands a very specific set of management commands:
- Basic Commands
- core.ping
- core.system
- core.kill
- core.killall
- core.state
- core.reboot
- Info Query
- info.cpu
- info.disk
- info.mem
- info.nic
- info.os
- CoreX Management
- corex.create
- corex.list
- corex.dispatch
- corex.terminate
- Bridge
- bridge.create
- bridge.list
- bridge.delete
- Disk Management
- disk.list
- disk.mktable
- disk.mkpart
- disk.rmpart
- disk.mount
- disk.umount
- Btrfs Management
- btrfs.create
- btrfs.list
- btrfs.subvol_create
- btrfs.subvol_list
- btrfs.subvol_delete
Doesn't take any arguments. returns a "pong". Main use case is to check the the core is responding.
Arguments:
{
"name": "executable",
"dir": "pwd",
"args": ["command", "arguements"]
"env": {"ENV1": "VALUE1", "ENV2": "VALUE2"},
"stdin": "data to pass to executable over stdin"
}
Executes an arbitrary command
Arguments:
{
"id": "process-id-to-kill"
}
Kills a certain process giving the process ID. The process/command id is the id of the command used to start this process in the first place.
Takes no arguments Kills ALL processes on the system. (only the ones that where started by core0 itself) and still running by the time of calling this command
Takes no arguments. Returns aggregated state of all processes plus the consumption of core0 itself (cpu, memory, etc...)
Takes no arguments. Immediately reboot the machine.
Takes no arguments. Returns information about the host CPU types, speed and capabilities
Takes no arguments. Returns information about the host attached disks
Takes no arguments. Returns information about the host memory.
Takes no arguments. Returns information about the host attached nics, and IPs
Takes no arguments. Returns information about the host OS.
Arguments:
{
"plist": "http://url/to/plist",
"mount": {
"/host/directory": "/container/directory"
},
"network": {
"zerotier": "zerotier network id", //options
"bridge": [], //list of bridges names to connect to
}
//TODO:
"port": {
host_port: container_port,
}
}
Takes no arguments.
List all available live
Cores on a host.
Arguemnts:
{
"container": container_id,
}
Destroys a Core and stops the Core processes. It takes a mandatory core ID.
Arguments:
{
"container": core_id,
"command": {
//the full command payload
}
}
Arguments:
{
"name": "bridge-name", //required
"hwaddr": "MAC address" //optional
}
Creates a new bridge
takes no argumetns List all available bridges
Arguments:
{
"name": "bridge-name", //required
}
Delete the given bridge name
Takes no arguments. List all block devices (similar to lsblk)
Arguments:
{
"disk": "/dev/disk", //device
"table_type": "gpt", //partition table type
}
Creates a new partition table on device. table_type
can be any value
that is supported by parted mktable
Arguments:
{
"disk": "/dev/disk", //device
"part_type": "primary", //part_type
"start": "1", //start sector
"end": "100%", //end sector
}
Creates a partition on given device. part_type
, start
, and end
values must
be supported by the parted mkpart
command
Arguments:
{
"disk": "/dev/disk", //device
"number": 1, //parition number (1 based index)
}
Removes a partition on given device with given 1 based index.
Arguments:
{
"options": "auto", //mount options (required) if no options are needed set to "auto"
"source": "/dev/part", //patition to mount
"target": "/mnt/data", //location to mount on
}
Arguments:
{
"source": "/dev/part", //partition to umount
}
Create a btrfs filesystem
Arguments:
{
"label": "FS label/name", // required
"devices": ["/dev/sdc1", "/dev/sdc2"], // the devices, required
"data": "data profile",
"metadata": "metadata profile"
}
List all btrfs filesystems.
Takes no argument. Return array of all filesystems.
Creates a new btrfs subvolume
arguments:
{
"path": "/path/of/subvolume" required
}
List subvolume under a path
arguments:
{
"path": "/path/of/filesystem" required
}
Delete a btrfs subvolume
arguments:
{
"path": "/path/of/subvolume" required
}