Explorar o código

Add support for serverino (#10092)

* first serverino commit

* latest version

* log level off

* README

* serverino description

* pump up serverino version
Andrea Fontana hai 2 días
pai
achega
ad8aca66d0

+ 16 - 0
frameworks/D/serverino/.gitignore

@@ -0,0 +1,16 @@
+.dub
+docs.json
+__dummy.html
+docs/
+/serverino
+serverino.so
+serverino.dylib
+serverino.dll
+serverino.a
+serverino.lib
+serverino-test-*
+*.exe
+*.pdb
+*.o
+*.obj
+*.lst

+ 22 - 0
frameworks/D/serverino/README.md

@@ -0,0 +1,22 @@
+# serverino Benchmarking Test
+
+## About Serverino
+
+Serverino is a small and ready-to-go http server written in D.
+
+- Homepage: https://github.com/trikko/serverino
+
+### Test Type Implementation Source Code
+
+* [JSON](source/app.d)
+* [PLAINTEXT](source/app.d)
+
+## Test URLs
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext
+

+ 26 - 0
frameworks/D/serverino/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "serverino",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "None",
+        "framework": "serverino",
+        "language": "D",
+        "flavor": "None",
+        "orm": "None",
+        "platform": "None",
+        "webserver": "None",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "serverino",
+        "notes": "",
+        "versus": "None"
+      }
+    }
+  ]
+}

+ 14 - 0
frameworks/D/serverino/dub.json

@@ -0,0 +1,14 @@
+{
+	"authors": [
+		"Andrea Fontana"
+	],
+	"dependencies": {
+		"serverino": "~>0.7.19"
+	},
+	"dflags-ldc": [
+		"-static",
+		"-nodefaultlib"
+	],
+	"license": "proprietary",
+	"name": "serverino-benchmark"
+}

+ 16 - 0
frameworks/D/serverino/serverino.dockerfile

@@ -0,0 +1,16 @@
+FROM alpine:latest
+RUN apk update && apk upgrade
+RUN apk add gcc musl-dev ldc dub llvm-libunwind-static openssl-libs-static git make
+RUN ln -fs /usr/share/zoneinfo/Europe/Rome /etc/localtime
+RUN apk add tzdata
+RUN apk cache clean
+
+RUN adduser -D -S www-data
+
+WORKDIR /app
+COPY . .
+RUN dub build --build=release-nobounds
+
+EXPOSE 8080
+USER www-data
+CMD ["./serverino-benchmark"]

+ 36 - 0
frameworks/D/serverino/source/app.d

@@ -0,0 +1,36 @@
+module app;
+
+import std.logger;
+import std.json;
+import serverino;
+import std.parallelism: totalCPUs;
+
+mixin ServerinoMain;
+
+void catchAll(Request request, Output output)
+{
+	if (request.path == "/json") {
+
+		output ~= JSONValue(["message" : "Hello, World!"]).toString();
+		output.addHeader("content-type", "application/json");
+	}
+	else if (request.path == "/plaintext") {
+		output ~= "Hello, World!";
+		output.addHeader("content-type", "text/plain");
+	}
+	else output.status = 200;
+}
+
+
+@onServerInit ServerinoConfig configure()
+{
+	return ServerinoConfig
+		.create()
+		.setLogLevel(LogLevel.off)
+		.enableServerSignature(true)
+		.setWorkers(4)
+		.setDaemonInstances(10)
+		.addListener("0.0.0.0", 8080);
+}
+
+