2019-01-18 04:19:49 +08:00
|
|
|
# OPS
|
2018-09-12 04:07:08 +08:00
|
|
|
|
2018-12-18 05:56:53 +08:00
|
|
|
[![CircleCI](https://circleci.com/gh/nanovms/ops.svg?style=svg)](https://circleci.com/gh/nanovms/ops)
|
2018-09-15 06:44:02 +08:00
|
|
|
|
2019-02-19 07:21:20 +08:00
|
|
|
[![Go Report](https://goreportcard.com/badge/github.com/nanovms/ops)](https://goreportcard.com/badge/github.com/nanovms/ops)
|
|
|
|
|
2019-01-18 04:19:49 +08:00
|
|
|
Ops is the main interface for creating and running a Nanos unikernel. It is used to
|
|
|
|
package, create and run your application as a nanos unikernel instance.
|
|
|
|
|
|
|
|
Check out the [DOCS](https://nanovms.gitbook.io/ops/)
|
|
|
|
|
2019-01-15 01:47:36 +08:00
|
|
|
### `ops <command> [flags] [ARG]`
|
2019-02-14 05:09:51 +08:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
|
|
|
|
## Binary install
|
|
|
|
|
|
|
|
```sh
|
|
|
|
curl https://ops.city/get.sh -sSfL | sh
|
|
|
|
```
|
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
## Build and Install from source
|
2019-02-14 05:09:51 +08:00
|
|
|
|
2019-02-14 05:54:45 +08:00
|
|
|
This program requires GO Version 1.10.x or greater.
|
|
|
|
|
2019-02-14 05:09:51 +08:00
|
|
|
Installing from source follows three general steps:
|
|
|
|
|
2018-09-13 02:36:59 +08:00
|
|
|
1. Clone the repository.
|
|
|
|
2. Install dependencies:
|
|
|
|
- `make deps`
|
|
|
|
3. Build
|
|
|
|
- `make build`
|
2019-02-14 05:09:51 +08:00
|
|
|
|
|
|
|
For [detailed instructions](https://nanovms.gitbook.io/ops/developer/prerequisites) please consult the documentation.
|
|
|
|
|
2019-02-14 03:53:29 +08:00
|
|
|
# Basic usage examples
|
|
|
|
|
|
|
|
Before learning more about `ops` it is a good idea to see some basic usage
|
|
|
|
examples. Below are links to simple examples using various programming platforms:
|
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
Languages:
|
|
|
|
|
2019-02-14 03:53:29 +08:00
|
|
|
* [Golang](https://nanovms.gitbook.io/ops/basic_usage#running-golang-hello-world)
|
|
|
|
* [PHP](https://nanovms.gitbook.io/ops/basic_usage#running-php-hello-world)
|
|
|
|
* [NodeJS](https://nanovms.gitbook.io/ops/basic_usage#running-a-nodejs-script)
|
2019-02-21 02:04:37 +08:00
|
|
|
* [Lua](https://github.com/nanovms/ops-examples/tree/master/lua/01-hello-world)
|
|
|
|
* [Perl](https://github.com/nanovms/ops-examples/tree/master/perl/01-hello-world)
|
|
|
|
* [Python2.7](https://github.com/nanovms/ops-examples/tree/master/python2.7)
|
|
|
|
* [Python3.6](https://github.com/nanovms/ops-examples/tree/master/python3.6/01-hello-world)
|
|
|
|
* [Ruby2.3](https://github.com/nanovms/ops-examples/tree/master/ruby/01-hello-world)
|
|
|
|
* [Rust](https://github.com/nanovms/ops-examples/tree/master/rust/01-hello-world)
|
|
|
|
* [Scheme](https://github.com/nanovms/ops-examples/tree/master/scheme/01-hello-world)
|
2019-05-17 03:12:07 +08:00
|
|
|
* [Forth](https://github.com/nanovms/ops-examples/tree/master/forth/01-hello-world)
|
|
|
|
* [Java](https://github.com/nanovms/ops-examples/tree/master/java/01-hello-world-example)
|
|
|
|
|
|
|
|
Applications:
|
|
|
|
|
|
|
|
* Nginx
|
|
|
|
* HAProxy
|
|
|
|
* Tarantool
|
|
|
|
* Hiawatha
|
|
|
|
* Mosquitto
|
|
|
|
* Kache
|
|
|
|
* Gnatsd
|
|
|
|
* [Wasmer](https://github.com/nanovms/ops-examples/tree/master/wasm/01-hello-world)
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2018-09-22 01:02:46 +08:00
|
|
|
# Setup networking
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
New users wishing to play around in a dev environment are encouraged to
|
|
|
|
use the default user-mode networking. Other production users are
|
|
|
|
encouraged to utilize native cloud builds such as [Google
|
|
|
|
Cloud](https://nanovms.gitbook.io/ops/google_cloud) which
|
|
|
|
handle networking for you.
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
Only advanced/power users should use the bridge networking option.
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2018-09-22 01:02:46 +08:00
|
|
|
# Build a bootable image
|
2019-05-17 03:12:07 +08:00
|
|
|
`ops build <app>`
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2018-09-22 01:02:46 +08:00
|
|
|
# Package and run
|
2019-05-17 03:12:07 +08:00
|
|
|
ops run <app>
|
2018-09-22 01:02:46 +08:00
|
|
|
OR
|
2019-05-17 03:12:07 +08:00
|
|
|
ops run -p <port> <app>
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2018-10-11 02:15:41 +08:00
|
|
|
# Using a config file
|
2019-05-17 03:12:07 +08:00
|
|
|
ops run -p <port> -c <file> <app>
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2018-10-11 02:15:41 +08:00
|
|
|
# Example config file
|
2019-01-18 04:19:49 +08:00
|
|
|
|
|
|
|
ops config files are plain JSON, below is an example
|
|
|
|
|
2018-10-11 02:15:41 +08:00
|
|
|
{
|
|
|
|
"Args":["one","two"],
|
|
|
|
"Dirs":["myapp/static"]
|
|
|
|
}
|
|
|
|
|
|
|
|
## File layout on local host machine
|
|
|
|
-myapp
|
|
|
|
app
|
|
|
|
-static
|
|
|
|
-example.html
|
|
|
|
-stylesheet
|
|
|
|
-main.css
|
2019-05-17 03:12:07 +08:00
|
|
|
|
2019-01-15 01:47:36 +08:00
|
|
|
## File layout on VM
|
2018-10-11 02:15:41 +08:00
|
|
|
/myapp
|
|
|
|
app
|
|
|
|
/static
|
|
|
|
-example.html
|
|
|
|
/stylesheet
|
|
|
|
-main.css
|
2019-02-21 05:13:20 +08:00
|
|
|
|
|
|
|
## Reporting Bugs
|
|
|
|
|
|
|
|
Feel free to open up a pull request. It's helpful to have your OPS
|
|
|
|
version and the release channel you are using.
|
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
Also - if it doesn't work on the main release you can try the nightly -
|
|
|
|
the main release can tail the nightly by many weeks sometimes.
|
|
|
|
|
2019-02-21 05:13:20 +08:00
|
|
|
```
|
|
|
|
ops version
|
|
|
|
```
|
|
|
|
|
|
|
|
get the release channel (or nightly)
|
|
|
|
```
|
|
|
|
ls .ops/
|
|
|
|
```
|
|
|
|
|
|
|
|
if using a package
|
|
|
|
get the package hash:
|
|
|
|
```
|
|
|
|
cat .ops/packages/manifest.json| jq '."gnatsd_1.4.1"'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Pull Requests
|
|
|
|
|
|
|
|
If you have an idea for a new feature and it might take longer than a
|
|
|
|
few hours or days to do it's worth opening a feature request tkt to
|
|
|
|
ideate it first before jumping into code. There might be someone already
|
|
|
|
working on the feature or plans to do something entirely different.
|
|
|
|
|
|
|
|
## Security
|
|
|
|
|
2019-04-25 05:50:26 +08:00
|
|
|
[Security](https://github.com/nanovms/ops/blob/master/SECURITY.md)
|
|
|
|
|
2019-02-21 05:13:20 +08:00
|
|
|
Feel free to email security at.
|
2019-05-17 03:12:07 +08:00
|
|
|
|
|
|
|
## Support
|
|
|
|
|
|
|
|
If you are having trouble running a particular application please feel
|
|
|
|
free to open an issue and we can take a look. In general we'll only want
|
|
|
|
to support the latest release from a given application/project, however
|
|
|
|
if you really want/need support for something older there are paid
|
|
|
|
support plans available - contact the folks at https://nanovms.com .
|