-
Notifications
You must be signed in to change notification settings - Fork 11
OSv Init
A host perform a few task when booting. The tasks falls into the following categories:
- Network configuration - static/dhcp, dns etc.
- Environment variable
- File and directory handling - directory creation and file deletion.
- Running the application - Running the actual application with their command line arguments
After the system load the following stages are done before running the application:
- Reading the local init file
- Downloading a remote cloud init file
- Start the API for external usage
- Run the applications
The OSV init responsible for the init tasks on the system boot. It reads the init file and starts additional applications.
It also responsible for opening the API for external usage.
The OSv Init uses the API for most of its operations, it does not rely on TCP to connect to it, but would use a mediator class for direct calls.
The OSv can also receive instruction from the API. For that remote file fetch or additional file fetch are implemented as an API calls.
To support that the OSv Init holds a command queue, it will only start performing a command after the previous command was completed.
When the OSv Init execute a configuration file, it can be mark as 'once' meaning that if the same file was executed before, the command will be ignored.
The init file is a Yaml formatted file with instruction to the the OSv Init. Among the command in the file could be read a remote init file, which is a command to OSv Init itself.
Cloud init is a file that can be downloaded from a designated IP address. Cloud init in general can support multiple formats. OSv-Init will support Yaml format.
The configuration file is mostly API calls and some additional command to the OSv Init itself. The file is in a Yaml format, and the commands are performed sequential
# This is an example for a configuration file
# create a log directory
- API
command: PUT
url: /file/usr/log
parameters:
op: MKDIR
permission: 0777
- API
command: PUT
url: /env/path
parameters:
value: usr/local/bin
#fetch remote file from predetermine address
- API
command: PUT
url: /init/include
parameters:
path: 192.168.1.1/remote_file.yaml
once: True
#open httpserver for input
- API
command: PUT
url: /server
parameters:
value: start
#sleep
- Sleep
time: 100
#run an application
- API
command: PUT
url: /app/java.so
parameters:
params: -jar myjar.jar