Iris from Scratch

Part of what makes Nanobox so useful is you don’t even need Nodejs or Iris installed on your local machine to use them.

Create a Iris project

Create the project folder and change into it:

mkdir nanobox-iris && cd nanobox-iris

HEADS UP: All nanobox commands must be run from within your project folder.

Add a boxfile.yml

Nanobox uses a boxfile.yml to configure your app’s environment.

At the root of your project create a boxfile.yml telling Nanobox you want to use the Nodejs engine:

  engine: golang
    package: nanobox-iris

Create an Iris App

Install Iris

# drop into a nanobox console
nanobox run

# install iris so you can use it to generate your application
go get -u

# exit the console

Create a basic Iris app at the root of your project named main.go:

package main

import ""

func main() {
  iris.Get("/hi", hi)

func hi(ctx *iris.Context){
  ctx.Render("hi.html", struct { Name string }{ Name: "iris" })

Create a new html page for your application at ./templates/hi.html:

<html><head> <title> Hi Iris</title> </head>
    <h1> Hi {{.Name}} </h1>

Configure Iris

Listen on

To allow connections from the host machine into the app’s container, your app needs to listen on all available IP’s ( Iris does this by default, and so no additional configuration is needed.

Add a local DNS

Add a convenient way to access your app from the browser:

nanobox dns add local iris.local

Run the app

nanobox run go run main.go

Visit your app at iris.local:8080/hi


With Nanobox, you have everything you need develop and run your iris app:

# drop into a Nanobox console
nanobox run

# where go is installed,
go version

# git is installed,
git --version

# and your code is mounted

# exit the console

Now what?

Whats next? Think about what else your app might need and hopefully the topics below will help you get started with the next steps of your development!