The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6611
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === I assumed it would be helpful for new contributors to have some getting-started information on setting up their development environments and using the Makefile, among other tips for new developers. If you think that any information is inaccurate or could be re-worded, please let me know. Thanks!
From 6426fb91355d81d3018a15d17aa184f7e2ff1ea7 Mon Sep 17 00:00:00 2001 From: Grayson Pike <graysonp...@gmail.com> Date: Thu, 12 Dec 2019 12:22:44 -0600 Subject: [PATCH] Include getting started section in contributing.md I assumed it would be helpful for new contributors to have some getting-started information on setting up their development environments and using the Makefile, among other tips for new developers. --- doc/contributing.md | 106 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/doc/contributing.md b/doc/contributing.md index 7a8b8ea550..aa79ef7fa3 100644 --- a/doc/contributing.md +++ b/doc/contributing.md @@ -90,3 +90,109 @@ Sorry, no pseudonyms or anonymous contributions are allowed. We also require each commit be individually signed-off by their author, even when part of a larger set. You may find `git commit -s` useful. + +## Getting Started Developing + +Follow the steps below to set up your development environment to get started working on new features for LXD. + +### Dependencies + +You will need the following packages to develop on Ubuntu: +We recommend having the latest versions of liblxc (>= 2.0.0 required) +available for LXD development. Additionally, LXD requires Golang 1.10 or +later to work. On ubuntu, you can get those with: + +```bash +sudo apt update +sudo apt install acl autoconf dnsmasq-base git golang libacl1-dev libcap-dev liblxc1 liblxc-dev libtool libuv1-dev make pkg-config rsync squashfs-tools tar tcl xz-utils ebtables +``` + +Note that when building LXC yourself, ensure to build it with the appropriate +security related libraries installed which our testsuite tests. Again, on +ubuntu, you can get those with: + +```bash +sudo apt install libapparmor-dev libseccomp-dev libcap-dev +``` + +There are a few storage backends for LXD besides the default "directory" backend. +Installing these tools adds a bit to initramfs and may slow down your +host boot, but are needed if you'd like to use a particular backend: + +```bash +sudo apt install lvm2 thin-provisioning-tools +sudo apt install btrfs-tools +``` + +To run the testsuite, you'll also need: + +```bash +sudo apt install curl gettext jq sqlite3 uuid-runtime bzr socat +``` + +### Go Environment + +You will need to develop on LXD inside of the `~/go` directory. You can make it with + +```bash +mkdir -p ~/go +``` + +You’ll also need to add the following line to your `~/.bashrc`: +```bash +export GOPATH=~/go +``` + +And `source` your `~/.bashrc` to use your new changes. + +### Cloning the Repository + +To clone the repository, you should use `go get`: + +```bash +go get -v -x -d github.com/lxc/lxd/lxc +go get -v -x -d github.com/lxc/lxd/lxd +``` + +### Building Dependencies + +Next, cd into the lxd repository and make the dependencies. To build these dependencies, the Makefile currently requires that you must be on the `origin/master` branch where the remote `origin` is the main project repository, not your fork. You may switch remotes to your fork after building dependencies. + +```bash +cd ~/go/src/github.com/lxc/lxd +make deps +``` + +This will compile LXD’s custom dependencies into your `~/go/deps`. After the script has run you will need to copy the three `export` statements provided by the make script into your `~/.bashrc`, and, of course, `source` your `~/.bashrc` again. + + +### Adding Your Fork Remote + +After building your dependencies, you can now add your GitHub fork as a remote and switch to it: +```bash +git remote add myfork g...@github.com:<your_username>/lxd.git +git remote update +git checkout myfork/master +``` + +### Building LXD + +Finally, you should be able to `make` inside the repository and build your fork of the project. + +At this point, you would most likely want to create a new branch for your changes on your fork: + +```bash +git checkout -b [name_of_your_new_branch] +git push myfork [name_of_your_new_branch] +``` + +### Important Notes for New LXD Contributors + +Persistent data is stored by default in the `/var/lib/lxd` directory, which is generated by `lxd init`. +As you develop, you may want to delete and regenerate this directory with `lxd/init` if you are making changes to persistent features of LXD. +Binaries compiled from your source will be generated in the `~/go/bin` directory by default. You will need to explicitly invoke these binaries (not the global `lxd` you may have installed) )when testing your changes. +You may choose to create an alias in your `~/.bashrc` to call these binaries with the appropriate flags more conveniently. +If you have a `/var/lib/lxd` directory present on your system from a previous installation of LXD, you may want to delete it to avoid version conflicts with your new builds of LXD. +If you have a systemd service configured to run the LXD daemon from a previous installation of LXD, you may want to disable or delete it to avoid version conflicts. + +
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel