This repo discuss the Command Line Interface to Nuvolaris.
You can discuss it in the #nuvolaris-cli discord channel and in the forum under the category CLI.
NOTE This design is work in progress and incomplete - feel free to propose improvements but please document the feature and send a PR to this design BEFORE implementing the feature to avoid rejections and time wasted.
The tool nuv
built in the repo nuvolaris-cli it the Command Line interface for the Nuvolaris project.
It embeds the functionalities of the tool wsk for creating actions. As wsk is written in Go, we can directly include the code in nuv
It embeds the functionalities of the tool task for execution actions. As task is written in Go, we can directly include the code in nuv
It also adds some project conventions inspired by the nim tool. But since nim is written in typescript we do not include that code, we will reimplement them. Most notably we want to reimplement the project detection euristic described below and nothing else.
The toll works scanning the current subtree, looking for actions and packages to deploy. It works generating a Taskfile
(that can be inspected by the users) and then executing it.
It will be possible to add customizations of the task adding locally some nuvolaris.yml
in the various subdirectories. This functionality will be described later.
There will be initially 4 commands:
nuv scan
scans the folder and generate a Taskfilenuv wsk
executes the wsk subcommandnuv task
execute the task subcommandnuv install
will also be able to execute a kubectl command that deploys thenuvolaris-operator
that in turns inizialize openwhisk in any available kubernetes accessible withkubectl
and initialize the.wskprops
file used bynuv wsk
The expected workflow is that :
nuv install
installs an openwhisk cluster using a configuredkubectl
in the pathnuv scan
generates aTaskfile
nuv task
executes theTaskfile
that embeds manynuv wsk
commands- the various
nuv wsk
create then a full project
An example of a project to deploy can be this
nuv
will scan the current directory looking for a folder named packages
If it finds here a file it will create a package for each subfolder.
If it finds files in the file packages
it will deploy them as single file actions in the package default
. If it finds files in the subfolders of packages
it will deploy them as single file actions in packages named as the the subfolder. If it finds folders it will build multi file actions.
A single file actions is simply a file with an extension.
This extension can be one of the supported ones: .js
.py
.go
.java
This will cause the creation of an action with --kind nodejs:default
, --kind python:default
, --kind go:default
and --kind java:default
using the correct runtime.
The correct runtime is described by runtime.json
that can be downloaded from the api host configured.
If the extension is in format: .<version>.<extension>
it will deploy an action of --kind <language>:<version>
initial draft
A multi file action is stored in a subfolder of a subfolder of packages
.
This is expected to be a file to build
nuv
implements some heuristics to decide the correct type of the file to build.
Currently:
- if there is a
package.json
or anyjs
field in the folder then it is.js
and it builds withnpm install ; npm build
- if there is a
requirements.txt
or any.py
file then it is a python and it builds creating a virtual env as described in the python runtime documentation - if there is
pom.xml
then it builds usingmvn install
- if there is a
go.mod
then it builds usinggo build
then it will zip the folder and send as an action of the current type to the runtime.