From 98bccd9ecaf126d8c5d13819d9ab465e34abae7b Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Thu, 12 Jan 2017 11:22:22 +1000 Subject: [PATCH 1/3] Start updating zfs docs Signed-off-by: Sven Dowideit --- docs/os/storage/using-zfs/index.md | 26 ++++------ .../custom-system-services/index.md | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/docs/os/storage/using-zfs/index.md b/docs/os/storage/using-zfs/index.md index af7d8fdd..5a54067d 100644 --- a/docs/os/storage/using-zfs/index.md +++ b/docs/os/storage/using-zfs/index.md @@ -7,29 +7,19 @@ redirect_from: ## Using ZFS -In order to start using ZFS, you'll need to first enable one of the [persistent consoles]({{site.baseurl}}/os/configuration/custom-console/#console-persistence) and enable [kernel headers]({{site.baseurl}}/os/configuration/kernel-modules-kernel-headers/). +#### Installing the ZFS service + ``` -$ sudo ros console switch ubuntu -$ sudo ros service enable kernel-headers -$ sudo ros service up kernel-headers -$ sudo ros service logs kernel-headers +$ sudo ros service enable zfs +$ sudo ros service up zfs +$ sudo ros service logs zfs +$ sudo depmod ``` -When RancherOS console has reloaded, you will have logged into the persistent console. The current kernel headers will need to be downloaded using the `ros service enable` and the service will be started with `ros service up kernel-headers`. +The `zfs` service will install the kernel-headers for your kernel (if you build your own kernel, you'll need to replicate this service), and then download the [ZFS on Linux]() source, and build and install it. Then it will build a `zfs-tools` image that it can use to give you console access to the zfs tools. -You can make sure that the headers are in the right place by looking at the kernel-headers service logs. - -#### Installing ZFS on Ubuntu Console - -Based on the [Ubuntu ZFS docs](https://wiki.ubuntu.com/Kernel/Reference/ZFS), you only need to install `zfs` package into the Ubuntu console to enable ZFS. All the other necessary packages will be installed as its dependencies. - -``` -$ sudo apt update -$ sudo apt install zfs -``` - -Then have a look at the zfs dmks build log file - which is likely to be a file similar to `/var/lib/dkms/zfs/0.6.5.6/build/make.log`. +> *Note:* if you switch consoles, you may need to re-run `ros enable zfs`. #### Mounting ZFS filesystems on boot diff --git a/docs/os/system-services/custom-system-services/index.md b/docs/os/system-services/custom-system-services/index.md index 26191fe2..634ad70c 100644 --- a/docs/os/system-services/custom-system-services/index.md +++ b/docs/os/system-services/custom-system-services/index.md @@ -57,6 +57,53 @@ The config settings to set the url in which `ros` should look for an `index.yml` For example, in RancherOS v0.7.0, the `core` repository is set to `https://raw.githubusercontent.com/rancher/os-services/v0.7.0`. +### Service development and testing + +If you're building your own services in a branch on GitHub, you can push to it, and then load your service from there. + +For example, when developing the zfs service: + +``` +rancher@zfs:~$ sudo ros config set rancher.repositories.zfs.url https://raw.githubusercontent.com/SvenDowideit/os-services/zfs-service +rancher@zfs:~$ sudo ros service list +disabled amazon-ecs-agent +disabled kernel-extras +enabled kernel-headers +disabled kernel-headers-system-docker +disabled open-vm-tools +disabled amazon-ecs-agent +disabled kernel-extras +disabled kernel-headers +disabled kernel-headers-system-docker +disabled open-vm-tools +disabled zfs +[rancher@zfs ~]$ sudo ros service enable zfs +Pulling zfs (zombie/zfs)... +latest: Pulling from zombie/zfs +b3e1c725a85f: Pull complete +4daad8bdde31: Pull complete +63fe8c0068a8: Pull complete +4a70713c436f: Pull complete +bd842a2105a8: Pull complete +d1a8c0826fbb: Pull complete +5f1c5ffdf34c: Pull complete +66c2263f2388: Pull complete +Digest: sha256:eab7b8c21fbefb55f7ee311dd236acee215cb6a5d22942844178b8c6d4e02cd9 +Status: Downloaded newer image for zombie/zfs:latest +[rancher@zfs ~]$ sudo ros service up zfs +WARN[0000] The KERNEL_VERSION variable is not set. Substituting a blank string. +INFO[0000] Project [os]: Starting project +INFO[0000] [0/21] [zfs]: Starting +INFO[0000] [1/21] [zfs]: Started +INFO[0000] Project [os]: Project started + +``` + +Beware that there is an overly aggressive caching of yml files - so when you push a new yml file to your repo, you need to +delete the files in `/var/lib/rancher/cache`. + +The image that you specify in the service yml file needs to be pullable - either from a private registry, or on the Docker Hub. + ### Creating your own Console Once you have your own Services repository, you can add a new service to its index.yml, and then add a `.yml` file to the directory starting with the first letter. From b530a3cd95d6453e3c54c5ea131558f23db82134 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 31 Jan 2017 22:06:03 +1000 Subject: [PATCH 2/3] update with the latest version of the zfs service Signed-off-by: Sven Dowideit --- docs/os/storage/using-zfs/index.md | 94 ++++++++++++------------------ 1 file changed, 36 insertions(+), 58 deletions(-) diff --git a/docs/os/storage/using-zfs/index.md b/docs/os/storage/using-zfs/index.md index 5a54067d..98db2f05 100644 --- a/docs/os/storage/using-zfs/index.md +++ b/docs/os/storage/using-zfs/index.md @@ -9,57 +9,35 @@ redirect_from: #### Installing the ZFS service +The `zfs` service will install the kernel-headers for your kernel (if you build your own kernel, you'll need to replicate this service), and then download the [ZFS on Linux]() source, and build and install it. Then it will build a `zfs-tools` image that will be used to give you access to the zfs tools. + +The only restriction is that you must mount your zpool into `/mnt`, as this is the only shared mount directory that will be accessible throughout the system-docker managed containers (including the console). + ``` $ sudo ros service enable zfs $ sudo ros service up zfs -$ sudo ros service logs zfs -$ sudo depmod +$ sudo ros service logs --follow zfs +# wait until the build is finished. +$ lsmod | grep zfs ``` -The `zfs` service will install the kernel-headers for your kernel (if you build your own kernel, you'll need to replicate this service), and then download the [ZFS on Linux]() source, and build and install it. Then it will build a `zfs-tools` image that it can use to give you console access to the zfs tools. - -> *Note:* if you switch consoles, you may need to re-run `ros enable zfs`. - -#### Mounting ZFS filesystems on boot - -In order for ZFS to load on boot, it needs to be added to `modules` list in the config. Prior to adding it to the list of modules, you'll need to check to see if there are other modules that are currently enabled. - -``` -# Check to see what modules currently exist -$ sudo ros config get rancher.modules -# Make sure to include any modules that were already enabled -$ sudo ros config set rancher.modules [zfs] -``` - -
- -You will also need to have the zpool cache imported on boot: - -``` -[ -f /etc/zfs/zpool.cache ] && zpool import -c /etc/zfs/zpool.cache -a -``` - -
- -A cloud-config `runcmd` instruction will do it for you: - -``` -# check current 'runcmd' list -$ sudo ros config get runcmd -[] -# add the command we need to run on boot -$ sudo ros config set runcmd "[[sh, -c, '[ -f /etc/zfs/zpool.cache ] && zpool import -c /etc/zfs/zpool.cache -a']]" -``` +> *Note:* if you switch consoles, you may need to re-run `ros up zfs`. #### Using ZFS -After it's installed, it should be ready to use! +After it's installed, it should be ready to use. Make a zpool named `zpool1` using a device that you haven't yet partitioned (you can use `sudo fdisk -l` to list all the disks and their partitions). + +> *Note:* You need to mount the zpool in `/mnt` to make it available to your host and in containers. + ``` -$ sudo modprobe zfs $ sudo zpool list -$ sudo zpool create zpool1 /dev/ +$ sudo zpool create zpool1 -m /mnt/zpool1 /dev/ +$ sudo zpool list +$ sudo zfs list +$ sudo cp /etc/* /mnt/zpool1 +$ docker run --rm -it -v /mnt/zpool1/:/data alpine ls -la /data ```
@@ -88,9 +66,8 @@ Now you'll need to remove `-s overlay` (or any other storage driver) from the Do ``` $ sudo ros config set rancher.docker.storage_driver '' -$ sudo ros config set rancher.docker.graph /zpool1/docker -# After editing Docker daemon args, you'll need to start Docker -$ sudo system-docker stop docker +$ sudo ros config set rancher.docker.graph /mnt/zpool1/docker +# Now that you've changed the Docker daemon args, you'll need to start Docker $ sudo system-docker start docker ``` @@ -98,41 +75,42 @@ After customizing the Docker daemon arguments and restarting `docker` system ser ``` $ docker info -Containers: 1 +Containers: 0 Running: 0 Paused: 0 - Stopped: 1 -Images: 1 -Server Version: 1.12.1 + Stopped: 0 +Images: 0 +Server Version: 1.12.6 Storage Driver: zfs - Zpool: zpool1 - Zpool Health: ONLINE + Zpool: error while getting pool information strconv.ParseUint: parsing "": invalid syntax + Zpool Health: not available Parent Dataset: zpool1/docker - Space Used By Parent: 27761152 - Space Available: 4100088320 + Space Used By Parent: 19456 + Space Available: 8256371200 Parent Quota: no Compression: off Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local - Network: host null bridge overlay + Network: host bridge null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Security Options: seccomp -Kernel Version: 4.4.16-rancher -Operating System: RancherOS v0.6.0-rc8 +Kernel Version: 4.9.6-rancher +Operating System: RancherOS v0.8.0-rc8 OSType: linux Architecture: x86_64 -CPUs: 2 -Total Memory: 1.938 GiB -Name: rancher -ID: EK7Q:WTBH:33KR:UCRY:YAPI:N7RX:D25K:S7ZH:DRNY:ZJ3J:25XE:P3RF -Docker Root Dir: /zpool1/docker +CPUs: 1 +Total Memory: 1.953 GiB +Name: ip-172-31-24-201.us-west-1.compute.internal +ID: IEE7:YTUL:Y3F5:L6LF:5WI7:LECX:YDB5:LGWZ:QRPN:4KDI:LD66:KYTC +Docker Root Dir: /mnt/zpool1/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Insecure Registries: 127.0.0.0/8 + ``` From 1f6cad6171289a5002ec0122031232685b626377 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 1 Feb 2017 12:03:31 +1000 Subject: [PATCH 3/3] update because we now use detach: false Signed-off-by: Sven Dowideit --- docs/os/storage/using-zfs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/os/storage/using-zfs/index.md b/docs/os/storage/using-zfs/index.md index 98db2f05..3a234c46 100644 --- a/docs/os/storage/using-zfs/index.md +++ b/docs/os/storage/using-zfs/index.md @@ -17,6 +17,7 @@ The only restriction is that you must mount your zpool into `/mnt`, as this is t ``` $ sudo ros service enable zfs $ sudo ros service up zfs +# you can follow the progress of the build by running the following command in another ssh session: $ sudo ros service logs --follow zfs # wait until the build is finished. $ lsmod | grep zfs