-
Notifications
You must be signed in to change notification settings - Fork 11
OSv Init
A host perform a few tasks 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 is loaded, the following stages are done before running the application:
- Reading the local init file
- Optionally, 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.
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: MKDIRS
permission: 0777
- api
command: PUT
url: /env/path
parameters:
value: usr/local/bin
#fetch remote file from predetermine address
- include
host: 169.254.169.254
url: 2009-04-04/user-data
once: true
- echo
message: Running the API
#open httpserver for input
- open-rest-api
#run an application
- api
command: PUT
url: /app/java.so
parameters:
params: -jar myjar.jar