Skip to content

Getting started with Longhorn Development

Shuo Wu edited this page Mar 4, 2019 · 23 revisions

Setting up for Longhorn development

This page will go over setting up your environment for development work on the current version of longhorn. Since longhorn involves in system programming, it should be tested in Linux environment. If you want to use IDE such as GoLand in your MacOS, you may need to set up a linux server.

Config GoLand + remote server

Sync your code with remote server

  1. Click Tools -> Deployment -> Configuration -> “+” button

  2. Choose SFTP

  3. In Connection

    1. Host: IP address of the remote server
    2. User Name: user name of the remote host
    3. Authentication: choose Key pair, find your private key path (usually ~/.ssh/id_rsa)
    4. Root path: click Autodetect
  4. In Mappings

    1. Local path: your repo path
    2. Deployment path: the corresponding repo path on your remote host
  5. Deployment configuration completed

  6. Click Tools -> Deployment -> Options Upload changed files automatically to the default server: choose Always or On explicit save action

Warning: Since the local repo and the remote repo are different local repos from git perspective, please keep git commit operations in the same side.

Run go fmt on explict save

Click GoLand -> Preference -> Tools -> File Wathcers -> "+" button -> choose "go fmt"

Trash

Trash is a dependency management tool written by Rancher for use with rancher. You'll only need this to update your dependencies. See more info here: Trash - Go ./vendor manager

go get -u github.com/rancher/trash

Warning: Please run trash in *case sensitive file system, otherwise you may encounter "Permission denied" issues. By default, the filesystem of Mac OS is case insensitive.

Install docker

curl -L https://releases.rancher.com/install-docker/18.09.sh | sh

You can choose other version here:

install-docker supported by rancher

Then add user in 'docker' group:

sudo usermod -aG docker $USER

Install Go

Install the latest version of go

sudo add-apt-repository ppa:longsleep/golang-backports

sudo apt-get update

sudo apt-get install golang-go

You should add the gopath bin directory to your path. Add the following to your .profile or .bashrc or other shell file

export GOPATH=$HOME/go

export PATH=$PATH:$GOPATH/bin

Install open-iscsi package

sudo apt install -y open-iscsi

Install jq package

sudo apt-get install jq

Install pip for 2.7 and then python 2.7 itself

sudo apt install python-pip

sudo apt install python2.7

Clone this wiki locally