]> xenbits.xensource.com Git - people/sstabellini/mojo.git/.git/commitdiff
Replace "dom0" with "dom0-containers"
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 28 Nov 2017 01:34:12 +0000 (17:34 -0800)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 28 Nov 2017 01:34:12 +0000 (17:34 -0800)
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 <sstabellini@kernel.org>
13 files changed:
alpine-dom0/build.sh
alpine-dom0/clean_all.sh
alpine-dom0/dom0-containers/build.sh [new file with mode: 0755]
alpine-dom0/dom0-containers/dom0/Dockerfile [new file with mode: 0644]
alpine-dom0/dom0-containers/dom0/build.yml [new file with mode: 0644]
alpine-dom0/dom0-containers/kernel/Dockerfile [new file with mode: 0644]
alpine-dom0/dom0-containers/kernel/build.yml [new file with mode: 0644]
alpine-dom0/dom0-containers/rootfs.template [new file with mode: 0644]
alpine-dom0/dom0-containers/zededa-builder/Dockerfile [new file with mode: 0644]
alpine-dom0/dom0-containers/zededa-builder/build.yml [new file with mode: 0644]
alpine-dom0/dom0-containers/zededa-builder/rootfs/etc/nsswitch.conf [new file with mode: 0644]
alpine-dom0/dom0-containers/zededa-builder/rootfs/init.sh [new file with mode: 0755]
alpine-dom0/series

index d8b3d079157b454fc72524a876b264c340c52ce3..70cdcb0950c621d66310207c679f9214f6eb342f 100755 (executable)
@@ -19,3 +19,6 @@ for label in `cat alpine-dom0/series`
 do
     build $label
 done
+
+alpine-dom0/dom0-containers/build.sh
+
index 78347a82e6e4bd50dffbcb6d6c8de11fdba4a39a..0f2eb0144e65b7ef9f01f33ee5a15560f36d9a6c 100755 (executable)
@@ -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 (executable)
index 0000000..6f0c26f
--- /dev/null
@@ -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 (file)
index 0000000..8d5b36f
--- /dev/null
@@ -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 (file)
index 0000000..05dfc7c
--- /dev/null
@@ -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 (file)
index 0000000..9874c45
--- /dev/null
@@ -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 (file)
index 0000000..955dcb0
--- /dev/null
@@ -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 (file)
index 0000000..f99335a
--- /dev/null
@@ -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 (file)
index 0000000..84b062a
--- /dev/null
@@ -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 (file)
index 0000000..5ece187
--- /dev/null
@@ -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 (file)
index 0000000..21fae73
--- /dev/null
@@ -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 (executable)
index 0000000..eb8b51b
--- /dev/null
@@ -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/*
index 814c106d928644faae4c2a1bbf9358e3c43ab8f4..d1610bd4bde89f7036a85a3ad2b458243910f589 100644 (file)
@@ -4,4 +4,3 @@ linux-builder
 dnsmasq-builder
 test-cert
 dom0-ztools-builder
-dom0