Fast development cycles on Nuclio services#
This guide will guide you through the process of setting up Nuclio services (dashboard and controller) locally for testing your changes and provide faster development cycles.
In This Document#
Prerequisites#
Ensure that your setup includes the following prerequisite components:
Linux or OSX
Git
Docker version 19.03+
The Go toolchain (CI tests with 1.21, best use that)
Kubernetes version 1.24+ (mostly for testing) -
minikube
recommended; (you can follow the Minikube getting-started guide)Node version 10.x
Goland IDE
The guide assumes you’re running Nuclio in kubernetes. If you’re running it as a docker container, you can skip some steps.
Running Nuclio services#
(Kubernetes only) Install Nuclio CRDs. You can install them by running
test/k8s/ci_assets/install_nuclio_crds.sh
.In
hack/env
directory, createplatform_config.yaml
with the following body (you can update the example file inhack/env/platform_config.yaml.example
):
logger:
sinks:
myStdoutLoggerSink:
kind: stdout
system:
- level: debug
sink: myStdoutLoggerSink
functions:
- level: debug
sink: myStdoutLoggerSink
# Kubernetes only
kube:
kubeConfigPath: <your-home-dir>/.kube/config
containerBuilderConfiguration:
DefaultOnbuildRegistryURL: "localhost:5000"
Run local registry:
docker run --rm -d -p 5000:5000 registry:2
Run Dashboard:
In Goland - open the
dashboard-kube
run configuration. Make sure the program arguments are as follows:
--platform kube --platform-config hack/env/platform_config.yaml --namespace default --registry localhost:5000 --run-registry localhost:5000 --templates-archive-address "" --templates-git-repository "https://github.com/nuclio/nuclio-templates.git"
NOTE:
By default, when building a function image, the dashboard will try to pull the base image from the remote registry with the “latest” tag.
If you have the base image locally you can specify the env-var: NUCLIO_DASHBOARD_NO_PULL_BASE_IMAGES=true
#
If you want to run a specific Nuclio version, you can add the following flags to
Go tool aruments
in the run configuration:
-ldflags="-X github.com/v3io/version-go.label=<Nuclio-version>"
Or set the following env-var: NUCLIO_LABEL=<Nuclio-version>
Run it - see that it’s listening on port
8070
Run Controller:
In Goland - open the
contorller-kube
run configuration. Make sure the program arguments are as follows, with your own kube/config directory:
--platform-config hack/env/platform_config.yaml --namespace default --kubeconfig-path path/to/.kube/config
Run it.
Run UI:
Open
pkg/dashboard/ui
in a terminalRun:
npm install
gulp watch --dev
And make sure it’s listening on port 8000
Open
localhost:8000
in a browser and use Nuclio as you please!
Running a function locally#
We can also run a function locally, and debug the processor code using Goland.
Create a function yaml file, (This is essentially a function config, since the processor runs inside a single function. e.g for a Go function: hack/env/golang.yaml file:
meta: name: "my-func" namespace: "nuclio" spec: runtime: golang handler: nuclio:builtin readinessTimeoutSeconds: 60 logger: level: debug replicas: 1
Open
cmd/processor/main.go
and run themain
function with the following run configurations:]--config hack/env/golang.yaml --platform-config hack/env/platform_config.yaml
Run it / debug it. You can now debug the processor code, and see the function logs on the console.
You can now perform operations on the Nuclio UI and view the dashboard and controller logs live on Goland’s run console.