Jelajahi Sumber

add Nim's web framework "mofuw" on Docker (#3417)

* upgrade: version up Nim and nimble

* fix: fix jester.dockerfile

* add: add Nim's web framework "mofuw"
momf 7 tahun lalu
induk
melakukan
7aa103e2e9

+ 1 - 0
.travis.yml

@@ -116,6 +116,7 @@ env:
     # - "TESTDIR=Lua/octopus"
     # - "TESTDIR=Lua/openresty"
      - "TESTDIR=Nim/jester"
+     - "TESTDIR=Nim/mofuw"
     # - "TESTDIR=Perl/dancer"
     # - "TESTDIR=Perl/kelp"
     # - "TESTDIR=Perl/mojolicious"

+ 2 - 2
frameworks/Nim/jester/jester.dockerfile

@@ -1,9 +1,9 @@
 FROM tfb/nimble:latest
 
-# 2015-06-25
+# 2018-02-28
 RUN git clone https://github.com/dom96/jester.git && \
     cd jester && \
-    git checkout 71b8cc069a0d271d619c2dc41bc6479047885587 && \
+    git checkout 86744f7dff56522c9baa1b4f4381db44044abd9f && \
     nimble update && \
     echo 'y' | nimble install
 

+ 11 - 0
frameworks/Nim/mofuw/README.md

@@ -0,0 +1,11 @@
+# [mofuw](https://github.com/2vg/mofuw) web framework
+
+## Description
+
+mofuw is *MO*re *F*aster, *U*ltra *W*eb server.
+
+## Test URLs
+
+### Test 1: Plaintext
+
+http://localhost:8080/plaintext

+ 21 - 0
frameworks/Nim/mofuw/benchmark_config.json

@@ -0,0 +1,21 @@
+{
+    "framework": "mofuw",
+    "tests": [{
+        "default": {
+            "setup_file": "setup",
+            "plaintext_url": "/plaintext",
+            "port": 8080,
+            "approach": "Realistic",
+            "classification": "Micro",
+            "database": "None",
+            "framework": "mofuw",
+            "language": "Nim",
+            "orm": "Raw",
+            "platform": "Nim",
+            "webserver": "mofuw",
+            "os": "Linux",
+            "database_os": "Linux",
+            "display_name": "mofuw"
+        }
+    }]
+}

+ 11 - 0
frameworks/Nim/mofuw/mofuw.dockerfile

@@ -0,0 +1,11 @@
+FROM tfb/nimble:latest
+
+RUN git clone https://github.com/2vg/mofuw.git && \
+    cd mofuw && \
+    echo 'y' | nimble install
+
+COPY ./ ./
+
+RUN nim c -d:release --threads:on techempower.nim
+
+CMD ./techempower

+ 9 - 0
frameworks/Nim/mofuw/techempower.nim

@@ -0,0 +1,9 @@
+import mofuw
+
+proc h(req: mofuwReq, res: mofuwRes) {.async.} =
+  if req.getPath == "/plaintext":
+    mofuwResp(HTTP200, "text/plain", "Hello, World!")
+  else:
+    mofuwResp(HTTP200, "text/plain", "404 NOT FOUND")
+
+h.mofuwRun(port = 8080, bufSize = 512)

+ 2 - 2
toolset/setup/docker/languages/nim.dockerfile

@@ -1,7 +1,7 @@
 FROM tfb/nginx:latest
 
-ENV NIM_VERSION="0.11.2"
-ENV NIM_CSOURCES="6bf2282"
+ENV NIM_VERSION="0.18.0"
+ENV NIM_CSOURCES="da97f85"
 
 RUN wget https://github.com/nim-lang/Nim/archive/v$NIM_VERSION.tar.gz
 RUN tar xvf v$NIM_VERSION.tar.gz

+ 1 - 1
toolset/setup/docker/systools/nimble.dockerfile

@@ -1,6 +1,6 @@
 FROM tfb/nim:latest
   
-ENV NIMBLE_VERSION="0.6.2"
+ENV NIMBLE_VERSION="0.8.10"
 
 RUN cd $NIM_HOME && \
     wget https://github.com/nim-lang/nimble/archive/v$NIMBLE_VERSION.tar.gz && \