Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft of h2o package support #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions h2o/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
include ../Makefile.inc
UPSTREAM=https://github.com/h2o/h2o/archive/v2.0.4.tar.gz

all: libssl bin/h2o images

bin/h2o: build/build/h2o
mkdir -p bin
cp $< $@

build/build/h2o: build/build/Makefile
$(MAKE) -C build/build

build/build/Makefile: build/stamp_patch
mkdir -p build/build
(cd build/build && \
cmake -DCMAKE_TOOLCHAIN_FILE=${RUMPRUN_CMAKE_TOOLCHAIN_FILE} \
-DOPENSSL_INCLUDE_DIR=${RUMPRUN_PKGS_DIR}/include \
-DOPENSSL_SSL_LIBRARY=${RUMPRUN_PKGS_DIR}/lib/libssl.a \
-DOPENSSL_CRYPTO_LIBRARY=${RUMPRUN_PKGS_DIR}/lib/libcrypto.a \
..)

build/stamp_patch: build/CMakeLists.txt
(cd build && ../../scripts/apply-patches.sh ./ ../patches/*)
touch $@

build/CMakeLists.txt:
mkdir -p build
../scripts/fetch.sh $(UPSTREAM) build/h2o.tar.gz
(cd build && tar -xz --strip-components 1 -f h2o.tar.gz)

.PHONY: images
images: images/data.iso

images/data.iso: images/data/conf/* images/data/www/*
$(RUMPRUN_GENISOIMAGE) -o images/data.iso images/data

.PHONY: clean
clean:
$(MAKE) -C build/build clean
rm -f bin/*
rm -f images/data.iso
distclean: clean
rm -rf build/build

include ../Makefile.deps
38 changes: 38 additions & 0 deletions h2o/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Overview
========

Packaging of the [h2o](http://h2o.examp1e.net/) 2.0.4 HTTP server for rumprun.

Instructions
============

The build script also requires `genisoimage` in order to build the ISO image
for `/data`.

Run `make`:

```
make
```

Bake the final unikernel image:
```
rumprun-bake xen_pv bin/h2o.bin bin/h2o
```

(Replace `xen_pv` with the platform you are baking for.)

Examples
========

To start a Xen domU running h2o serving static files, as root run (for
example):

````
rumprun xen -M 128 -di \
-n inet,static,10.10.10.10/24 \
-b images/data.iso,/data \
-- bin/h2o.bin -c /data/conf/h2o.conf
````

Replace `10.10.10.10/24` with a valid IP address on your Xen network.
9 changes: 9 additions & 0 deletions h2o/h2o.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# to find out the configuration commands, run: h2o --help

listen: 80
hosts:
"127.0.0.1:80":
paths:
/:
file.dir: /data/www
access-log: /dev/stdout
7 changes: 7 additions & 0 deletions h2o/images/data/conf/h2o.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
listen: 80
hosts:
"127.0.0.1:80":
paths:
/:
file.dir: /data/www
access-log: /dev/stdout
10 changes: 10 additions & 0 deletions h2o/images/data/www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to H2O</title>
</head>
<body>
<p>Welcome to H2O - an optimized HTTP server</p>
<p>It works!</p>
</body>
</html>
11 changes: 11 additions & 0 deletions h2o/patches/CMakeLists.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/CMakeLists.txt 2016-10-31 09:06:07.808933060 +0000
+++ b/CMakeLists.txt 2016-10-31 09:06:18.929110957 +0000
@@ -313,7 +313,7 @@
lib/http2/hpack.c
lib/http2/scheduler.c)

-SET(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
+SET(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})

IF (ZLIB_FOUND)
LIST(INSERT EXTRA_LIBS 0 ${ZLIB_LIBRARIES})