Get Started with Boxfuse & Linux x64 apps

 

This tutorial will get you started with Boxfuse and Linux x64 apps. It should take you about 5-10 minutes to complete.

Prerequisites

Before you begin, ensure you have an x64 machine and have successfully:

  1. created a Boxfuse Account (simply log in with your GitHub account, it's free)
  2. downloaded and installed the latest Boxfuse Client
  3. downloaded and installed the latest version of VirtualBox

Downloading the application

In this tutorial we are going to deploy a simple Linux x64 application. We'll use Nginx as an example.

Start by creating a directory for our app:

> mkdir getstarted-linux-x64

And navigate to it:

> cd getstarted-linux-x64

Now download the tar.gz Linux x64 build of Nginx available from this page on GitHub and save it in our new directory as nginx-static-1.5.tgz.

Fusing a Boxfuse image and running it locally on VirtualBox

Continue by fusing your application into a Boxfuse image and launching an instance of it on VirtualBox. To do so you'll need to pass in both the command to start it as well as the port to open:

getstarted-linux-x64> boxfuse run nginx-static-1.5.tgz "-cmd=nginx-static/sbin/nginx -g 'daemon off; user root;'" -ports.http=80

Creating nginx-static ...
Mapping nginxstatic-dev-myuser.boxfuse.io to 127.0.0.1 ...
Created app nginx-static (type: single-instance, db: none, logs: none)
Fusing Image for nginx-static-1.5.tgz (Linux x64) ...
Image fused in 00:00.707s (10522 K) -> myuser/nginx-static:1.5
Launching Instance of myuser/nginx-static:1.5 on VirtualBox ...
Forwarding http port localhost:80 -> vb-6df058de:80
Instance launched in 00:03.020s -> vb-6df058de
Waiting for Payload to start on vb-6df058de:80 (expecting HTTP 200 at / within 300s) ...
Payload started in 00:00.509s -> http://127.0.0.1

In just a few seconds Boxfuse found your application, detected its type, generated an image for it and launched an instance of that image on VirtualBox.

Now open your browser and navigate to this address to see your new application up and running within the VirtualBox VM:

You can also see your newly created image:

getstarted-go> boxfuse ls

Images available locally:
+-------------------------+----------------------+-------+-----------+------------+---------+---------------------+
| Image                   |        Payload       | Debug |  Runtime  |   Ports    |  Size   |    Generated at     |
+-------------------------+----------------------+-------+-----------+------------+---------+---------------------+
| myuser/nginx-static:1.5 | nginx-static-1.5.tgz | false | Linux x64 | http -> 80 | 10522 K | 2016-11-16 13:02:58 |
+-------------------------+----------------------+-------+-----------+------------+---------+---------------------+
Total: 1

As well as the instance that is running:

getstarted-go> boxfuse ps

Running Instances on VirtualBox in the dev environment :
+-------------+-------------------------+---------------------+------------------+---------------------+
|  Instance   |          Image          |        Type         |       URL        |     Launched at     |
+-------------+-------------------------+---------------------+------------------+---------------------+
| vb-6df058de | myuser/nginx-static:1.5 | 4 CPU / 1024 MB RAM | http://127.0.0.1 | 2016-11-16 13:02:59 |
+-------------+-------------------------+---------------------+------------------+---------------------+
Total: 1

Deploying your application to AWS

Now let's deploy the image to AWS. As Boxfuse works with your AWS account, it first needs the necessary permissions to do so. So if you haven't already done it, go to the Boxfuse Console and connect your AWS account now.

Every new Boxfuse account comes with 3 environments: dev, test and prod. dev is your local VirtualBox environment and test and prod are on AWS.

So let's deploy our application to the prod environment on AWS:

getstarted-linux-x64> boxfuse run nginx-static:1.5 -env=prod

Pushing myuser/nginx-static:1.5 ...
Verifying myuser/nginx-static:1.5 ...
Waiting for AWS to create an AMI for myuser/nginx-static:1.5 in eu-central-1 (this may take up to 50 seconds) ...
AMI created in 00:26.849s in eu-central-1 -> ami-d2dc19bd
Creating security group boxsg-myuser-prod-nginx-static ...
Creating Elastic IP ...
Mapping nginxstatic-myuser.boxfuse.io to 35.156.101.145 ...
Creating security group boxsg-myuser-prod-nginx-static-1.5 ...
Launching t2.micro instance of myuser/nginx-static:1.5 (ami-d2dc19bd) in prod (eu-central-1) ...
Instance launched in 00:24.478s -> i-8f39a332
Creating Cloud Watch Alarm for Instance auto-recovery -> i-8f39a332-auto-recovery-alarm
Waiting for AWS to boot Instance i-8f39a332 and Payload to start at http://54.93.62.223/ ...
Payload started in 00:00.003s -> http://54.93.62.223/
Associating Elastic IP 35.156.101.145 to i-8f39a332 ...
Waiting 15s for AWS to complete Elastic IP Zero Downtime transition ...
Successfully deployed myuser/nginx-static:1.5 in prod at http://nginxstatic-myuser.boxfuse.io/

Notice that we have now specified an image, as we want to reuse our image unchanged instead fusing a new one.

With that one command Boxfuse has automatically pushed your image to the Boxfuse Vault as well as provisioned, configured and secured all necessary AWS resources. There is no manual work necessary on your behalf.

All you need to do is simply navigate to your new domain to see your Linux x64 application in action on AWS:

Summary

In this brief guide we have seen how to:

  • fuse a Linux x64 app into a Boxfuse image
  • deploy the image locally on VirtualBox
  • deploy the image unchanged to AWS

Now it's your turn. Take your favorite Linux x64 application and deploy it with ease and pleasure.

Boxfuse Linux x64 Documentation