Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

HaLVM Web Server Quick Start

Zhen Zhang edited this page Dec 3, 2016 · 6 revisions

OK, so you're interested in building a HaLVM web server, because you think that's really cool. Here's the quick version.

Step #1: Get and build the HaLVM

(This has been tested on Fedora 20 and whatever version of ArchLinux existed on October 24th, 2014. 64-bit, in both cases.)

You may have already done this. If not, your first step is to install GHC 7.8.3, Alex 3.1+, Happy 1.19+, and cabal-install 1.20+. (Alternatively, you can wait until this bug is fixed, which should get these pre-reqs for you if you don't have them.)

Then run:

git clone https://github.com/GaloisInc/HaLVM.git

cd HaLVM

git submodule update --init --recursive

autoconf

./configure --enable-gmp --prefix=pwd/dist

make

make install

This will take a bit, but when it's done, you'll have a shiny new HaLVM in ./dist.

(As an aside, the --enable-gmp is there due to a minor oddity in the Haskell text package. I've submitted a patch, so hopefully this will not be necessary in the future.)

Final step, let's get the HaLVM in your path:

export PATH=pwd/dist/bin:${PATH}

Build WebServer dependencies

Now we have some tricksy bits, largely because not everything's been pushed to Hackage properly. Soon, though, and then this section will be very short.

NOTE: if some *.so is missing during installation, try this: export LD_LIBRARY_PATH=/usr/local/lib/HaLVM-X.X.X/lib

Pull and install HaNS:

git clone https://github.com/GaloisInc/HaNS

cd HaNS

halvm-cabal install

Then pull and install network-hans:

git clone https://github.com/GaloisInc/network-hans

cd network-hans

halvm-cabal install

halvm-cabal install --disable-split-objs # only if the above one is stuck somewhere....

Then pull and install Adam's version of HTTP. Which should be pushed upstream at some point:

git clone https://github.com/acw/HTTP

cd HTTP

halvm-cabal install

Then install blaze-html, which might just install:

halvm-cabal install blaze-html

Build the WebServer

Well, now you can build the web server example in the HaLVM tree!

cd HaLVM/examples/HighLevel/WebServer

make

And, assuming that you're running Xen and have sudo privileges, run it:

make run

The web server example will print out a little information about it's initialization phase, including what it's IP address is. Note that this example assumes that the WebServer can fetch its address via DHCP.

That's it! Heh. At this point, it's up to you.