unikraft / app-python3

Unikraft Python3 app repo
12 stars 9 forks source link

`kraft.cloud.yaml`: Add networking support #20

Closed razvand closed 10 months ago

razvand commented 10 months ago

Add networking support to kraft.cloud.yaml, to enable full features of Python support (such as running the http.server module).

This will require a different way of running the Unikernel image. Use the following commands to run the http.server module:

rm -fr fs0
mkdir fs0
tar -C fs0 -xf rootfs.tar.gz
sudo ~/kraftkit/dist/kraft net rm kraft0
sudo ~/kraftkit/dist/kraft net create -n 172.44.0.1/24 kraft0
sudo kraft run --log-type basic --log-level debug --kraftfile kraft.cloud.yaml --plat firecracker --network bridge:kraft0 --initrd ./fs0 -M 256M -a netdev.ipv4_addr=172.44.0.2 -a netdev.ipv4_gw_addr=172.44.0.1 -a netdev.ipv4_subnet_mask=255.255.255.0 -- "-m http.server 8080"

To run helloworld.py, use:

rm -fr fs0
mkdir fs0
tar -C fs0 -xf rootfs.tar.gz
sudo ~/kraftkit/dist/kraft net rm kraft0
sudo ~/kraftkit/dist/kraft net create -n 172.44.0.1/24 kraft0
cp helloworld.py fs0/
sudo kraft run --log-type basic --log-level debug --kraftfile kraft.cloud.yaml --plat firecracker --network bridge:kraft0 --initrd ./fs0 -M 256M -- "helloworld.py"