2019-01-18 04:19:49 +08:00
|
|
|
# OPS
|
2018-09-12 04:07:08 +08:00
|
|
|
|
2020-01-11 11:32:13 +08:00
|
|
|
[![CircleCI](https://circleci.com/gh/nanovms/ops.svg?style=svg)](https://circleci.com/gh/nanovms/ops)
|
|
|
|
[![Go Report](https://goreportcard.com/badge/github.com/nanovms/ops)](https://goreportcard.com/report/github.com/nanovms/ops)
|
2021-07-27 22:47:12 +08:00
|
|
|
[![Go Docs](https://godoc.org/github.com/nanovms/ops?status.svg)](http://godoc.org/github.com/nanovms/ops)
|
2019-06-30 03:28:59 +08:00
|
|
|
|
2019-06-26 07:02:25 +08:00
|
|
|
<p align="center">
|
|
|
|
<img src="https://i.imgur.com/OtfAABU.png" style="width:200px;"/>
|
|
|
|
</p>
|
2019-06-26 06:52:59 +08:00
|
|
|
|
2021-03-19 05:16:09 +08:00
|
|
|
Ops is a tool for creating and running a [Nanos](https://github.com/nanovms/nanos) unikernel. It is used to
|
2019-07-17 08:27:27 +08:00
|
|
|
package, create and run your application as a [nanos](https://github.com/nanovms/nanos) unikernel instance.
|
2019-01-18 04:19:49 +08:00
|
|
|
|
|
|
|
Check out the [DOCS](https://nanovms.gitbook.io/ops/)
|
|
|
|
|
2019-02-14 05:09:51 +08:00
|
|
|
# Installation
|
|
|
|
|
2019-06-26 06:58:46 +08:00
|
|
|
Most users should just download the binary from the website:
|
|
|
|
|
2019-02-14 05:09:51 +08:00
|
|
|
## 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-06-26 06:58:46 +08:00
|
|
|
Building from source is easy if you have used Go before.
|
|
|
|
|
2020-07-24 06:07:50 +08:00
|
|
|
This program requires GO Version 1.13.x or greater.
|
2019-02-14 05:54:45 +08:00
|
|
|
|
2019-06-26 06:58:46 +08:00
|
|
|
Installing from source follows these general steps:
|
2019-02-14 05:09:51 +08:00
|
|
|
|
2019-06-26 06:58:46 +08:00
|
|
|
Install dependencies:
|
2019-06-26 07:02:25 +08:00
|
|
|
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
|
|
|
make deps
|
|
|
|
```
|
2019-06-26 07:02:25 +08:00
|
|
|
|
|
|
|
Build:
|
|
|
|
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
|
|
|
make build
|
|
|
|
```
|
2019-10-31 04:06:44 +08:00
|
|
|
|
2021-12-16 00:20:38 +08:00
|
|
|
macOS notes:
|
2019-10-31 04:06:44 +08:00
|
|
|
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
2019-10-31 04:06:44 +08:00
|
|
|
GO111MODULE=on go build -ldflags "-w"
|
|
|
|
```
|
2021-03-19 05:16:09 +08:00
|
|
|
|
2019-02-14 05:09:51 +08:00
|
|
|
For [detailed instructions](https://nanovms.gitbook.io/ops/developer/prerequisites) please consult the documentation.
|
2021-03-19 05:16:09 +08:00
|
|
|
|
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-06-26 06:52:59 +08:00
|
|
|
Let's run your first unikernel right now.
|
|
|
|
|
2019-07-12 04:06:17 +08:00
|
|
|
[![asciicast](https://asciinema.org/a/256914.svg)](https://asciinema.org/a/256914)
|
|
|
|
|
2019-06-26 06:52:59 +08:00
|
|
|
Throw this into hi.js:
|
|
|
|
|
|
|
|
```javascript
|
2021-06-21 22:17:38 +08:00
|
|
|
const http = require('http');
|
|
|
|
http.createServer((req, res) => {
|
|
|
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
2019-06-26 06:52:59 +08:00
|
|
|
res.end('Hello World\n');
|
|
|
|
}).listen(8083, "0.0.0.0");
|
|
|
|
console.log('Server running at http://127.0.0.1:8083/');
|
|
|
|
```
|
|
|
|
|
2019-06-26 06:58:46 +08:00
|
|
|
Then you can run it like so:
|
|
|
|
|
2021-07-27 22:47:12 +08:00
|
|
|
```sh
|
2021-03-08 14:42:58 +08:00
|
|
|
ops pkg load node_v11.5.0 -p 8083 -f -n -a hi.js
|
2019-06-26 06:52:59 +08:00
|
|
|
```
|
|
|
|
|
2019-11-01 08:07:56 +08:00
|
|
|
Want to push your app out to the cloud?
|
|
|
|
|
|
|
|
For Google: https://nanovms.gitbook.io/ops/google_cloud
|
|
|
|
|
|
|
|
For AWS: https://nanovms.gitbook.io/ops/aws
|
|
|
|
|
2019-05-17 03:12:07 +08:00
|
|
|
Languages:
|
|
|
|
|
2021-07-27 22:47:12 +08:00
|
|
|
Various langauge examples can be found at https://github.com/nanovms/ops-examples.
|
2019-05-17 03:12:07 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
2019-06-26 06:52:59 +08:00
|
|
|
You can always find more pre-made packages via:
|
|
|
|
|
2021-07-27 22:47:12 +08:00
|
|
|
```sh
|
2019-06-26 06:52:59 +08:00
|
|
|
ops pkg list
|
|
|
|
```
|
|
|
|
|
2022-01-04 04:27:46 +08:00
|
|
|
## Apple M1 Users
|
|
|
|
|
|
|
|
The Apple M1 and M2 are ARM based. OPS is built for users primarily
|
|
|
|
deploying to x86 based servers. While you can certainly run ARM builds
|
|
|
|
with Nanos and OPS be aware that if you are trying to run x86 builds
|
|
|
|
(the default) on ARM based M1s you won't be able to use hardware
|
|
|
|
acceleration.
|
|
|
|
|
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
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
|
|
|
ops run <app>
|
|
|
|
# or
|
|
|
|
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
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
|
|
|
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
|
|
|
|
2021-03-19 05:16:09 +08:00
|
|
|
ops config files are plain JSON, below is an example
|
2019-01-18 04:19:49 +08:00
|
|
|
|
2019-06-26 06:58:46 +08:00
|
|
|
```JSON
|
2021-03-08 14:42:58 +08:00
|
|
|
{
|
|
|
|
"Args":["one","two"],
|
|
|
|
"Dirs":["myapp/static"]
|
|
|
|
}
|
2019-06-26 06:58:46 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
## Setup networking
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Only advanced/power users should use the bridge networking option.
|
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.
|
|
|
|
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
2019-02-21 05:13:20 +08:00
|
|
|
ops version
|
|
|
|
```
|
|
|
|
|
2021-07-27 22:47:12 +08:00
|
|
|
if you are using a package, get the package hash:
|
2019-02-21 05:13:20 +08:00
|
|
|
|
2021-03-08 14:42:58 +08:00
|
|
|
```sh
|
2021-07-27 22:47:12 +08:00
|
|
|
jq '."gnatsd_1.4.1"' ~/.ops/packages/manifest.json
|
2019-02-21 05:13:20 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
## 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
|
2021-07-27 22:47:12 +08:00
|
|
|
to support the latest release from a given application/project, however,
|
2019-05-17 03:12:07 +08:00
|
|
|
if you really want/need support for something older there are paid
|
2021-07-27 22:47:12 +08:00
|
|
|
support plans available - contact the folks at https://nanovms.com.
|