startup.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash -e
  2. # Load configuration
  3. [ -f /installer/config.sh ] && source /installer/config.sh
  4. disk2=$disk"p3"
  5. # 1. Open LUKS devices and sets up a mapping under /dev/mapper/
  6. cryptsetup luksOpen $disk2 data
  7. echo "Device mappings:" `find /dev/mapper/ -type l`
  8. # 2. Mount LUKS volumes
  9. mount --verbose /dev/mapper/data /srv/data
  10. # 3. Create a bind-mounts so we are not on the unecryped root volume
  11. mount --verbose --bind /srv/data/guests/lib/docker /var/lib/docker
  12. mount --verbose --bind /srv/data/guests/docker /opt/docker
  13. mount --verbose --bind /srv/data/guests/lib/libvirt /var/lib/libvirt
  14. mount --verbose --bind /srv/data/guests/etc/libvirt /etc/libvirt
  15. # 4. Fix forward chain which was set to default deny by docker
  16. # so our KVM containers on br0 have access to the network
  17. iptables -v -A FORWARD -i br0 -o br0 -j ACCEPT
  18. # 4. Start libvirt and docker
  19. # Those services should have been disabled
  20. # systemctl disable docker libvirtd libvirt-guests
  21. echo start libvirt
  22. systemctl start libvirtd && sleep 2 && systemctl status --no-pager libvirtd
  23. echo start libvirt-guests
  24. systemctl start libvirt-guests && sleep 2 && systemctl status --no-pager libvirt-guests
  25. echo start docker
  26. systemctl start docker && sleep 2 && systemctl status --no-pager docker