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 follows the standard json format.

For a complete sample of a configuration, see our sample‚Äč

Configuration Attributes

Files

An array of file locations to include into the image

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

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

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

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

Env

A dictionary/object of environment variables.

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

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

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

{
"NameServer": "10.8.0.1"
}

RunConfig

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

RunConfig.Imagename

Not Implemented

RunConfig.Ports

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

{
"RunConfig": {
"Ports": [80, 8008],
}
}

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

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

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

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

CloudConfig

The CloudConfig configures various attributes about the cloud provider, we want to use with ops.

CloudConfig.Platform

Cloud provider we want to use with ops CLI.

Currently supported platforms,

  • Google Cloud Platform gcp

  • AWS aws

{
"CloudConfig": {
"Platform": "gcp"
}
}

CloudConfig.ProjectID

Project ID in case of Google Cloud Platform provider.

{
"CloudConfig": {
"ProjectID": "proj-1000"
}
}

CloudConfig.Zone

Zone in case of Google Cloud Platform provider.

{
"CloudConfig": {
"Zone": "us-west1-b"
}
}

CloudConfig.BucketName

Bucket name is used to store Ops built image artifacts.

{
"CloudConfig": {
"BucketName": "my-bucket"
}
}

CloudConfig.ArchiveName

Not Implemented

Sample Configuration File

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