From: Stefano Stabellini Date: Tue, 28 Nov 2017 01:34:12 +0000 (-0800) Subject: Replace "dom0" with "dom0-containers" X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bd97b3077fdc9117fb187eeb55f3f1e24c77804b;p=people%2Fsstabellini%2Fmojo.git%2F.git Replace "dom0" with "dom0-containers" Replace the current container to build the dom0 rootfs with another that uses Moby and containers in Dom0 to pull the system together. Signed-off-by: Stefano Stabellini --- diff --git a/alpine-dom0/build.sh b/alpine-dom0/build.sh index d8b3d07..70cdcb0 100755 --- a/alpine-dom0/build.sh +++ b/alpine-dom0/build.sh @@ -19,3 +19,6 @@ for label in `cat alpine-dom0/series` do build $label done + +alpine-dom0/dom0-containers/build.sh + diff --git a/alpine-dom0/clean_all.sh b/alpine-dom0/clean_all.sh index 78347a8..0f2eb01 100755 --- a/alpine-dom0/clean_all.sh +++ b/alpine-dom0/clean_all.sh @@ -4,3 +4,5 @@ for label in `cat alpine-dom0/series` do docker rmi -f $label done +docker rmi -f dom0 +docker rmi -f kernel diff --git a/alpine-dom0/dom0-containers/build.sh b/alpine-dom0/dom0-containers/build.sh new file mode 100755 index 0000000..6f0c26f --- /dev/null +++ b/alpine-dom0/dom0-containers/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# For Zededa components we assume LinuxKit + +label="kernel" +linuxkit pkg build --disable-content-trust -hash $label alpine-dom0/dom0-containers/$label/ + +label="zededa-builder" +linuxkit pkg build --disable-content-trust -hash $label alpine-dom0/dom0-containers/$label/ + +if ! test -f out/rootfs.tar +then + mkdir -p out/ &>/dev/null + moby build -o out/rootfs.tar alpine-dom0/dom0-containers/rootfs.template +fi + +label="dom0" +mv out/rootfs.tar alpine-dom0/dom0-containers/"$label" +linuxkit pkg build --disable-content-trust -hash $label alpine-dom0/dom0-containers/$label/ +mv alpine-dom0/dom0-containers/"$label"/rootfs.tar out/ diff --git a/alpine-dom0/dom0-containers/dom0/Dockerfile b/alpine-dom0/dom0-containers/dom0/Dockerfile new file mode 100644 index 0000000..8d5b36f --- /dev/null +++ b/alpine-dom0/dom0-containers/dom0/Dockerfile @@ -0,0 +1,4 @@ +FROM scratch as dom0 + +ADD rootfs.tar / + diff --git a/alpine-dom0/dom0-containers/dom0/build.yml b/alpine-dom0/dom0-containers/dom0/build.yml new file mode 100644 index 0000000..05dfc7c --- /dev/null +++ b/alpine-dom0/dom0-containers/dom0/build.yml @@ -0,0 +1,3 @@ +image: dom0 +org: mojoos +network: yes diff --git a/alpine-dom0/dom0-containers/kernel/Dockerfile b/alpine-dom0/dom0-containers/kernel/Dockerfile new file mode 100644 index 0000000..9874c45 --- /dev/null +++ b/alpine-dom0/dom0-containers/kernel/Dockerfile @@ -0,0 +1,4 @@ +FROM scratch as kernel + +COPY --from=mojoos/linux-builder:linux-builder /out/boot /boot + diff --git a/alpine-dom0/dom0-containers/kernel/build.yml b/alpine-dom0/dom0-containers/kernel/build.yml new file mode 100644 index 0000000..955dcb0 --- /dev/null +++ b/alpine-dom0/dom0-containers/kernel/build.yml @@ -0,0 +1,3 @@ +image: kernel +org: mojoos +network: yes diff --git a/alpine-dom0/dom0-containers/rootfs.template b/alpine-dom0/dom0-containers/rootfs.template new file mode 100644 index 0000000..f99335a --- /dev/null +++ b/alpine-dom0/dom0-containers/rootfs.template @@ -0,0 +1,25 @@ +kernel: + cmdline: "root=/dev/sdb2 rootwait" +init: + - mojoos/kernel:kernel + - mojoos/dom0-ztools-builder:dom0-ztools-builder + - linuxkit/init:7804129bd06218b72c298139a25698a748d253c6 + - linuxkit/runc:a1b564248a0d0b118c11e61db9f84ecf41dd2d2a + - linuxkit/containerd:417f83f7b8dc1fa36acf90effe44f99c7397480a + - linuxkit/getty:bf6872ce0a9f3ab519b3e502cc41ba3958bda2a6 +onboot: + - name: dhcpcd + image: linuxkit/dhcpcd:d4408777ed6b6e6e562a5d4938fd09804324b33e + command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] +services: + - name: zededa-tools + image: mojoos/zededa-builder:zededa-builder + binds: + - /dev:/dev + - /etc/resolv.conf:/etc/resolv.conf + net: host + capabilities: + - all +trust: + org: + - linuxkit diff --git a/alpine-dom0/dom0-containers/zededa-builder/Dockerfile b/alpine-dom0/dom0-containers/zededa-builder/Dockerfile new file mode 100644 index 0000000..84b062a --- /dev/null +++ b/alpine-dom0/dom0-containers/zededa-builder/Dockerfile @@ -0,0 +1,24 @@ +FROM alpine:3.6 as zededa-builder + +RUN apk add --no-cache \ + yajl xz bash openssl iptables ip6tables \ + coreutils dmidecode sudo libbz2 libuuid ipset curl glib pixman \ + libattr libpcap libaio pixman glib wget radvd perl ethtool openssh-server + +# The following enables pcappy to dlopen libpcap.so +RUN ln -s libpcap.so.1 /usr/lib/libpcap.so + +# FIXME: we really need to do a proper linuxkit sshd +RUN ssh-keygen -A ; echo PermitRootLogin yes >> /etc/ssh/sshd_config ; sed -ie '/^root/s#^.*$#root:$6$Ndt1G5AYZFQ8rz7m$7vGZMKKotSYxwxk/.jMfuOCzxw0I3DNedygaQaLF7kYSYsLqiBHhmc8RJSXp8/VxSYPpgYSz/8fkv0hO6I4js.:17477:0:::::#' /etc/shadow + +COPY --from=mojoos/test-cert:test-cert /out / + +RUN mkdir -p /opt/zededa/bin/dnsmasq && \ +mv /usr/sbin/dnsmasq /opt/zededa/bin/dnsmasq && \ +rm -rf /boot + +# And now a few local tweaks +COPY rootfs/ / + +# FIXME: replace with tini+monit ASAP +CMD /init.sh diff --git a/alpine-dom0/dom0-containers/zededa-builder/build.yml b/alpine-dom0/dom0-containers/zededa-builder/build.yml new file mode 100644 index 0000000..5ece187 --- /dev/null +++ b/alpine-dom0/dom0-containers/zededa-builder/build.yml @@ -0,0 +1,3 @@ +image: zededa-builder +org: mojoos +network: yes diff --git a/alpine-dom0/dom0-containers/zededa-builder/rootfs/etc/nsswitch.conf b/alpine-dom0/dom0-containers/zededa-builder/rootfs/etc/nsswitch.conf new file mode 100644 index 0000000..21fae73 --- /dev/null +++ b/alpine-dom0/dom0-containers/zededa-builder/rootfs/etc/nsswitch.conf @@ -0,0 +1 @@ +hosts: files dns diff --git a/alpine-dom0/dom0-containers/zededa-builder/rootfs/init.sh b/alpine-dom0/dom0-containers/zededa-builder/rootfs/init.sh new file mode 100755 index 0000000..eb8b51b --- /dev/null +++ b/alpine-dom0/dom0-containers/zededa-builder/rootfs/init.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# This *really* needs to be replaced with tini+monit ASAP. + +# Need to disable H/W TCP offload since it seems to mess us up +ethtool -K eth0 gro off +ethtool -K eth1 gro off + +# For convenice's sake we're putting SSH inisde of a root container +/usr/sbin/sshd + +# Finally, we need to start Xen +XENCONSOLED_ARGS='--log=all --log-dir=/var/log/xen' /etc/init.d/xencommons start + +# This is an optional component - only run it if it is there +/opt/zededa/bin/device-steps.sh -w < /opt/zededa/etc/cert-input.txt || : + +tail -f /var/log/* diff --git a/alpine-dom0/series b/alpine-dom0/series index 814c106..d1610bd 100644 --- a/alpine-dom0/series +++ b/alpine-dom0/series @@ -4,4 +4,3 @@ linux-builder dnsmasq-builder test-cert dom0-ztools-builder -dom0