The configuration file used by ops
specifies various options and attributes
of code execution, such as files to include, arguments, and environment
variables. This file follow the standard json format.
For a complete sample of a configuration, see our sample
An array of file locations to include into the image
{
"Files": ["ex.js"]
}
An array of directory locations to include into the image
{
"Dirs": ["myapp/static"]
}
File layout on local host machine
-myapp
app
-static
-example.html
-stylesheet
-main.css
File layout on VM
/myapp
app
/static
-example.html
/stylesheet
-main.css
The command to execute when running the image. The expected format is an array.
{
"Args": ["ex.js"]
}
A dictionary/object of environment variables.
{
"Env": {
"Environment": "development",
"NODE_DEBUG": "*"
}
}
Maps a local directory to a different path on guest VM. For example the below adds all files under /etc/ssl/certs on host to /usr/lib/ssl/certs on VM.
{
"MapDirs": {"/etc/ssl/certs/*": "/usr/lib/ssl/certs" },
}
The DNS server to use for DNS resolution. By default it is Google's 8.8.8.8
.
{
"NameServer": "10.8.0.1"
}
The RunConfig
configures various attributes about the runtime of the ops
instance, such as allocated memory and exposed ports.
Not Implemented
A list of ports to expose. Alternatively, you can also use -p
in the command
line.
{
"RunConfig": {
"Ports": [80, 8008],
}
}
Enables verbose logging for the runtime environment. As of now, it prints the
command used to start qemu
.
{
"RunConfig": {
"Verbose": true
}
}
Configures the amount of memory to allocated to qemu
. Default is 128 MiB.
Optionally, a suffix of "M" or "G" can be used to signify a value in megabytes
or gigabytes respectively.
{
"RunConfig": {
"Memory": "2G"
}
}
Enables the use of bridged networking mode. This also enables KVM acceleration.
{
"RunConfig": {
"Bridged": true
}
}
Below is a sample configuration file for a nodejs application.
{
"Files": ["ex.js"],
"Dirs": ["src"],
"Args": ["ex.js "],
"Env": {
"NODE_DEBUG": "*",
"NODE_DEBUG_NATIVE": "*"
},
"MapsDirs": {
"src": "/myapp/code"
},
"Boot": "./staging/boot2.img",
"Kernel": "./staging/stage4.img",
"Mkfs": "./staging/mkfs",
"DiskImage": "disk-image",
"NameServer": "10.8.0.1",
"RunConfig": {
"Verbose": true,
"Bridged": true,
"Ports": [8008],
"Memory": "2G"
}
}