-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement mos boot and support simple service network
Closes #4 Closes #7 Implement 'mos boot' which activates all services. Implement a 'simple' network type for services, which isolates a service in a netns with a simple veth on the lxcbr0, with specified host ports forwarded into the container. layers/install: add a zot service layer which uses the simple network. update to v0.0.17 bootkit for 4M firmware kvm provider: specify bootindex 'off' for nics add a hidden subcommand to verify an install.yaml Signed-off-by: Serge Hallyn <[email protected]>
- Loading branch information
Showing
24 changed files
with
481 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/project-machine/mos/pkg/mosconfig" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
var bootCmd = cli.Command{ | ||
Name: "boot", | ||
Usage: "start all services listed in mos manifest", | ||
Action: doBootCmd, | ||
} | ||
|
||
func doBootCmd(ctx *cli.Context) error { | ||
opts := mosconfig.DefaultMosOptions() | ||
mos, err := mosconfig.OpenMos(opts) | ||
if err != nil { | ||
return errors.Wrapf(err, "Failed opening mos") | ||
} | ||
|
||
err = mos.Boot() | ||
if err != nil { | ||
return errors.Wrapf(err, "Failed to boot") | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
mountpoint /lib/modules && { echo "already mounted"; exit 0; } | ||
|
||
mkdir -p /bootkit | ||
mosctl --debug mount --target=bootkit --dest=/bootkit | ||
mkdir -p /lib/modules | ||
mount /bootkit/bootkit/modules.squashfs /lib/modules/ | ||
|
||
udevadm trigger | ||
modprobe virtio-net | ||
modprobe br_netfilter | ||
modprobe iptables_nat | ||
modprobe iptables_mangle | ||
dhclient | ||
systemctl start lxc-net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=mos-boot-setup | ||
After=local-fs.target | ||
After=systemd-journal-flush.service logs.mount | ||
Requires=local-fs.target | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/bin/mosctl boot | ||
StandardOutput=journal+console | ||
StandardError=journal+console | ||
|
||
# Journal namespaces implementation also affects the mount namespaces. | ||
# Assigning a separate journal namespace to Atomix process hides mount points | ||
# like /config and /tmp from the "main" user namespace. | ||
# LogNamespace=atomix | ||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Load mos modules | ||
After=local-fs.target | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=true | ||
ExecStart=/usr/bin/load-mos-modules | ||
StandardOutput=journal+console | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
if [ -n "$IPV4" ]; then | ||
sed -i "s/0.0.0.0/${IPV4%/*}/" /etc/zot-config.json | ||
elif [ -n "$IPV6" ]; then | ||
sed -i "s/0.0.0.0/${IPV6%/*}/" /etc/zot-config.json | ||
fi | ||
|
||
# Should mos or lxc be doing this for us? | ||
ip route add default via 10.0.3.1 | ||
|
||
exec /usr/bin/zot serve /etc/zot-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"distSpecVersion": "1.0.1-dev", | ||
"storage": { | ||
"rootDirectory": "/zot", | ||
"gc": false | ||
}, | ||
"http": { | ||
"address": "0.0.0.0", | ||
"port": "5000" | ||
}, | ||
"log": { | ||
"level": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.