Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Make a separate section for developers #167

Merged
merged 4 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![lockc](/images/logo-horizontal-lockc.png)
![lockc](https://rancher-sandbox.github.io/lockc/images/logo-horizontal-lockc.png)

# Introduction

Expand Down
16 changes: 9 additions & 7 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
- [Containers do not contain](containers-do-not-contain.md)
- [Architecture](architecture.md)
- [Getting started](configuration.md)
- [Build](build/README.md)
- [Dapper](build/dapper.md)
- [Cargo](build/cargo.md)
- [Container image](build/container-image.md)
- [Install](install/README.md)
- [With Docker](install/docker.md)
- [With Kubernetes](install/kubernetes.md)
- [Development environment (Terraform)](terraform/README.md)
- [libvirt](terraform/libvirt.md)
- [OpenStack](terraform/openstack.md)
- [Policies](policies/README.md)
- [File access](policies/file-access.md)
- [Mount](policies/mount.md)
- [Syslog](policies/syslog.md)
- [Tuning](tuning/README.md)
- [For Developers](developers/README.md)
- [Repositories](developers/repositories.md)
- [Build](developers/build/README.md)
- [Dapper](developers/build/dapper.md)
- [Cargo](developers/build/cargo.md)
- [Container image](developers/build/container-image.md)
- [Development environment (Terraform)](developers/terraform/README.md)
- [libvirt](developers/terraform/libvirt.md)
- [OpenStack](developers/terraform/openstack.md)
- [Demos](demos/README.md)
- [Mount](demos/mount.md)
9 changes: 9 additions & 0 deletions docs/src/developers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# For Developers

- [Repositories] - Cloning and working with our git repositories
- [Build] - How to build lockc from the sources
- [Development environment (Terraform)] - Using Terraform for setting up development environment lockc

[Repositories]: repositories.md
[Build]: build/README.md
[Development environment (Terraform)]: terraform/README.md
File renamed without changes.
55 changes: 11 additions & 44 deletions docs/src/build/cargo.md → docs/src/developers/build/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ If you are comfortable with installing all dependencies on your host system,
you need to install the following software:

* LLVM
* libbpf, bpftool
* bpftool
* Rust, Cargo

## LLVM
Expand All @@ -31,58 +31,25 @@ zypper in clang llvm
If there is no packaging of recent LLVM versions for your distribution, there
is also an option to [download binaries](https://releases.llvm.org/download.html).

## libbpf, bpftool
## bpftool

libbpf is the official C library for writing, loading and managing BPF programs
and entities. bpftool is the official CLI for interacting with BPF subsystem.
bpftool is the official CLI for interacting with BPF subsystem.

Distributions with up to date software (Arch, Fedora, openSUSE Tumbleweed)
usually provide packaging for both.
usually provide packaging for it.

Especially for more stable and less up to date distributions, but even
generally, we would recommend to build both dependencies from source. Both of
generally, we would recommend to build bpftool from source. Both of
them are the part of the Linux kernel source.

The easiest way to get the kernel source is to download a tarball available on
[kernel.org](https://www.kernel.org/). Then build and install tools from it
(the version might vary from this snippet):
bpftool is available in its own repo - [github.com/libbpf/bpftool](https://github.com/libbpf/bpftool).
It lets you to build bpftool with the following commands:

```bash
tar -xvf linux-5.14.9.tar.xz
cd linux-5.14.9
cd tools/lib/bpf
make -j $(nproc)
make install prefix=/usr
cd ../../bpf/bpftool
make -j $(nproc)
make install prefix=/usr
```

If you are interested in tracking the history of Linux kernel source and/or are
comfortable using git for it, you can clone one of the git trees:

* [stable tree](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/) -
stable releases and release candidates, this is where the tarball comes from
* [mainline tree](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/) -
patches accepted by Linus, release candidates
* [bpf-next tree](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/) -
development of BPF features, before being mainlined
* [bpf tree](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/) -
BPF bugfixes which are backported to the stable tree

Assuming you want to use the stable tree:

```bash
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
git tag -l # List available tags
git checkout v5.14.9 # Check out to whatever is the newest
cd tools/lib/bpf
make -j $(nproc)
make install prefix=/usr
cd ../../bpf/bpftool
make -j $(nproc)
make install prefix=/usr
git clone --recurse-submodules https://github.com/libbpf/bpftool.git
cd src
make
sudo make install prefix=/usr
```

## Installing Rust
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions docs/src/developers/repositories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Repositories

lockc currently uses two git repositories:

* **[rancher-sandbox/lockc](https://github.com/rancher-sandbox/lockc)** - the
main repository containing lockc source code
* **[rancher-sandbox/lockc-helm-charts](https://github.com/rancher-sandbox/lockc-helm-charts)** -
repository with Helm charts to deploy lockc on Kubernetes

If you are interested in development and contributing to lockc, we recommend to
fork and clone both of them. Both will be needed especially for building a
[development environment based on Terraform](terraform/README.md).

The latter chapters assume that you have **lockc** and **lockc-helm-charts**
cloned in the same parent directory. For example, as
*$HOME/my-repositories/lockc* and *$HOME/my-repositories/lockc-helm-charts*.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ sudo systemctl restart libvirtd

## Running VMs

Now it's time to prepare Terraform environment.
Now it's time to prepare Terraform environment. Terraform files are included in
the main lockc git repository.

```bash
cd contrib/terraform/libvirt
Expand Down Expand Up @@ -130,21 +131,25 @@ kube-system kube-scheduler-lockc-control-plane-0 1/1 Running
kube-system kube-scheduler-lockc-control-plane-1 1/1 Running 0 14m
```

Now it's time to build and deploy lockc! Detailed instructions how to do that
are in the following documentation sections:
Now it's time to build and deploy lockc!

* [Container image](../build/container-image.md)
* [Install on Kubernetes](../install/kubernetes.md)

But let's continue with a short summary of the easiest way to do that:
To build lockc container image, we have to go to the main directory in lockc
git repository:

```bash
# Go to the main directory of lockc sources
cd ../../..
export IMAGE_NAME=$(uuidgen)
docker build -t ttl.sh/${IMAGE_NAME}:30m .
docker push ttl.sh/${IMAGE_NAME}:30m
helm install lockc contrib/helm/lockc/ --namespace kube-system \
```

Then we need to go to the lockc-helm-charts git repository:

```bash
# Go to the main directory of lockc-helm-charts sources
cd ../lockc-helm-charts
helm install lockc charts/lockc/ --namespace kube-system \
--set lockcd.image.repository=ttl.sh/${IMAGE_NAME} \
--set lockcd.image.tag=30m \
--set lockcd.debug.enabled=true
Expand Down
11 changes: 11 additions & 0 deletions docs/src/install/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Install

lockc provides integration with two container engines and separate installation
methods for each of them:

* **[Kubernetes]** (+ containerd-cri) - installation through a Helm chart,
after which lockc secures newly created pods
* **[Docker]** - installation on a single machine with Docker as a loca
container engine

[Kubernetes]: kubernetes.md
[Docker]: docker.md