Skip to content

Latest commit

 

History

History
173 lines (146 loc) · 3.13 KB

configuration.md

File metadata and controls

173 lines (146 loc) · 3.13 KB

Configuration

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

Configuration Attributes

Files {#files}

An array of file locations to include into the image

{
    "Files": ["ex.js"]
}

Dirs {#dirs}

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

Args {#args}

The command to execute when running the image. The expected format is an array.

{
    "Args": ["ex.js"]
}

Env {#env}

A dictionary/object of environment variables.

{
    "Env": {
        "Environment": "development",
        "NODE_DEBUG": "*"
    }
}

MapDirs {#mapdirs}

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" },
}

NameServer {#nameserver}

The DNS server to use for DNS resolution. By default it is Google's 8.8.8.8.

{
    "NameServer": "10.8.0.1"
}

RunConfig {#runconfig}

The RunConfig configures various attributes about the runtime of the ops instance, such as allocated memory and exposed ports.

RunConfig.Imagename {#runconfig.image}

Not Implemented

RunConfig.Ports {#runconfig.ports}

A list of ports to expose. Alternatively, you can also use -p in the command line.

{
    "RunConfig": {
        "Ports": [80, 8008],
    }
}
RunConfig.Verbose {#runconfig.verbose}

Enables verbose logging for the runtime environment. As of now, it prints the command used to start qemu.

{
    "RunConfig": {
        "Verbose": true
    }
}
RunConfig.Memory {#runconfig.memory}

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"
    }
}
RunConfig.Bridged {#runconfig.bridged}

Enables the use of bridged networking mode. This also enables KVM acceleration.

{
    "RunConfig": {
        "Bridged": true
    }
}

Sample Configuration File {#sample}

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"
	}
}