github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/docs/compilers/firecracker.md (about)

     1  
     2  
     3  # For devs - build unik
     4  If needed (during dev cycle), build compiler and unik:
     5  ```
     6  make compilers-firecracker
     7  make localbuild
     8  ```
     9  
    10  # Config
    11  
    12  Follow regular getting started instructions, and configure the firecracker provider like so:
    13  
    14  ```
    15  providers:
    16    firecracker:
    17      - name: firecracker
    18        binary: /path/to/firecracker
    19        kernel: /path/to/kernel/hello-vmlinux.bin
    20        console: xterm
    21  ```
    22  
    23  # Create the demo program
    24  
    25  The current compiler supports go 1.11. Let's prepare a demo program:
    26  ```
    27  mkdir demo
    28  cat > demo/main.go <<EOF
    29  package main
    30  
    31  import (
    32    "fmt"
    33    "os/exec"
    34    "time"
    35  )
    36  
    37  func main() {
    38    for {
    39      fmt.Println("Hello from firecracker (run by unik from solo.io)")
    40      out, _ := exec.Command("uname", "-a").CombinedOutput()
    41      fmt.Printf("OS Version: %s\n", string(out))
    42      time.Sleep(10 * time.Second)
    43    }
    44  }
    45  EOF
    46  ```
    47  
    48  # Run unik and build image
    49  
    50  In one terminal, run daemon:
    51  ```
    52  ./unik daemon --debug
    53  ```
    54  
    55  In other terminal, build and run:
    56  ```
    57  ./unik build --name writeOS_miVM --path ./demo/ --base firecracker --language go --provider firecracker --force
    58  
    59  ./unik run --instanceName writeOS_vm1 --imageName writeOS_miVM
    60  ```
    61  
    62  
    63  # Cleanup:
    64  ```
    65  ./unik delete-instance --instance writeOS_vm1
    66  ./unik delete-image --image writeOS_miVM
    67  ```