Ops
Search…
Packages
Packages are officially supported images with pre-compiled languages (ie nodejs and php) or applications (ie Redis and Nginx). This makes it easier and more convenient to execute code without needing to compile your own interpreter(s).

Listing Packages

To get a list of currently supported packages, run the following command...
1
$ ops pkg list
Copied!
The package list can also be searched by simply providing a regular expression to the list command's --search option (-s for short).
1
$ ops pkg list --search ^[lr]
2
3
+-------------+---------+----------+-------------+
4
| PACKAGENAME | VERSION | LANGUAGE | DESCRIPTION |
5
+-------------+---------+----------+-------------+
6
| ruby_2.3.1 | 2.3.1 | ruby | ruby |
7
+-------------+---------+----------+-------------+
8
| lua_5.2.4 | 5.2.4 | lua | lua |
9
+-------------+---------+----------+-------------+
Copied!

Getting package locally

Package can be downloaded to the local cache ~/.ops/packages using ops get command.
1
$ ops pkg get <package_name>
Copied!

Information of Package

Package description provides common assumptions and settings required for running your application with help of package. You can get package description using ops pkg describe <package_name> command.
1
$ ops pkg describe nginx_1.15.6
2
Information for nginx_1.15.6 package:
3
Sample Readme for Nginx Application
Copied!

Contents of Package

If you want see contents of a package, you can use ops pkg contents <package_name> command.
1
$ ops pkg contents perl_5.22.1
2
File :/package.manifest
3
File :/perl
4
Dir :/sysroot
5
Dir :/sysroot/lib
6
Dir :/sysroot/lib/x86_64-linux-gnu
7
File :/sysroot/lib/x86_64-linux-gnu/libc.so.6
8
File :/sysroot/lib/x86_64-linux-gnu/libcrypt.so.1
9
File :/sysroot/lib/x86_64-linux-gnu/libdl.so.2
10
File :/sysroot/lib/x86_64-linux-gnu/libm.so.6
11
File :/sysroot/lib/x86_64-linux-gnu/libnss_dns.so.2
12
File :/sysroot/lib/x86_64-linux-gnu/libpthread.so.0
13
Dir :/sysroot/lib64
14
File :/sysroot/lib64/ld-linux-x86-64.so.2
Copied!

Removing local packages

By default, downloaded packages are stored in ~/.ops/bin/.packages. If you'd like to remove a package from your hard drive, whether its to conserve space, or to force a re-download of the package, you can do it here utilizing the rm cli tool.

Creating a Custom or Local Dev packages

then copy over an un-tarred dir to ~/.ops/local_packages
Finally you can run it via the local flag:
1
ops pkg load --local mypkg -a b.php -v
Copied!
You can use the --missing-files flag on 'ops run' to hunt down any missing shared libraries that might not be getting loaded from the ldd output. For example with ruby:
1
$ ops run --missing-files /usr/local/bin/ruby
2
booting /home/eyberg/.ops/images/ruby.img ...
3
en1: assigned 10.0.2.15
4
`RubyGems' were not loaded.
5
`did_you_mean' was not loaded.
6
missing_files_begin
7
encdb.so
8
encdb.so.rb
9
encdb.so.so
10
ansi_x3_4_1968.so
11
ansi_x3_4_1968.so.rb
12
ansi_x3_4_1968.so.so
13
rubygems.rb
14
rubygems.so
15
did_you_mean.rb
16
did_you_mean.so
17
missing_files_end
Copied!
You can also turn on '--trace' to find the locations it might be in. A common idiom would to be run:
1
$ ops run --trace /usr/local/bin/ruby &>/tmp/missing
Copied!
then grep through the output to find loads that failed.
If you wish to create your own local package you can use this as a template with your program being 'test':
1
➜ test_0.0.1 tree
2
.
3
├── package.manifest
4
├── sysroot
5
└── test
6
7
1 directory, 2 files
Copied!
At a minimum your package.manifest should have the following fields:
1
{
2
"Program":"test_0.0.1/test",
3
"Args" : ["test"],
4
"Version":"0.0.1"
5
}
Copied!
It is important to note that the Program path should be valid. If you wish you may also add Language, Runtime, Description into the manifest so they show up in the search.
These have been traditionally populated from ~/.ops/packages/manifest.json . You may also wish to include a README.md inside the package.
Then we can directly add the package in question as we develop on it:
1
ops pkg add test_0.0.1 --name test_0.0.1
Copied!
We can finally load the package:
1
ops pkg load -l test_0.0.1
Copied!

Create a Cloud Image from Local Package

Creating a cloud image from your local package is just like creating it from a regular package but you pass the '-l' flag in:
1
ops image create -c test.json -l --package c2_0.0.1 -t gcp -i mytest2
Copied!

Create a Package from Docker

You can create a local package from an existing docker container. If the container does not exist it will download it first and then convert it into a unikernel. Currently this just grabs the binary and libraries necessary to run it versus the entire filesystem that might be present.
1
$ ops pkg from-docker node:16.3.0 -f node
2
3
$ ops pkg load -l node-16.3.0 -a a.js
4
booting /Users/qtmsheep/.ops/images/program ...
5
en1: assigned 10.0.2.15
6
Hello
7
exit status 1
Copied!
Last modified 3mo ago