-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: nuctl introduction made simple (+nuclio on docker) (#1708)
- Loading branch information
Showing
5 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Nuctl | ||
|
||
#### In this document | ||
|
||
- [About](#about) | ||
- [Download](#download) | ||
- [Usage](#usage) | ||
- [Running platform](#running-platform) | ||
- [Docker](#docker) | ||
- [Kubernetes](#kubernetes) | ||
|
||
## About | ||
|
||
Nuctl is Nuclio's command-line interface that provides you with all the nuclio features, accessible from your terminal | ||
|
||
## Download | ||
|
||
To install Nuctl all you need to do, is simply visit Nuclio [releases page](https://github.com/nuclio/nuclio/releases) | ||
and download the binary appropriate to your platform (e.g.: `darwin` if you have `macOS`) | ||
|
||
You can use the following bash snippet to download the latest nuctl release | ||
```bash | ||
curl -s https://api.github.com/repos/nuclio/nuclio/releases/latest \ | ||
| grep -i "browser_download_url.*nuctl.*$(uname)" \ | ||
| cut -d : -f 2,3 \ | ||
| tr -d \" \ | ||
| wget -O nuctl -qi - && chmod +x nuctl | ||
``` | ||
|
||
## Usage | ||
|
||
Once downloaded, an informative help section is available using `nuctl --help` | ||
|
||
## Running platform | ||
|
||
Nuctl will automatically identify its running platform, whether it is Docker or Kubernetes. | ||
|
||
To ensure you run Nuctl against a specific platform, use `--platform kube` for Kubernetes or `--platform local` for docker | ||
|
||
### Docker | ||
|
||
An example of function deployment using Nuctl against Docker can be found [here](/docs/setup/docker/getting-started-docker.md) | ||
|
||
### Kubernetes | ||
|
||
When running in Kubernetes, Nuctl would require you running a registry on your Kubernetes cluster and access to a `kubeconfig` | ||
|
||
An example of function deployment using Nuctl against a Kubernetes cluster can be found [here](/docs/setup/k8s/getting-started-k8s.md#deploy-a-function-with-the-nuclio-cli-nuctl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Getting Started with Nuclio on Docker | ||
|
||
Follow this step-by-step guide to set up a Nuclio development environment that uses Docker | ||
|
||
#### In this document | ||
|
||
- [Prerequisites](#prerequisites) | ||
- [Run Nuclio](#run-nuclio) | ||
- [Deploy a function with the Nuclio dashboard](#deploy-a-function-with-the-nuclio-dashboard) | ||
- [Deploy a function with the Nuclio CLI (nuctl)](#deploy-a-function-with-the-nuclio-cli-nuctl) | ||
- [What's next](#whats-next) | ||
|
||
## Prerequisites | ||
|
||
Before beginning with the installation, ensure that you have a [Docker](https://docker.com) daemon running. | ||
|
||
To ensure your Docker daemon is running properly, run `docker version` with the same user that will execute Nuctl commands | ||
|
||
## Run Nuclio | ||
|
||
To run nuclio on Docker, simply run the following command: | ||
|
||
```bash | ||
docker run \ | ||
--rm \ | ||
--detach \ | ||
--publish 8070:8070 \ | ||
--volume /var/run/docker.sock:/var/run/docker.sock \ | ||
--volume /tmp:/tmp \ | ||
--name nuclio-dashboard \ | ||
quay.io/nuclio/dashboard:stable-amd64 | ||
``` | ||
|
||
> NOTE: _stable_ tag refers to the latest version released by nuclio from `master` branch (unlike versioned branches, e.g.: 1.3.x) | ||
Browse to `http://localhost:8070` to explore Nuclio | ||
|
||
## Deploy a function with the Nuclio dashboard | ||
|
||
Browse to `http://localhost:8070/projects/default/create-function`. | ||
You should see the [Nuclio dashboard](/README.md#dashboard) UI. | ||
Choose one of the built-in examples and click **Deploy**. | ||
The first build will populate the local Docker cache with base images and other files, so it might take a while, depending on your network. | ||
When the function deployment is completed, you can click **Invoke** to invoke the function with a body. | ||
|
||
## Deploy a function with the Nuclio CLI (nuctl) | ||
|
||
Deploy an _HelloWorld_ example function by executing the following command: | ||
|
||
```bash | ||
nuctl deploy helloworld \ | ||
--path https://raw.githubusercontent.com/nuclio/nuclio/master/hack/examples/golang/helloworld/helloworld.go | ||
``` | ||
|
||
Once function deployment is completed, You can get the function information by running: | ||
|
||
```bash | ||
nuctl get function helloworld | ||
``` | ||
|
||
An example output: | ||
```bash | ||
NAMESPACE | NAME | PROJECT | STATE | NODE PORT | REPLICAS | ||
nuclio | helloworld | default | ready | 42089 | 1/1 | ||
``` | ||
|
||
You can see from the example output that the deployed function `helloworld` is _running_ and using port `42089`. | ||
|
||
To invoke the function, run | ||
|
||
```bash | ||
nuctl invoke helloworld --method POST --body '{"hello":"world"}' --content-type "application/json" | ||
``` | ||
|
||
An example output: | ||
|
||
```bash | ||
> Response headers: | ||
Server = nuclio | ||
Date = Thu, 18 Jun 2020 06:56:27 GMT | ||
Content-Type = application/text | ||
Content-Length = 21 | ||
|
||
> Response body: | ||
Hello, from Nuclio :] | ||
``` | ||
|
||
## What's next? | ||
|
||
See the following resources to make the best of your new Nuclio environment: | ||
|
||
- [Best Practices and Common Pitfalls](/docs/concepts/best-practices-and-common-pitfalls.md) | ||
- [Deploying functions](/docs/tasks/deploying-functions.md) | ||
- [More function examples](/hack/examples/README.md) | ||
- [References](/docs/reference) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters