Browse Source

Port clojure tests to docker (#3373)

* Port clojure tests to docker

* Avoid connecting to the db at compile time in http-kit and compojure

* Move leningen-java8.dockerfile to new location
Michael Hixson 7 years ago
parent
commit
2ad6f3a6aa
95 changed files with 145 additions and 405 deletions
  1. 7 7
      .travis.yml
  2. 12 0
      frameworks/Clojure/aleph/aleph.dockerfile
  3. 0 1
      frameworks/Clojure/aleph/benchmark_config.json
  4. 0 11
      frameworks/Clojure/aleph/hello/.gitignore
  5. 0 0
      frameworks/Clojure/aleph/project.clj
  6. 0 8
      frameworks/Clojure/aleph/setup.sh
  7. 0 2
      frameworks/Clojure/aleph/source_code
  8. 0 0
      frameworks/Clojure/aleph/src/hello/handler.clj
  9. 0 0
      frameworks/Clojure/aleph/src/log4j.xml
  10. 10 12
      frameworks/Clojure/compojure/benchmark_config.json
  11. 8 0
      frameworks/Clojure/compojure/compojure-base.dockerfile
  12. 2 0
      frameworks/Clojure/compojure/compojure-raw.dockerfile
  13. 2 0
      frameworks/Clojure/compojure/compojure.dockerfile
  14. 0 11
      frameworks/Clojure/compojure/hello/.gitignore
  15. 0 19
      frameworks/Clojure/compojure/hello/README.md
  16. 0 0
      frameworks/Clojure/compojure/project.clj
  17. 0 10
      frameworks/Clojure/compojure/setup.sh
  18. 0 2
      frameworks/Clojure/compojure/source_code
  19. 22 21
      frameworks/Clojure/compojure/src/hello/handler.clj
  20. 0 0
      frameworks/Clojure/compojure/src/log4j.xml
  21. 0 2
      frameworks/Clojure/http-kit/benchmark_config.json
  22. 0 11
      frameworks/Clojure/http-kit/hello/.gitignore
  23. 0 19
      frameworks/Clojure/http-kit/hello/README.md
  24. 6 0
      frameworks/Clojure/http-kit/http-kit-base.dockerfile
  25. 2 0
      frameworks/Clojure/http-kit/http-kit-raw.dockerfile
  26. 2 0
      frameworks/Clojure/http-kit/http-kit.dockerfile
  27. 0 0
      frameworks/Clojure/http-kit/project.clj
  28. 0 15
      frameworks/Clojure/http-kit/setup.sh
  29. 0 2
      frameworks/Clojure/http-kit/source_code
  30. 23 22
      frameworks/Clojure/http-kit/src/hello/handler.clj
  31. 0 0
      frameworks/Clojure/http-kit/src/log4j.xml
  32. 0 0
      frameworks/Clojure/luminus/Procfile
  33. 0 1
      frameworks/Clojure/luminus/benchmark_config.json
  34. 0 0
      frameworks/Clojure/luminus/env/dev/clj/hello/dev_middleware.clj
  35. 0 0
      frameworks/Clojure/luminus/env/dev/clj/hello/env.clj
  36. 0 0
      frameworks/Clojure/luminus/env/dev/clj/user.clj
  37. 0 0
      frameworks/Clojure/luminus/env/dev/resources/config.edn
  38. 0 0
      frameworks/Clojure/luminus/env/dev/resources/log4j.properties
  39. 0 0
      frameworks/Clojure/luminus/env/prod/clj/hello/env.clj
  40. 3 0
      frameworks/Clojure/luminus/env/prod/resources/config.edn
  41. 0 0
      frameworks/Clojure/luminus/env/prod/resources/log4j.properties
  42. 0 0
      frameworks/Clojure/luminus/env/test/resources/config.edn
  43. 0 12
      frameworks/Clojure/luminus/hello/.gitignore
  44. 0 21
      frameworks/Clojure/luminus/hello/README.md
  45. 0 3
      frameworks/Clojure/luminus/hello/env/prod/resources/config.edn
  46. 6 0
      frameworks/Clojure/luminus/luminus.dockerfile
  47. 0 0
      frameworks/Clojure/luminus/project.clj
  48. 0 0
      frameworks/Clojure/luminus/resources/docs/docs.md
  49. 0 0
      frameworks/Clojure/luminus/resources/public/css/screen.css
  50. 0 0
      frameworks/Clojure/luminus/resources/public/favicon.ico
  51. 0 0
      frameworks/Clojure/luminus/resources/sql/queries.sql
  52. 0 0
      frameworks/Clojure/luminus/resources/templates/about.html
  53. 0 0
      frameworks/Clojure/luminus/resources/templates/base.html
  54. 0 0
      frameworks/Clojure/luminus/resources/templates/error.html
  55. 0 0
      frameworks/Clojure/luminus/resources/templates/home.html
  56. 0 13
      frameworks/Clojure/luminus/setup.sh
  57. 0 32
      frameworks/Clojure/luminus/source_code
  58. 0 0
      frameworks/Clojure/luminus/src/clj/hello/config.clj
  59. 0 0
      frameworks/Clojure/luminus/src/clj/hello/core.clj
  60. 0 0
      frameworks/Clojure/luminus/src/clj/hello/db/core.clj
  61. 0 0
      frameworks/Clojure/luminus/src/clj/hello/handler.clj
  62. 0 0
      frameworks/Clojure/luminus/src/clj/hello/layout.clj
  63. 0 0
      frameworks/Clojure/luminus/src/clj/hello/routes/home.clj
  64. 0 0
      frameworks/Clojure/luminus/test/clj/hello/test/db/core.clj
  65. 0 0
      frameworks/Clojure/luminus/test/clj/hello/test/handler.clj
  66. 0 1
      frameworks/Clojure/macchiato/benchmark_config.json
  67. 0 0
      frameworks/Clojure/macchiato/env/dev/hello/app.cljs
  68. 0 0
      frameworks/Clojure/macchiato/env/dev/user.clj
  69. 0 0
      frameworks/Clojure/macchiato/env/prod/hello/app.cljs
  70. 0 0
      frameworks/Clojure/macchiato/env/test/hello/app.cljs
  71. 0 49
      frameworks/Clojure/macchiato/hello/README.md
  72. 8 0
      frameworks/Clojure/macchiato/macchiato.dockerfile
  73. 0 0
      frameworks/Clojure/macchiato/project.clj
  74. 0 10
      frameworks/Clojure/macchiato/setup.sh
  75. 0 12
      frameworks/Clojure/macchiato/source_code
  76. 0 0
      frameworks/Clojure/macchiato/src/hello/config.cljs
  77. 0 0
      frameworks/Clojure/macchiato/src/hello/core.cljs
  78. 1 1
      frameworks/Clojure/macchiato/src/hello/db.cljs
  79. 0 0
      frameworks/Clojure/macchiato/src/hello/middleware.cljs
  80. 0 0
      frameworks/Clojure/macchiato/src/hello/routes.cljs
  81. 0 1
      frameworks/Clojure/pedestal/benchmark_config.json
  82. 11 0
      frameworks/Clojure/pedestal/pedestal.dockerfile
  83. 0 29
      frameworks/Clojure/pedestal/perfit.sh
  84. 0 4
      frameworks/Clojure/pedestal/run.sh
  85. 0 17
      frameworks/Clojure/pedestal/setup.sh
  86. 2 2
      frameworks/Clojure/pedestal/src/pedestal/pdg.clj
  87. 0 1
      frameworks/Clojure/reitit/benchmark_config.json
  88. 0 11
      frameworks/Clojure/reitit/hello/.gitignore
  89. 0 0
      frameworks/Clojure/reitit/project.clj
  90. 11 0
      frameworks/Clojure/reitit/reitit.dockerfile
  91. 0 8
      frameworks/Clojure/reitit/setup.sh
  92. 0 2
      frameworks/Clojure/reitit/source_code
  93. 0 0
      frameworks/Clojure/reitit/src/hello/handler.clj
  94. 0 0
      frameworks/Clojure/reitit/src/log4j.xml
  95. 7 0
      toolset/setup/docker/systools/leiningen-java8.dockerfile

+ 7 - 7
.travis.yml

@@ -30,13 +30,13 @@ env:
     # - "TESTDIR=C++/wt"
     # - "TESTDIR=C++/poco"
     # - "TESTDIR=C++/luna"
-    # - "TESTDIR=Clojure/compojure"
-    # - "TESTDIR=Clojure/http-kit"
-    # - "TESTDIR=Clojure/luminus"
-    # - "TESTDIR=Clojure/macchiato"
-    # - "TESTDIR=Clojure/pedestal"
-    # - "TESTDIR=Clojure/aleph"
-    # - "TESTDIR=Clojure/reitit"
+     - "TESTDIR=Clojure/aleph"
+     - "TESTDIR=Clojure/compojure"
+     - "TESTDIR=Clojure/http-kit"
+     - "TESTDIR=Clojure/luminus"
+     - "TESTDIR=Clojure/macchiato"
+     - "TESTDIR=Clojure/pedestal"
+     - "TESTDIR=Clojure/reitit"
      - "TESTDIR=Crystal/amber"
      - "TESTDIR=Crystal/crystal"
      - "TESTDIR=Crystal/kemal"

+ 12 - 0
frameworks/Clojure/aleph/aleph.dockerfile

@@ -0,0 +1,12 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /aleph
+WORKDIR /aleph
+RUN lein clean
+RUN lein uberjar
+RUN ls -alh
+CMD java \
+    -server \
+    -Xmx2g \
+    -XX:+UseG1GC \
+    -XX:MaxGCPauseMillis=10 \
+    -jar target/*-standalone.jar

+ 0 - 1
frameworks/Clojure/aleph/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "aleph",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/json",
       "plaintext_url": "/plaintext",
       "port": 8080,

+ 0 - 11
frameworks/Clojure/aleph/hello/.gitignore

@@ -1,11 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-*.jar
-*.class
-.lein-deps-sum
-.lein-failures
-.lein-plugins
-.lein-env

+ 0 - 0
frameworks/Clojure/aleph/hello/project.clj → frameworks/Clojure/aleph/project.clj


+ 0 - 8
frameworks/Clojure/aleph/setup.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-fw_depends java8 leiningen
-
-cd hello
-lein clean
-lein uberjar
-java -server -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -jar target/*-standalone.jar &

+ 0 - 2
frameworks/Clojure/aleph/source_code

@@ -1,2 +0,0 @@
-./aleph/hello/src/hello/handler.clj
-./aleph/hello/project.clj

+ 0 - 0
frameworks/Clojure/aleph/hello/src/hello/handler.clj → frameworks/Clojure/aleph/src/hello/handler.clj


+ 0 - 0
frameworks/Clojure/aleph/hello/src/log4j.xml → frameworks/Clojure/aleph/src/log4j.xml


+ 10 - 12
frameworks/Clojure/compojure/benchmark_config.json

@@ -2,13 +2,12 @@
   "framework": "compojure",
   "tests": [{
     "default": {
-      "setup_file": "setup",
-      "json_url": "/compojure/json",
-      "db_url": "/compojure/db",
-      "query_url": "/compojure/queries/",
-      "update_url": "/compojure/updates/",
-      "fortune_url": "/compojure/fortunes",
-      "plaintext_url": "/compojure/plaintext",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/queries/",
+      "update_url": "/updates/",
+      "fortune_url": "/fortunes",
+      "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",
@@ -26,11 +25,10 @@
       "versus": "servlet"
     },
     "raw": {
-      "setup_file": "setup",
-      "db_url": "/compojure/raw/db",
-      "query_url": "/compojure/raw/queries/",
-      "update_url": "/compojure/raw/updates/",
-      "fortune_url": "/compojure/raw/fortunes",
+      "db_url": "/raw/db",
+      "query_url": "/raw/queries/",
+      "update_url": "/raw/updates/",
+      "fortune_url": "/raw/fortunes",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",

+ 8 - 0
frameworks/Clojure/compojure/compojure-base.dockerfile

@@ -0,0 +1,8 @@
+FROM tfb/leiningen-java8:latest as leiningen
+ADD ./ /compojure
+WORKDIR /compojure
+RUN lein clean
+RUN lein ring uberwar
+
+FROM tfb/resin-java8:latest
+COPY --from=leiningen /compojure/target/hello-compojure-standalone.war /var/resin/webapps/ROOT.war

+ 2 - 0
frameworks/Clojure/compojure/compojure-raw.dockerfile

@@ -0,0 +1,2 @@
+FROM tfb/compojure-base:latest
+CMD resinctl console

+ 2 - 0
frameworks/Clojure/compojure/compojure.dockerfile

@@ -0,0 +1,2 @@
+FROM tfb/compojure-base:latest
+CMD resinctl console

+ 0 - 11
frameworks/Clojure/compojure/hello/.gitignore

@@ -1,11 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-*.jar
-*.class
-.lein-deps-sum
-.lein-failures
-.lein-plugins
-.lein-env

+ 0 - 19
frameworks/Clojure/compojure/hello/README.md

@@ -1,19 +0,0 @@
-# hello
-
-FIXME
-
-## Prerequisites
-
-You will need [Leiningen][1] 1.7.0 or above installed.
-
-[1]: https://github.com/technomancy/leiningen
-
-## Running
-
-To start a web server for the application, run:
-
-    lein ring server
-
-## License
-
-Copyright © 2013 FIXME

+ 0 - 0
frameworks/Clojure/compojure/hello/project.clj → frameworks/Clojure/compojure/project.clj


+ 0 - 10
frameworks/Clojure/compojure/setup.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-fw_depends mysql java8 resin-java8 leiningen
-
-cd hello
-lein clean
-lein ring uberwar
-rm -rf $RESIN_HOME/webapps/*
-cp target/hello-compojure-standalone.war $RESIN_HOME/webapps/compojure.war
-resinctl console

+ 0 - 2
frameworks/Clojure/compojure/source_code

@@ -1,2 +0,0 @@
-./compojure/hello/project.clj
-./compojure/hello/src/hello/handler.clj

+ 22 - 21
frameworks/Clojure/compojure/hello/src/hello/handler.clj → frameworks/Clojure/compojure/src/hello/handler.clj

@@ -36,30 +36,31 @@
           :delimiters "" ;; remove delimiters
           :maximum-pool-size 256}))
 
-;; MySQL database connection for java.jdbc "raw" using HikariCP
-(def datasource-options-hikaricp {:auto-commit        true
-                                  :read-only          false
-                                  :connection-timeout 30000
-                                  :validation-timeout 5000
-                                  :idle-timeout       600000
-                                  :max-lifetime       1800000
-                                  :minimum-idle       10
-                                  :maximum-pool-size  256
-                                  :pool-name          "db-pool"
-                                  :adapter            "mysql"
-                                  :username           "benchmarkdbuser"
-                                  :password           "benchmarkdbpass"
-                                  :database-name      "hello_world"
-                                  :server-name        "TFB-database"
-                                  :port-number        3306
-                                  :register-mbeans    false})
-
 ;; Create HikariCP-pooled "raw" jdbc data source
-(def db-spec-mysql-raw-hikaricp
-  (make-datasource datasource-options-hikaricp))
+(defn make-hikari-data-source
+  []
+  (make-datasource {:auto-commit        true
+                    :read-only          false
+                    :connection-timeout 30000
+                    :validation-timeout 5000
+                    :idle-timeout       600000
+                    :max-lifetime       1800000
+                    :minimum-idle       10
+                    :maximum-pool-size  256
+                    :pool-name          "db-pool"
+                    :adapter            "mysql"
+                    :username           "benchmarkdbuser"
+                    :password           "benchmarkdbpass"
+                    :database-name      "hello_world"
+                    :server-name        "TFB-database"
+                    :port-number        3306
+                    :register-mbeans    false}))
+
+;; Reuse a single HikariCP-pooled data source
+(def memoize-hikari-data-source (memoize make-hikari-data-source))
 
 ;; Get a HikariCP-pooled "raw" jdbc connection
-(defn db-mysql-raw [] {:datasource db-spec-mysql-raw-hikaricp})
+(defn db-mysql-raw [] {:datasource (memoize-hikari-data-source)})
 
 ;; Set up entity World and the database representation
 (defentity world

+ 0 - 0
frameworks/Clojure/compojure/hello/src/log4j.xml → frameworks/Clojure/compojure/src/log4j.xml


+ 0 - 2
frameworks/Clojure/http-kit/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "http-kit",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/json",
       "db_url": "/db",
       "query_url": "/queries/",
@@ -26,7 +25,6 @@
       "versus": "http-kit"
     },
     "raw": {
-      "setup_file": "setup",
       "db_url": "/raw/db",
       "query_url": "/raw/queries/",
       "update_url": "/raw/updates/",

+ 0 - 11
frameworks/Clojure/http-kit/hello/.gitignore

@@ -1,11 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-*.jar
-*.class
-.lein-deps-sum
-.lein-failures
-.lein-plugins
-.lein-env

+ 0 - 19
frameworks/Clojure/http-kit/hello/README.md

@@ -1,19 +0,0 @@
-# hello
-
-FIXME
-
-## Prerequisites
-
-You will need [Leiningen][1] 1.7.0 or above installed.
-
-[1]: https://github.com/technomancy/leiningen
-
-## Running
-
-To start a web server for the application, run:
-
-    lein ring server
-
-## License
-
-Copyright © 2013 FIXME

+ 6 - 0
frameworks/Clojure/http-kit/http-kit-base.dockerfile

@@ -0,0 +1,6 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /http-kit
+WORKDIR /http-kit
+RUN lein clean
+RUN lein deps
+RUN lein uberjar

+ 2 - 0
frameworks/Clojure/http-kit/http-kit-raw.dockerfile

@@ -0,0 +1,2 @@
+FROM tfb/http-kit-base:latest
+CMD java -server -jar target/http-kit-standalone.jar

+ 2 - 0
frameworks/Clojure/http-kit/http-kit.dockerfile

@@ -0,0 +1,2 @@
+FROM tfb/http-kit-base:latest
+CMD java -server -jar target/http-kit-standalone.jar

+ 0 - 0
frameworks/Clojure/http-kit/hello/project.clj → frameworks/Clojure/http-kit/project.clj


+ 0 - 15
frameworks/Clojure/http-kit/setup.sh

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-fw_depends mysql leiningen java8
-
-sed -i 's|127.0.0.1|'"${DBHOST}"'|g' hello/src/hello/handler.clj
-
-cd hello
-lein clean
-lein deps
-rm -rf target
-# pack all dependencies into a single jar: target/http-kit-standalone.jar
-lein uberjar
-# -server is much faster
-# 'lein run' passes '-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' which make it starts fast, but runs slow
-java -server -jar target/http-kit-standalone.jar  &

+ 0 - 2
frameworks/Clojure/http-kit/source_code

@@ -1,2 +0,0 @@
-./http-kit/hello/project.clj
-./http-kit/hello/src/hello/handler.clj

+ 23 - 22
frameworks/Clojure/http-kit/hello/src/hello/handler.clj → frameworks/Clojure/http-kit/src/hello/handler.clj

@@ -31,37 +31,38 @@
   (mysql {
     :classname "com.mysql.jdbc.Driver"
     :subprotocol "mysql"
-    :subname "//127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true&useSSL=false"
+    :subname "//TFB-database:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true&useSSL=false"
     :user "benchmarkdbuser"
     :password "benchmarkdbpass"
     ;;OPTIONAL KEYS
     :delimiters "" ;; remove delimiters
     :maximum-pool-size 256}))
 
-;; MySQL database connection for java.jdbc "raw" using HikariCP
-(def datasource-options-hikaricp {:auto-commit        true
-                                  :read-only          false
-                                  :connection-timeout 30000
-                                  :validation-timeout 5000
-                                  :idle-timeout       600000
-                                  :max-lifetime       1800000
-                                  :minimum-idle       10
-                                  :maximum-pool-size  256
-                                  :pool-name          "db-pool"
-                                  :adapter            "mysql"
-                                  :username           "benchmarkdbuser"
-                                  :password           "benchmarkdbpass"
-                                  :database-name      "hello_world"
-                                  :server-name        "127.0.0.1"
-                                  :port-number        3306
-                                  :register-mbeans    false})
-
 ;; Create HikariCP-pooled "raw" jdbc data source
-(def db-spec-mysql-raw-hikaricp
-  (make-datasource datasource-options-hikaricp))
+(defn make-hikari-data-source
+  []
+  (make-datasource {:auto-commit        true
+                    :read-only          false
+                    :connection-timeout 30000
+                    :validation-timeout 5000
+                    :idle-timeout       600000
+                    :max-lifetime       1800000
+                    :minimum-idle       10
+                    :maximum-pool-size  256
+                    :pool-name          "db-pool"
+                    :adapter            "mysql"
+                    :username           "benchmarkdbuser"
+                    :password           "benchmarkdbpass"
+                    :database-name      "hello_world"
+                    :server-name        "TFB-database"
+                    :port-number        3306
+                    :register-mbeans    false}))
+
+;; Reuse a single HikariCP-pooled data source
+(def memoize-hikari-data-source (memoize make-hikari-data-source))
 
 ;; Get a HikariCP-pooled "raw" jdbc connection
-(defn db-mysql-raw [] {:datasource db-spec-mysql-raw-hikaricp})
+(defn db-mysql-raw [] {:datasource (memoize-hikari-data-source)})
 
 ;; Set up entity World and the database representation
 (defentity world

+ 0 - 0
frameworks/Clojure/http-kit/hello/src/log4j.xml → frameworks/Clojure/http-kit/src/log4j.xml


+ 0 - 0
frameworks/Clojure/luminus/hello/Procfile → frameworks/Clojure/luminus/Procfile


+ 0 - 1
frameworks/Clojure/luminus/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "luminus",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/io/json",
       "plaintext_url": "/io/plaintext",
       "db_url": "/db",

+ 0 - 0
frameworks/Clojure/luminus/hello/env/dev/clj/hello/dev_middleware.clj → frameworks/Clojure/luminus/env/dev/clj/hello/dev_middleware.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/env/dev/clj/hello/env.clj → frameworks/Clojure/luminus/env/dev/clj/hello/env.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/env/dev/clj/user.clj → frameworks/Clojure/luminus/env/dev/clj/user.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/env/dev/resources/config.edn → frameworks/Clojure/luminus/env/dev/resources/config.edn


+ 0 - 0
frameworks/Clojure/luminus/hello/env/dev/resources/log4j.properties → frameworks/Clojure/luminus/env/dev/resources/log4j.properties


+ 0 - 0
frameworks/Clojure/luminus/hello/env/prod/clj/hello/env.clj → frameworks/Clojure/luminus/env/prod/clj/hello/env.clj


+ 3 - 0
frameworks/Clojure/luminus/env/prod/resources/config.edn

@@ -0,0 +1,3 @@
+{:production true
+ :port 3000
+ :database-url "jdbc:postgresql://TFB-database:5432/hello_world?user=benchmarkdbuser&password=benchmarkdbpass&jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"}

+ 0 - 0
frameworks/Clojure/luminus/hello/env/prod/resources/log4j.properties → frameworks/Clojure/luminus/env/prod/resources/log4j.properties


+ 0 - 0
frameworks/Clojure/luminus/hello/env/test/resources/config.edn → frameworks/Clojure/luminus/env/test/resources/config.edn


+ 0 - 12
frameworks/Clojure/luminus/hello/.gitignore

@@ -1,12 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-*.jar
-*.class
-/.lein-*
-profiles.clj
-/.env
-.nrepl-port
-/log

+ 0 - 21
frameworks/Clojure/luminus/hello/README.md

@@ -1,21 +0,0 @@
-# hello
-
-generated using Luminus version "2.9.10.13"
-
-FIXME
-
-## Prerequisites
-
-You will need [Leiningen][1] 2.0 or above installed.
-
-[1]: https://github.com/technomancy/leiningen
-
-## Running
-
-To start a web server for the application, run:
-
-    lein run
-
-## License
-
-Copyright © 2016 FIXME

+ 0 - 3
frameworks/Clojure/luminus/hello/env/prod/resources/config.edn

@@ -1,3 +0,0 @@
-{:production true
- :port 3000
- :database-url "jdbc:postgresql://127.0.0.1:5432/hello_world?user=benchmarkdbuser&password=benchmarkdbpass&jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"}

+ 6 - 0
frameworks/Clojure/luminus/luminus.dockerfile

@@ -0,0 +1,6 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /luminus
+WORKDIR /luminus
+RUN lein clean
+RUN lein uberjar
+CMD java -server -jar target/hello.jar

+ 0 - 0
frameworks/Clojure/luminus/hello/project.clj → frameworks/Clojure/luminus/project.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/docs/docs.md → frameworks/Clojure/luminus/resources/docs/docs.md


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/public/css/screen.css → frameworks/Clojure/luminus/resources/public/css/screen.css


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/public/favicon.ico → frameworks/Clojure/luminus/resources/public/favicon.ico


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/sql/queries.sql → frameworks/Clojure/luminus/resources/sql/queries.sql


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/templates/about.html → frameworks/Clojure/luminus/resources/templates/about.html


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/templates/base.html → frameworks/Clojure/luminus/resources/templates/base.html


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/templates/error.html → frameworks/Clojure/luminus/resources/templates/error.html


+ 0 - 0
frameworks/Clojure/luminus/hello/resources/templates/home.html → frameworks/Clojure/luminus/resources/templates/home.html


+ 0 - 13
frameworks/Clojure/luminus/setup.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-fw_depends postgresql java8 resin-java8 leiningen
-
-# Update db host in the source file
-sed -i 's|127.0.0.1|'"${DBHOST}"'|g' hello/env/prod/resources/config.edn
-
-cd hello
-lein clean
-rm -rf target
-# pack all dependencies into a single jar: target/hello.jar
-lein uberjar
-java -server -jar target/hello.jar  &

+ 0 - 32
frameworks/Clojure/luminus/source_code

@@ -1,32 +0,0 @@
-./hello/Procfile
-./hello/README.md
-./hello/env/dev/clj/hello/dev_middleware.clj
-./hello/env/dev/clj/hello/env.clj
-./hello/env/dev/clj/user.clj
-./hello/env/dev/resources/config.edn
-./hello/env/dev/resources/log4j.properties
-./hello/env/prod/clj/hello/env.clj
-./hello/env/prod/resources/config.edn
-./hello/env/prod/resources/log4j.properties
-./hello/env/test/resources/config.edn
-./hello/project.clj
-./hello/resources/docs/docs.md
-./hello/resources/migrations/20160307145316-add-users-table.down.sql
-./hello/resources/migrations/20160307145316-add-users-table.up.sql
-./hello/resources/public/css/screen.css
-./hello/resources/public/favicon.ico
-./hello/resources/sql/queries.sql
-./hello/resources/templates/about.html
-./hello/resources/templates/base.html
-./hello/resources/templates/error.html
-./hello/resources/templates/home.html
-./hello/src/clj/hello/config.clj
-./hello/src/clj/hello/core.clj
-./hello/src/clj/hello/db/core.clj
-./hello/src/clj/hello/handler.clj
-./hello/src/clj/hello/layout.clj
-./hello/src/clj/hello/middleware.clj
-./hello/src/clj/hello/routes/home.clj
-./hello/test/clj
-./hello/test/clj/hello/test/db/core.clj
-./hello/test/clj/hello/test/handler.clj

+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/config.clj → frameworks/Clojure/luminus/src/clj/hello/config.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/core.clj → frameworks/Clojure/luminus/src/clj/hello/core.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/db/core.clj → frameworks/Clojure/luminus/src/clj/hello/db/core.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/handler.clj → frameworks/Clojure/luminus/src/clj/hello/handler.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/layout.clj → frameworks/Clojure/luminus/src/clj/hello/layout.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/src/clj/hello/routes/home.clj → frameworks/Clojure/luminus/src/clj/hello/routes/home.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/test/clj/hello/test/db/core.clj → frameworks/Clojure/luminus/test/clj/hello/test/db/core.clj


+ 0 - 0
frameworks/Clojure/luminus/hello/test/clj/hello/test/handler.clj → frameworks/Clojure/luminus/test/clj/hello/test/handler.clj


+ 0 - 1
frameworks/Clojure/macchiato/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "macchiato",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/json",
       "plaintext_url": "/plaintext",
       "db_url": "/db",

+ 0 - 0
frameworks/Clojure/macchiato/hello/env/dev/hello/app.cljs → frameworks/Clojure/macchiato/env/dev/hello/app.cljs


+ 0 - 0
frameworks/Clojure/macchiato/hello/env/dev/user.clj → frameworks/Clojure/macchiato/env/dev/user.clj


+ 0 - 0
frameworks/Clojure/macchiato/hello/env/prod/hello/app.cljs → frameworks/Clojure/macchiato/env/prod/hello/app.cljs


+ 0 - 0
frameworks/Clojure/macchiato/hello/env/test/hello/app.cljs → frameworks/Clojure/macchiato/env/test/hello/app.cljs


+ 0 - 49
frameworks/Clojure/macchiato/hello/README.md

@@ -1,49 +0,0 @@
-## Welcome to hello
-
-### Prequisites
-
-[Node.js](https://nodejs.org/en/) needs to be installed to run the application.
-
-### running in development mode
-
-run the following command in the terminal to install NPM modules and start Figwheel:
-
-```
-lein build
-```
-
-run `node` in another terminal:
-
-```
-npm start
-```
-
-#### configuring the REPL
-
-Once Figwheel and node are running, you can connect to the remote REPL at `localhost:7000`.
-
-Type `(cljs)` in the REPL to connect to Figwheel ClojureScript REPL.
-
-
-### building the release version
-
-```
-lein package
-```
-
-Run the release version:
-
-```
-npm start
-```
-
-### Running using Docker
-
-The template comes with a `Dockerfile` for running the application using Docker
-
-Once you've run `lein package`, you can build and run a Docker container as follows:
-
-```
-docker build -t hello:latest .
-docker run -p 3000:3000 hello:latest
-```

+ 8 - 0
frameworks/Clojure/macchiato/macchiato.dockerfile

@@ -0,0 +1,8 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /macchiato
+WORKDIR /macchiato
+ENV NODE_ENV=production
+RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
+RUN apt install -y nodejs
+RUN lein package
+CMD node target/release/hello.js

+ 0 - 0
frameworks/Clojure/macchiato/hello/project.clj → frameworks/Clojure/macchiato/project.clj


+ 0 - 10
frameworks/Clojure/macchiato/setup.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-fw_depends postgresql nodejs java8 leiningen
-
-# Update db host in the source file
-sed -i 's|localhost|'"${DBHOST}"'|g' hello/src/hello/db.cljs
-
-cd hello
-lein package
-node target/release/hello.js &

+ 0 - 12
frameworks/Clojure/macchiato/source_code

@@ -1,12 +0,0 @@
-./hello/env/dev/hello/app.cljs
-./hello/env/dev/user.clj
-./hello/env/prod/hello/app.cljs
-./hello/env/test/hello/app.cljs
-./hello/package.json
-./hello/project.clj
-./hello/README.md
-./hello/src/hello/config.cljs
-./hello/src/hello/core.cljs
-./hello/src/hello/db.cljs
-./hello/src/hello/middleware.cljs
-./hello/src/hello/routes.cljs

+ 0 - 0
frameworks/Clojure/macchiato/hello/src/hello/config.cljs → frameworks/Clojure/macchiato/src/hello/config.cljs


+ 0 - 0
frameworks/Clojure/macchiato/hello/src/hello/core.cljs → frameworks/Clojure/macchiato/src/hello/core.cljs


+ 1 - 1
frameworks/Clojure/macchiato/hello/src/hello/db.cljs → frameworks/Clojure/macchiato/src/hello/db.cljs

@@ -10,7 +10,7 @@
            "hello_world"
            "benchmarkdbuser"
            "benchmarkdbpass"
-           #js {:host    "localhost"
+           #js {:host    "TFB-database"
                 :dialect "postgres"
                 :logging false
                 :pool #js {:max 64

+ 0 - 0
frameworks/Clojure/macchiato/hello/src/hello/middleware.cljs → frameworks/Clojure/macchiato/src/hello/middleware.cljs


+ 0 - 0
frameworks/Clojure/macchiato/hello/src/hello/routes.cljs → frameworks/Clojure/macchiato/src/hello/routes.cljs


+ 0 - 1
frameworks/Clojure/pedestal/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "pedestal",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/json",
       "plaintext_url": "/plaintext",
       "db_url": "/db",

+ 11 - 0
frameworks/Clojure/pedestal/pedestal.dockerfile

@@ -0,0 +1,11 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /pedestal
+WORKDIR /pedestal
+RUN lein clean
+RUN lein uberjar
+CMD java \
+    -jar \
+    -D"io.pedestal.log.defaultMetricsRecorder=nil" \
+    -D"io.pedestal.log.overrideLogger=nil" \
+    target/pedestal-standalone.jar
+

+ 0 - 29
frameworks/Clojure/pedestal/perfit.sh

@@ -1,29 +0,0 @@
-#!/bin/bash
-
-# To run this, just call: sh ./perfit.sh
-# You may also optionally pass a port and URL, it must start with a slashL sh ./perfit.sh 8383 /about
-
-# THIS IS TO ONLY GET A BASELINE MARK!  THIS DOES NOT REFLECT PROD PERFORMANCE
-# THE GOAL IS TO HAVE SO NOTION OF PERF AND POTENTIAL REGRESSIONS
-
-HOST='127.0.0.1'
-port=8080
-PORT=${1:-$port}
-url="/"
-URL=${2:-$url}
-WRK2="`which wrk2` -R 1000"
-WRK=`which wrk`
-
-## Uncomment the desired benchmarks
-#httperf --close-with-reset --session-cookies --hog  --server $HOST --port $PORT --uri $URL --wsess=40,5,2 --rate 2 --timeout 5
-#echo
-#siege -c 20 -t 30S http://$HOST:$PORT$URL 1> /dev/null
-#echo
-echo "Measuring constant throughput, consistent latency..."
-echo
-$WRK2 -t4 -c24 -d10s http://$HOST:$PORT$URL
-echo
-echo "Benching..."
-echo
-$WRK -t2 -c12 -d30s http://$HOST:$PORT$URL
-

+ 0 - 4
frameworks/Clojure/pedestal/run.sh

@@ -1,4 +0,0 @@
-rm -r ./target; lein clean
-lein uberjar
-java -jar -D"io.pedestal.log.defaultMetricsRecorder=nil" -D"io.pedestal.log.overrideLogger=nil" target/pedestal-standalone.jar
-

+ 0 - 17
frameworks/Clojure/pedestal/setup.sh

@@ -1,17 +0,0 @@
-#!/bin/bash
-
-fw_depends mysql java8 leiningen
-
-sed -i 's|127.0.0.1:3306|'${DBHOST}':3306|g' src/pedestal/pdg.clj
-
-lein clean
-
-rm -rf target
-# pack all dependencies into a single jar: target/pedestal-standalone.jar
-lein uberjar
-
-# java -jar target/pedestal-standalone.jar &
-# java -XX:+AggressiveOpts -jar -D"io.pedestal.log.defaultMetricsRecorder=nil" -D"io.pedestal.log.overrideLogger=nil" target/pedestal-standalone.jar &
-#java -jar -D"io.pedestal.log.defaultMetricsRecorder=nil" -D"io.pedestal.log.overrideLogger=nil" target/pedestal-standalone.jar > /dev/null 2>&1 &
-java -jar -D"io.pedestal.log.defaultMetricsRecorder=nil" -D"io.pedestal.log.overrideLogger=nil" target/pedestal-standalone.jar &
-

+ 2 - 2
frameworks/Clojure/pedestal/src/pedestal/pdg.clj

@@ -62,8 +62,8 @@
                  (.setUsername "benchmarkdbuser")
                  (.setPassword "benchmarkdbpass")
                  ;(.setDataSourceClassName "com.mysql.jdbc.jdbc2.optional.MysqlDataSource")
-                 ;(.setJdbcUrl "jdbc:mysql://127.0.0.1:3306/hello_world?username=benchmarkdbuser&password=benchmarkdbpass")
-                 (.setJdbcUrl "jdbc:mysql://127.0.0.1:3306/hello_world")
+                 ;(.setJdbcUrl "jdbc:mysql://TFB-database:3306/hello_world?username=benchmarkdbuser&password=benchmarkdbpass")
+                 (.setJdbcUrl "jdbc:mysql://TFB-database:3306/hello_world")
                  (.setRegisterMbeans false))]
     (HikariDataSource. config)))
 

+ 0 - 1
frameworks/Clojure/reitit/benchmark_config.json

@@ -2,7 +2,6 @@
   "framework": "reitit",
   "tests": [{
     "default": {
-      "setup_file": "setup",
       "json_url": "/json",
       "port": 8080,
       "approach": "Realistic",

+ 0 - 11
frameworks/Clojure/reitit/hello/.gitignore

@@ -1,11 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-*.jar
-*.class
-.lein-deps-sum
-.lein-failures
-.lein-plugins
-.lein-env

+ 0 - 0
frameworks/Clojure/reitit/hello/project.clj → frameworks/Clojure/reitit/project.clj


+ 11 - 0
frameworks/Clojure/reitit/reitit.dockerfile

@@ -0,0 +1,11 @@
+FROM tfb/leiningen-java8:latest
+ADD ./ /reitit
+WORKDIR /reitit
+RUN lein clean
+RUN lein uberjar
+CMD java \
+    -server \
+    -XX:+UseNUMA \
+    -XX:+UseParallelGC \
+    -XX:+AggressiveOpts \
+    -jar target/hello-reitit-standalone.jar

+ 0 - 8
frameworks/Clojure/reitit/setup.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-fw_depends java8 leiningen
-
-cd hello
-lein clean
-lein uberjar
-java -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts -jar target/hello-reitit-standalone.jar

+ 0 - 2
frameworks/Clojure/reitit/source_code

@@ -1,2 +0,0 @@
-./reitit/hello/src/hello/handler.clj
-./reitit/hello/project.clj

+ 0 - 0
frameworks/Clojure/reitit/hello/src/hello/handler.clj → frameworks/Clojure/reitit/src/hello/handler.clj


+ 0 - 0
frameworks/Clojure/reitit/hello/src/log4j.xml → frameworks/Clojure/reitit/src/log4j.xml


+ 7 - 0
toolset/setup/docker/systools/leiningen-java8.dockerfile

@@ -0,0 +1,7 @@
+FROM tfb/java8:latest
+ENV LEIN_HOME=/lein
+RUN mkdir ${LEIN_HOME}
+RUN mkdir ${LEIN_HOME}/bin
+RUN wget -nv -O ${LEIN_HOME}/bin/lein https://raw.github.com/technomancy/leiningen/stable/bin/lein
+RUN chmod +x ${LEIN_HOME}/bin/lein
+ENV PATH=${LEIN_HOME}/bin:${PATH}