Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Local development workflow for Rio

Dax McDonald edited this page Jan 21, 2020 · 17 revisions

Thanks for helping to make Rio awesome!

Installation

Rio Controller

The majority of the code and functionality runs in the rio controller. When you do a rio install this pod is included in the install, and you can see its logs by running rio systemlogs. For local development you will instead run this controller locally.

  1. Fork and clone rio
  2. Setup a kubernetes cluster, preferably with k3s/k3d - see section below on local DNS
  3. go run main.go with environment variables KUBECONFIG and CATTLE_DEV_MODE=30. Or you can do a build: ./scripts/build && ./bin/rio-controller.

This will install everything and run your controller. Now you can follow the quick start guide in the main readme to run an app. You can easily write a script (a, b) to help automate this.

Note: rio up uses a controller image. Do the following to enable:

  • REPO=myDockerUsername TAG=dev ./scripts/build && docker build -f package/Dockerfile -t myDockerUsername/rio-controller:dev . && docker push myDockerUsername/rio-controller:dev
  • add to go build command: -ldflags " -X github.com/rancher/rio/pkg/constants.ControllerImage=myDockerUsername/rio-controller -X github.com/rancher/rio/pkg/constants.ControllerImageTag=dev"

Rio CLI

This is the primary method of interacting with Rio. You can develop on the controller using a standard release. If you are making changes to the cli and want to build and use locally:

  1. Fork and clone rio
  2. go build -i -o bin/rio cli/main.go
  3. ./bin/rio help

Local cluster on a Mac with k3d and k3s

When deploying the cluster locally, there are some additional settings required to get access to services

  1. Start k3d using port forwarding: k3d create -n rio --image rancher/k3s:v1.0.1 --api-port 6550 --publish 80:80 --publish 443:443 --publish 9443:9443 --publish 9080:9080 --workers 1
  2. Start controller with flag --ip-address=127.0.0.1
  3. Now rio info should show Cluster Domain IPs: 127.0.0.1
  4. On MacOS (possibly others) you will need to delete the traefik service to free up port 80, kubectl delete svc -n kube-system traefik