An open API service indexing awesome lists of open source software.

https://github.com/s8sg/firecracker-go-template

Builds firecracker filesystem with provided Go application
https://github.com/s8sg/firecracker-go-template

firecracker firecracker-go firecracker-microvms golang unikernel

Last synced: 11 months ago
JSON representation

Builds firecracker filesystem with provided Go application

Awesome Lists containing this project

README

          

# firecracker-go-template
Builds firecracker filesystem with provided Go application

> This repository is a direct copy and edit on **UNIK's firecracker compiler**
> For more details on UNIK click [here](https://github.com/solo-io/unik)


## Getting Started

**Prerequisites**
```text
docker
firecracker
firectl
```
**Get firecracker kernel**
```bash
curl -fsSL -o /tmp/hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
```

**Setup tap interface - Optional for network**
```bash
sudo ip tuntap add tap0 mode tap # user $(id -u) group $(id -g)
sudo ip addr add 172.20.0.1/24 dev tap0
sudo ip link set tap0 up
```
Set your main interface device. If you have different name check it with ifconfig command
```bash
DEVICE_NAME=eth0
```
Provide iptables rules to enable packet forwarding
```bash
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo iptables -t nat -A POSTROUTING -o $DEVICE_NAME -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i tap0 -o $DEVICE_NAME -j ACCEPT
```

### Build docker image
```bash
make
```

## Write your simple golang application

##### 1. Write your demo go application
```bash
mkdir demo
cat > demo/main.go < demo/main.go <