Skip to content
Don Marti edited this page Aug 28, 2014 · 37 revisions

OSv System Init

A host perform a few tasks when booting. The tasks falls into the following categories:

  1. Network configuration - static/dhcp, dns etc.
  2. Environment variable
  3. File and directory handling - directory creation and file deletion.
  4. Running the application - Running the actual application with their command line arguments

System init stages

After the system is loaded, the following stages are done before running the application:

  1. Reading the local init file
  2. Optionally, downloading a remote cloud init file
  3. Start the API for external usage
  4. Run the applications

OSV Init

The OSV init is the responsible for the init tasks on the system boot. It reads the init file and starts additional applications.

It's 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 Init can use the API even if the httpserver will not run on the system.

When the OSv Init executes a configuration file, it can be marked as 'once' meaning that the file was executed. Execution requests to files marked as once will be ignored.

Init file

The Init file is a Yaml formatted file with instruction(s) to the the OSv Init. Among the commands in the file, there could be a read request to a remote Init file, which is a command to OSv Init itself.

Cloud init

Cloud init is a file that can be downloaded from a designated IP address. Cloud init in general can support multiple formats. On OSv, it uses YAML format. For details, see the Cloud init page on the OSv wiki.

Configuration example

The init configuration file compose of API calls. The file is in a Yaml format, and the commands are performed sequentially. Each command must have a GET, PUT, POST or DELETE instruction with the proper url.

# This is an example for a configuration file
# create a log directory
- PUT: /file/usr/log
  op: MKDIRS
  permission: 0777

- PUT: /env/path
  value: usr/local/bin
# fetch remote file from a predetermined address
- GET: /include
  host: 169.254.169.254
  url: 2009-04-04/user-data
  once: true
# echo to the screen
- GET: /shel/echo
  message: Running the API

# open httpserver for input
- GET: /open-rest-api

# run an application
- PUT: /app/java.so
  params: -jar myjar.jar
Clone this wiki locally