From 3cb34a2164187083d571a9553816984700699fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marwan=20Rabb=C3=A2a?= <1440729+waghanza@users.noreply.github.com> Date: Mon, 14 Oct 2019 12:07:22 +0200 Subject: [PATCH] Run into lightweight containers (#1578) --- .ci/has_to_run.sh | 45 -- .ci/lint.sh | 119 --- .ci/mapping.yml | 31 - .ci/template.mustache | 28 - .ci/test.sh | 10 - .ebert.yml | 48 -- .gitignore | 4 +- .travis.yml | 697 ++++-------------- README.md | 16 +- README.mustache.md | 102 +++ c/Dockerfile | 34 + c/agoo-c/Dockerfile | 20 - c/agoo-c/config.yaml | 13 + c/kore/Dockerfile | 16 - c/kore/config.yaml | 18 +- clojure/{coast => }/Dockerfile | 2 +- cpp/Dockerfile | 34 + cpp/config.yaml | 8 +- cpp/drogon/Dockerfile | 22 - cpp/drogon/cmake_modules/FindDrogon.cmake | 17 + cpp/drogon/cmake_modules/FindJsoncpp.cmake | 63 ++ cpp/drogon/config.yaml | 29 +- cpp/evhtp/Dockerfile | 13 - cpp/evhtp/config.yaml | 11 +- crystal/Dockerfile | 16 + crystal/amber/Dockerfile | 11 - crystal/amber/config.yaml | 2 + crystal/athena/Dockerfile | 13 - crystal/athena/config.yaml | 3 + crystal/kemal/Dockerfile | 10 - crystal/lucky/Dockerfile | 19 - crystal/lucky/src/actions/api_action.cr | 3 +- crystal/lucky/src/actions/browser_action.cr | 14 +- crystal/onyx/Dockerfile | 13 - crystal/orion/Dockerfile | 10 - crystal/raze/Dockerfile | 11 - crystal/router.cr/Dockerfile | 10 - crystal/spider-gazelle/Dockerfile | 11 - crystal/spider-gazelle/README.md | 43 -- crystal/spider-gazelle/shard.yml | 2 +- crystal/spider-gazelle/src/app.cr | 19 +- crystal/toro/Dockerfile | 10 - csharp/{aspnetcore => }/Dockerfile | 0 tools/bin/.gitkeep => elixir/Dockerfile | 0 elixir/phoenix/Dockerfile | 20 - elixir/phoenix/README.md | 20 - elixir/plug/Dockerfile | 22 - elixir/plug/README.md | 19 - fsharp/{suave => }/Dockerfile | 0 go/{air => }/Dockerfile | 11 +- go/atreugo/Dockerfile | 15 - go/beego/Dockerfile | 15 - go/chi/Dockerfile | 15 - go/echo/Dockerfile | 15 - go/fasthttprouter/Dockerfile | 15 - go/gf/Dockerfile | 15 - go/gin/Dockerfile | 15 - go/gorilla-mux/Dockerfile | 15 - go/goroute/Dockerfile | 15 - go/gorouter-fasthttp/Dockerfile | 15 - go/gorouter/Dockerfile | 15 - go/gramework/Dockerfile | 17 - go/gramework/config.yaml | 4 + go/kami/Dockerfile | 16 - go/kami/config.yaml | 2 + go/rte/Dockerfile | 16 - go/rte/config.yaml | 3 + go/violetear/Dockerfile | 15 - java/Dockerfile | 26 + java/act/Dockerfile | 14 - java/act/config.yaml | 9 +- java/javalin/Dockerfile | 13 - java/javalin/config.yaml | 13 +- java/rapidoid/Dockerfile | 13 - java/rapidoid/config.yaml | 12 + java/spring-boot/Dockerfile | 14 - java/spring-boot/config.yaml | 9 +- kotlin/{ktor => }/Dockerfile | 0 nim/Dockerfile | 32 + nim/httpbeast/Dockerfile | 9 - nim/jester/Dockerfile | 9 - nim/jester/config.yaml | 3 + .../{server_nim_jester.nim => server.nim} | 0 ...server_nim_jester.nimble => server.nimble} | 0 nim/jester/server_nim_jester.nim.cfg | 12 - node/{0http => }/Dockerfile | 0 node/express/Dockerfile | 13 - node/fastify/Dockerfile | 13 - node/foxify/Dockerfile | 13 - node/hapi/Dockerfile | 13 - node/iotjs-express/Dockerfile | 13 - node/koa/Dockerfile | 13 - node/moleculer/Dockerfile | 13 - node/muneem/Dockerfile | 13 - node/polka/Dockerfile | 13 - node/polkadot/Dockerfile | 13 - node/rayo/Dockerfile | 13 - node/restana/Dockerfile | 13 - node/restify/Dockerfile | 13 - node/sifrr/Dockerfile | 14 - node/turbo_polka/Dockerfile | 13 - objc/Dockerfile | 0 perl/{dancer2 => }/Dockerfile | 0 php/Dockerfile | 67 ++ php/basicphp/Dockerfile | 53 -- php/basicphp/config.yaml | 3 +- php/hyperf/Dockerfile | 27 - php/hyperf/config.yaml | 8 + php/imi/Dockerfile | 26 - php/imi/config.yaml | 6 + php/laravel/Dockerfile | 84 --- php/laravel/config.yaml | 16 + php/lumen/Dockerfile | 83 --- php/one/App/Client/RpcTcp.php | 2 +- php/one/App/Cloud/Actor.php | 4 +- php/one/App/Cloud/Client.php | 3 +- php/one/App/Cloud/Server.php | 2 +- php/one/App/Config/actor.php | 2 +- php/one/App/Config/cache.php | 1 - php/one/App/Config/cloud.php | 2 +- php/one/App/Config/crypt.php | 2 +- php/one/App/Config/exception.php | 2 +- php/one/App/Config/log.php | 2 +- php/one/App/Config/router.php | 1 - php/one/App/Config/rpc.php | 1 - php/one/App/Config/session.php | 2 - php/one/App/Controllers/IndexController.php | 5 - php/one/App/GlobalData/Client.php | 2 +- php/one/App/GlobalData/Data.php | 5 +- php/one/App/GlobalData/Server.php | 4 +- php/one/App/Model/User.php | 4 +- php/one/App/Server/AppHttpPort.php | 4 +- php/one/App/Server/AppHttpServer.php | 3 +- php/one/App/Server/AppTcpPort.php | 4 +- php/one/App/Server/AppTcpServer.php | 4 +- php/one/App/Server/AppWsServer.php | 4 +- php/one/App/Server/RpcHttpPort.php | 1 - php/one/App/Server/RpcHttpServer.php | 2 +- php/one/App/Server/RpcTcpPort.php | 2 +- php/one/App/Server/RpcTcpServer.php | 2 +- php/one/App/Server/RpcTrait.php | 8 +- php/one/App/Server/RpcWsServer.php | 2 +- php/one/App/View/error.php | 2 +- php/one/App/View/exceptions/4000.php | 2 +- php/one/App/View/exceptions/404.php | 2 +- php/one/App/config.php | 4 - php/one/App/index.php | 1 - php/one/App/public/index.php | 2 +- php/one/App/shell.php | 2 +- php/one/App/swoole.php | 3 - php/one/Dockerfile | 19 - php/one/config.yaml | 5 + php/slim/Dockerfile | 59 -- php/spiral/Dockerfile | 32 - php/spiral/config.yaml | 7 +- php/swoft/Dockerfile | 23 - php/swoft/composer.json | 2 +- php/swoft/config.yaml | 5 + php/symfony/Dockerfile | 58 -- php/symfony/config.yaml | 11 + php/zend-expressive/Dockerfile | 58 -- php/zend-expressive/config.yaml | 3 + php/zend-framework/Dockerfile | 58 -- php/zend-framework/config.yaml | 3 + python/{cyclone => }/Dockerfile | 5 +- python/aiohttp/Dockerfile | 11 - python/aiohttp/config.yaml | 11 +- python/asgineer/Dockerfile | 11 - python/asgineer/config.yaml | 9 + python/blacksheep/Dockerfile | 12 - python/blacksheep/config.yaml | 8 + python/bocadillo/Dockerfile | 11 - python/bocadillo/config.yaml | 8 + python/bottle/Dockerfile | 11 - python/bottle/config.yaml | 8 + python/clastic/Dockerfile | 12 - python/clastic/config.yaml | 8 + python/cyclone/config.yaml | 2 + python/django/Dockerfile | 12 - python/django/config.yaml | 8 + python/falcon/Dockerfile | 12 - python/falcon/config.yaml | 9 + python/fastapi/Dockerfile | 11 - python/fastapi/config.yaml | 9 + python/flask/Dockerfile | 12 - python/flask/config.yaml | 8 + python/hug/Dockerfile | 12 - python/hug/config.yaml | 9 + python/japronto/Dockerfile | 12 - python/japronto/config.yaml | 1 + python/masonite/Dockerfile | 15 - python/masonite/config.yaml | 10 +- python/molten/Dockerfile | 11 - python/molten/config.yaml | 8 + python/quart/Dockerfile | 11 - python/quart/config.yaml | 9 + python/responder/Dockerfile | 11 - python/responder/config.yaml | 8 + python/sanic/Dockerfile | 12 - python/sanic/config.yaml | 10 +- python/starlette/Dockerfile | 11 - python/starlette/config.yaml | 11 + python/tornado/Dockerfile | 11 - python/tornado/config.yaml | 8 + ruby/Dockerfile | 19 + ruby/agoo/Dockerfile | 9 - ruby/agoo/config.yaml | 5 + ruby/camping/Dockerfile | 9 - ruby/cuba/Dockerfile | 9 - ruby/flame/Dockerfile | 10 - ruby/grape/Dockerfile | 11 - ruby/hanami/Dockerfile | 15 - ruby/plezi/Dockerfile | 9 - ruby/plezi/config.yaml | 2 + ruby/rack-routing/Dockerfile | 14 - ruby/rack-routing/README.md | 31 - ruby/rails/Dockerfile | 15 - ruby/roda/Dockerfile | 9 - ruby/sinatra/Dockerfile | 9 - ruby/syro/Dockerfile | 9 - rust/Dockerfile | 20 + rust/actix-web/Dockerfile | 12 - rust/gotham/Dockerfile | 12 - rust/iron/Dockerfile | 12 - rust/nickel/Dockerfile | 12 - scala/{http4s => }/Dockerfile | 4 +- scala/akkahttp/Dockerfile | 13 - scala/akkahttp/config.yaml | 2 + scala/http4s/config.yaml | 3 +- shard.yml | 10 +- swift/Dockerfile | 14 + swift/kitura-nio/Dockerfile | 11 - swift/kitura/Dockerfile | 11 - swift/perfect/Dockerfile | 14 - swift/swifter/Dockerfile | 11 - swift/vapor/Dockerfile | 11 - swift/vapor/config.yaml | 2 + tools/pipeline.lua | 2 + tools/pipeline_post.lua | 2 + tools/src/benchmarker.cr | 300 -------- tools/src/client.cr | 163 ++-- tools/src/db.cr | 78 ++ tools/src/make.cr | 213 +++--- 243 files changed, 1287 insertions(+), 3368 deletions(-) delete mode 100644 .ci/has_to_run.sh delete mode 100644 .ci/lint.sh delete mode 100644 .ci/mapping.yml delete mode 100644 .ci/template.mustache delete mode 100644 .ci/test.sh delete mode 100644 .ebert.yml create mode 100644 README.mustache.md create mode 100644 c/Dockerfile delete mode 100644 c/agoo-c/Dockerfile delete mode 100644 c/kore/Dockerfile rename clojure/{coast => }/Dockerfile (82%) create mode 100644 cpp/Dockerfile delete mode 100644 cpp/drogon/Dockerfile create mode 100644 cpp/drogon/cmake_modules/FindDrogon.cmake create mode 100644 cpp/drogon/cmake_modules/FindJsoncpp.cmake delete mode 100644 cpp/evhtp/Dockerfile create mode 100644 crystal/Dockerfile delete mode 100644 crystal/amber/Dockerfile delete mode 100644 crystal/athena/Dockerfile delete mode 100644 crystal/kemal/Dockerfile delete mode 100644 crystal/lucky/Dockerfile delete mode 100644 crystal/onyx/Dockerfile delete mode 100644 crystal/orion/Dockerfile delete mode 100644 crystal/raze/Dockerfile delete mode 100644 crystal/router.cr/Dockerfile delete mode 100644 crystal/spider-gazelle/Dockerfile delete mode 100644 crystal/spider-gazelle/README.md delete mode 100644 crystal/toro/Dockerfile rename csharp/{aspnetcore => }/Dockerfile (100%) rename tools/bin/.gitkeep => elixir/Dockerfile (100%) delete mode 100644 elixir/phoenix/Dockerfile delete mode 100644 elixir/phoenix/README.md delete mode 100644 elixir/plug/Dockerfile delete mode 100644 elixir/plug/README.md rename fsharp/{suave => }/Dockerfile (100%) rename go/{air => }/Dockerfile (57%) delete mode 100644 go/atreugo/Dockerfile delete mode 100644 go/beego/Dockerfile delete mode 100644 go/chi/Dockerfile delete mode 100644 go/echo/Dockerfile delete mode 100644 go/fasthttprouter/Dockerfile delete mode 100644 go/gf/Dockerfile delete mode 100644 go/gin/Dockerfile delete mode 100644 go/gorilla-mux/Dockerfile delete mode 100644 go/goroute/Dockerfile delete mode 100644 go/gorouter-fasthttp/Dockerfile delete mode 100644 go/gorouter/Dockerfile delete mode 100644 go/gramework/Dockerfile delete mode 100644 go/kami/Dockerfile delete mode 100644 go/rte/Dockerfile delete mode 100644 go/violetear/Dockerfile create mode 100644 java/Dockerfile delete mode 100644 java/act/Dockerfile delete mode 100644 java/javalin/Dockerfile delete mode 100644 java/rapidoid/Dockerfile delete mode 100644 java/spring-boot/Dockerfile rename kotlin/{ktor => }/Dockerfile (100%) create mode 100644 nim/Dockerfile delete mode 100644 nim/httpbeast/Dockerfile delete mode 100644 nim/jester/Dockerfile rename nim/jester/{server_nim_jester.nim => server.nim} (100%) rename nim/jester/{server_nim_jester.nimble => server.nimble} (100%) delete mode 100644 nim/jester/server_nim_jester.nim.cfg rename node/{0http => }/Dockerfile (100%) delete mode 100644 node/express/Dockerfile delete mode 100644 node/fastify/Dockerfile delete mode 100644 node/foxify/Dockerfile delete mode 100644 node/hapi/Dockerfile delete mode 100644 node/iotjs-express/Dockerfile delete mode 100644 node/koa/Dockerfile delete mode 100644 node/moleculer/Dockerfile delete mode 100644 node/muneem/Dockerfile delete mode 100644 node/polka/Dockerfile delete mode 100644 node/polkadot/Dockerfile delete mode 100644 node/rayo/Dockerfile delete mode 100644 node/restana/Dockerfile delete mode 100644 node/restify/Dockerfile delete mode 100644 node/sifrr/Dockerfile delete mode 100644 node/turbo_polka/Dockerfile create mode 100644 objc/Dockerfile rename perl/{dancer2 => }/Dockerfile (100%) create mode 100644 php/Dockerfile delete mode 100644 php/basicphp/Dockerfile delete mode 100644 php/hyperf/Dockerfile delete mode 100644 php/imi/Dockerfile delete mode 100644 php/laravel/Dockerfile delete mode 100644 php/lumen/Dockerfile delete mode 100644 php/one/Dockerfile delete mode 100644 php/slim/Dockerfile delete mode 100644 php/spiral/Dockerfile delete mode 100644 php/swoft/Dockerfile delete mode 100644 php/symfony/Dockerfile delete mode 100644 php/zend-expressive/Dockerfile delete mode 100644 php/zend-framework/Dockerfile rename python/{cyclone => }/Dockerfile (54%) delete mode 100644 python/aiohttp/Dockerfile delete mode 100644 python/asgineer/Dockerfile delete mode 100644 python/blacksheep/Dockerfile delete mode 100644 python/bocadillo/Dockerfile delete mode 100644 python/bottle/Dockerfile delete mode 100644 python/clastic/Dockerfile delete mode 100644 python/django/Dockerfile delete mode 100644 python/falcon/Dockerfile delete mode 100644 python/fastapi/Dockerfile delete mode 100644 python/flask/Dockerfile delete mode 100644 python/hug/Dockerfile delete mode 100644 python/japronto/Dockerfile delete mode 100644 python/masonite/Dockerfile delete mode 100644 python/molten/Dockerfile delete mode 100644 python/quart/Dockerfile delete mode 100644 python/responder/Dockerfile delete mode 100644 python/sanic/Dockerfile delete mode 100644 python/starlette/Dockerfile delete mode 100644 python/tornado/Dockerfile create mode 100644 ruby/Dockerfile delete mode 100644 ruby/agoo/Dockerfile delete mode 100644 ruby/camping/Dockerfile delete mode 100644 ruby/cuba/Dockerfile delete mode 100644 ruby/flame/Dockerfile delete mode 100644 ruby/grape/Dockerfile delete mode 100644 ruby/hanami/Dockerfile delete mode 100644 ruby/plezi/Dockerfile delete mode 100644 ruby/rack-routing/Dockerfile delete mode 100755 ruby/rack-routing/README.md delete mode 100644 ruby/rails/Dockerfile delete mode 100644 ruby/roda/Dockerfile delete mode 100644 ruby/sinatra/Dockerfile delete mode 100644 ruby/syro/Dockerfile create mode 100644 rust/Dockerfile delete mode 100644 rust/actix-web/Dockerfile delete mode 100644 rust/gotham/Dockerfile delete mode 100644 rust/iron/Dockerfile delete mode 100644 rust/nickel/Dockerfile rename scala/{http4s => }/Dockerfile (68%) delete mode 100644 scala/akkahttp/Dockerfile create mode 100644 swift/Dockerfile delete mode 100644 swift/kitura-nio/Dockerfile delete mode 100644 swift/kitura/Dockerfile delete mode 100644 swift/perfect/Dockerfile delete mode 100644 swift/swifter/Dockerfile delete mode 100644 swift/vapor/Dockerfile delete mode 100644 tools/src/benchmarker.cr create mode 100644 tools/src/db.cr diff --git a/.ci/has_to_run.sh b/.ci/has_to_run.sh deleted file mode 100644 index 6c020f22fb5..00000000000 --- a/.ci/has_to_run.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -set +e - -travis_terminate() { - if [[ ! "${TRAVIS_OS_NAME}" ]]; then - return - fi - - "_travis_terminate_${TRAVIS_OS_NAME}" "${@}" -} - -_travis_terminate_linux() { - _travis_terminate_unix "${@}" -} - -_travis_terminate_osx() { - _travis_terminate_unix "${@}" -} - -_travis_terminate_unix() { - set +e - [[ "${TRAVIS_FILTERED}" == redirect_io && -e /dev/fd/9 ]] && - sync && - command exec 1>&9 2>&9 9>&- && - sync - pgrep -u "${USER}" | grep -v -w "${$}" >"${TRAVIS_TMPDIR}/pids_after" - awk 'NR==FNR{a[$1]++;next};!($1 in a)' "${TRAVIS_TMPDIR}"/pids_{before,after} | - xargs kill &>/dev/null || true - pkill -9 -P "${$}" &>/dev/null || true - exit "${1}" -} - - -# List of updated files -git diff ${TRAVIS_COMMIT_RANGE} --name-only > /tmp/changed - -# If current framework was updated -grep -q "$FRAMEWORK" /tmp/changed - -if [[ $? != 0 ]]; then - echo "$FRAMEWORK was not modified, exiting." - exit 1 -fi - diff --git a/.ci/lint.sh b/.ci/lint.sh deleted file mode 100644 index 25e91f4b734..00000000000 --- a/.ci/lint.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - -set -eu - -if [[ ${LANGUAGE} == "csharp" ]] ; then - sudo apt -y update - sudo apt -y install astyle - find ${DIRECTORY} -type f -name '*.cs' > /tmp/list.txt - while read file ; do - astyle --mode=cs ${file} - done < /tmp/list.txt - RETVAL=$? -fi - -if [[ ${LANGUAGE} == "elixir" ]] ; then - find ${DIRECTORY} -type f -name '*.exs' -or -name '*.ex' > /tmp/list.txt - while read file ; do - mix format ${file} - done < /tmp/list.txt - RETVAL=$? -fi - -if [[ ${LANGUAGE} == "scala" ]] ; then - curl -Lo coursier https://git.io/coursier-cli && chmod +x coursier && sudo install coursier /usr/bin - sudo coursier bootstrap org.scalameta:scalafmt-cli_2.12:2.0.0-RC5 \ - -r sonatype:snapshots \ - -o /usr/local/bin/scalafmt --standalone --main org.scalafmt.cli.Cli - scalafmt ${DIRECTORY} --test -fi - -if [[ ${LANGUAGE} == "cpp" ]] ; then - find ${DIRECTORY} -type f -name '*.cpp' > /tmp/list.txt - while read file ; do - clang-format -verbose -i ${file} - done < /tmp/list.txt - RETVAL=$? -fi - -if [[ ${LANGUAGE} == "php" ]] ; then - composer global require friendsofphp/php-cs-fixer - ~/.config/composer/vendor/bin/php-cs-fixer fix php --verbose --rules=@PSR1,@PSR2 --using-cache=no --dry-run -fi - -if [[ ${LANGUAGE} == "python" ]] ; then - pip install black - black ${DIRECTORY} --check -fi - -if [[ ${LANGUAGE} == "c" ]] ; then - find ${DIRECTORY} -type f -name '*.c' > /tmp/list.txt - while read file ; do - clang-format -verbose -i ${file} - done < /tmp/list.txt -fi - -if [[ ${LANGUAGE} == "nim" ]] ; then - cd `mktemp -d` && curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh && sh init.sh -y && cd - - export PATH=$HOME/.nimble/bin:$PATH - echo "Using nimpretty version : `~/.nimble/bin/nimpretty -v`" - find ${DIRECTORY} -type f -name '*.nim' -or -name '*.nimble' > /tmp/list.txt - while read file ; do - nimpretty ${file} - done < /tmp/list.txt -fi - -if [[ ${LANGUAGE} == "java" ]] ; then - find ${DIRECTORY} -type f -name '*.java' > /tmp/list.txt - while read file ; do - clang-format -verbose -style=google -i ${file} - done < /tmp/list.txt -fi - -if [[ ${LANGUAGE} == "objc" ]] ; then - find ${DIRECTORY} -type f -name '*.m' > /tmp/list.txt - while read file ; do - clang-format -verbose -i ${file} - done < /tmp/list.txt -fi - -if [[ ${LANGUAGE} == "ruby" ]] ; then - gem install rubocop - rubocop -dE ${DIRECTORY} -fi - -if [[ ${LANGUAGE} == "crystal" ]] ; then - crystal tool format --check ${DIRECTORY} -fi - -if [[ ${LANGUAGE} == "go" ]] ; then - sudo apt -y update - sudo apt -y install golint - golint -set_exit_status=true ${DIRECTORY} -fi - -if [[ ${LANGUAGE} == "swift" ]] ; then - swiftlint lint --strict --path ${DIRECTORY} -fi - -if [[ ${LANGUAGE} == "rust" ]] ; then - rustup component add rustfmt --toolchain stable-x86_64-unknown-linux-gnu - find ${DIRECTORY} -type f -name '*.rs' > /tmp/list.txt - while read file ; do - rustfmt --verbose --check ${file} - done < /tmp/list.txt -fi - -if [[ ${LANGUAGE} == "node" ]] ; then - npm -g install standard - standard --verbose "${DIRECTORY}/**/*.js" -fi - -if [[ ${LANGUAGE} == "kotlin" ]] ; then - curl -sS https://keybase.io/pinterestandroid/pgp_keys.asc | sudo gpg --import - curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.33.0/ktlint && chmod +x ktlint && sudo install ktlint /usr/bin - find ${DIRECTORY} -type f -name '*.kt' > /tmp/list.txt - while read file ; do - ktlint --debug --verbose ${file} - done < /tmp/list.txt -fi diff --git a/.ci/mapping.yml b/.ci/mapping.yml deleted file mode 100644 index dff09f33467..00000000000 --- a/.ci/mapping.yml +++ /dev/null @@ -1,31 +0,0 @@ -python: - language: python -crystal: - language: crystal -php: - language: php -swift: - os: osx - language: swift -csharp: - language: csharp -go: - language: go -cpp: - language: cpp -scala: - language: scala -node: - language: node_js -ruby: - language: ruby -rust: - language: rust -c: - language: c -nim: - language: minimal -java: - language: java -kotlin: - language: java \ No newline at end of file diff --git a/.ci/template.mustache b/.ci/template.mustache deleted file mode 100644 index c00618cdd68..00000000000 --- a/.ci/template.mustache +++ /dev/null @@ -1,28 +0,0 @@ -# Exit build if not necessary -before_install: - # run only if current implementation is modified - - bash .ci/has_to_run.sh || travis_terminate 0 - -# Use docker to containerize frameworks -services: docker - -# This tool is written in crystal -language: crystal - -# One build per framework -env: - matrix: - {{#frameworks}} - - FRAMEWORK={{.}} - {{/frameworks}} - -script: - - shards install - - shards build - - bin/make config - - bin/make neph_config - - bin/neph ${FRAMEWORK} --mode=CI --seq - - crystal spec - -notifications: - email: false diff --git a/.ci/test.sh b/.ci/test.sh deleted file mode 100644 index 063edd1cbd8..00000000000 --- a/.ci/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -eu - -shards install -shards build -bin/make config -bin/make neph_config -bin/neph ${FRAMEWORK} --mode=CI --seq -crystal spec \ No newline at end of file diff --git a/.ebert.yml b/.ebert.yml deleted file mode 100644 index 3ab1cb3eaf1..00000000000 --- a/.ebert.yml +++ /dev/null @@ -1,48 +0,0 @@ -# This configuration was used Ebert to review the the-benchmarker/web-frameworks repository -# on 387074b492dad194fe583d7669c0f6eb6b2ce2bc. -# You can make this the default configuration for future reviews by moving this -# file to your repository as `.ebert.yml` and pushing it to GitHub, and tweak -# it as you wish - To know more on how to change this file to better review your -# repository you can go to https://docs.ebertapp.io/configuration and see the configuration -# details. ---- -styleguide: plataformatec/linters -engines: - phan: - enabled: false - reek: - enabled: true - credo: - enabled: true - fixme: - enabled: true - gofmt: - enabled: true - govet: - enabled: true - phpmd: - enabled: true - radon: - enabled: true - eslint: - enabled: true - golint: - enabled: true - tailor: - enabled: true - csslint: - enabled: true - rubocop: - enabled: true - duplication: - config: - languages: - - ruby - enabled: true - remark-lint: - enabled: true - gnu-complexity: - enabled: true -exclude_paths: -- spec - diff --git a/.gitignore b/.gitignore index 52b958b70b3..a2c726a0da8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -## Developer content +# Developer content .DS_Store *.swp @@ -24,3 +24,5 @@ vendor/ # Temporary files FRAMEWORKS.yaml +*/*/Dockerfile +*/*/ip.txt diff --git a/.travis.yml b/.travis.yml index aad5e3a5a16..fb72b407f25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,567 +1,134 @@ ---- -jobs: - include: - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=0http - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=act - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=actix-web - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=agoo - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=agoo-c - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=aiohttp - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=air - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=akkahttp - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=amber - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=asgineer - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=aspnetcore - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=athena - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=atreugo - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=basicphp - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=beego - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=blacksheep - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=bocadillo - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=bottle - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=camping - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=chi - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=clastic - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=coast - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=cuba - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=cyclone - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=dancer2 - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=django - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=drogon - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=echo - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=evhtp - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=express - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=falcon - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=fastapi - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=fasthttprouter - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=fastify - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=flame - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=flask - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=foxify - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gf - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gin - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gorilla-mux - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=goroute - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gorouter - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gorouter-fasthttp - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gotham - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=gramework - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=grape - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=hanami - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=hapi - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=http4s - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=httpbeast - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=hug - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=hyperf - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=imi - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=iotjs-express - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=iron - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=japronto - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=javalin - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=jester - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=kami - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=kemal - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=kitura - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=kitura-nio - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=koa - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=kore - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=ktor - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=laravel - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=lucky - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=lumen - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=masonite - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=moleculer - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=molten - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=muneem - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=nickel - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=one - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=onyx - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=orion - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=perfect - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=plezi - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=polka - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=polkadot - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=quart - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=rack-routing - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=rails - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=rapidoid - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=rayo - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=raze - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=responder - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=restana - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=restify - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=roda - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=router.cr - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=rte - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=sanic - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=sifrr - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=sinatra - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=slim - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=spider-gazelle - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=spiral - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=spring-boot - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=starlette - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=suave - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=swifter - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=swoft - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=symfony - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=syro - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=tornado - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=toro - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=turbo_polka - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=vapor - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=violetear - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=zend-expressive - services: docker - - stage: test - script: bash .ci/test.sh - language: crystal - env: FRAMEWORK=zend-framework - services: docker +# Use latest ubuntu LTS (18.04) +dist: bionic + +services: + - docker # Use docker to containerize frameworks + - redis # Use redis to store data + +# This tool is written in crystal +language: crystal + +env: + matrix: + - FRAMEWORK=httpbeast + - FRAMEWORK=jester + - FRAMEWORK=restana + - FRAMEWORK=express + - FRAMEWORK=muneem + - FRAMEWORK=iotjs-express + - FRAMEWORK=polka + - FRAMEWORK=fastify + - FRAMEWORK=turbo_polka + - FRAMEWORK=foxify + - FRAMEWORK=0http + - FRAMEWORK=polkadot + - FRAMEWORK=rayo + - FRAMEWORK=koa + - FRAMEWORK=moleculer + - FRAMEWORK=hapi + - FRAMEWORK=restify + - FRAMEWORK=sifrr + - FRAMEWORK=kore + - FRAMEWORK=agoo-c + - FRAMEWORK=coast + - FRAMEWORK=nickel + - FRAMEWORK=iron + - FRAMEWORK=actix-web + - FRAMEWORK=gotham + - FRAMEWORK=evhtp + - FRAMEWORK=drogon + - FRAMEWORK=kemal + - FRAMEWORK=spider-gazelle + - FRAMEWORK=router.cr + - FRAMEWORK=amber + - FRAMEWORK=athena + - FRAMEWORK=raze + - FRAMEWORK=onyx + - FRAMEWORK=lucky + - FRAMEWORK=orion + - FRAMEWORK=toro + - FRAMEWORK=rails + - FRAMEWORK=grape + - FRAMEWORK=flame + - FRAMEWORK=agoo + - FRAMEWORK=roda + - FRAMEWORK=rack-routing + - FRAMEWORK=syro + - FRAMEWORK=sinatra + - FRAMEWORK=camping + - FRAMEWORK=plezi + - FRAMEWORK=hanami + - FRAMEWORK=cuba + - FRAMEWORK=akkahttp + - FRAMEWORK=http4s + - FRAMEWORK=gramework + - FRAMEWORK=fasthttprouter + - FRAMEWORK=gin + - FRAMEWORK=echo + - FRAMEWORK=chi + - FRAMEWORK=air + - FRAMEWORK=gorouter + - FRAMEWORK=kami + - FRAMEWORK=goroute + - FRAMEWORK=atreugo + - FRAMEWORK=gorilla-mux + - FRAMEWORK=violetear + - FRAMEWORK=rte + - FRAMEWORK=gorouter-fasthttp + - FRAMEWORK=gf + - FRAMEWORK=beego + - FRAMEWORK=aspnetcore + - FRAMEWORK=imi + - FRAMEWORK=swoft + - FRAMEWORK=laravel + - FRAMEWORK=lumen + - FRAMEWORK=slim + - FRAMEWORK=hyperf + - FRAMEWORK=zend-framework + - FRAMEWORK=zend-expressive + - FRAMEWORK=one + - FRAMEWORK=basicphp + - FRAMEWORK=symfony + - FRAMEWORK=spiral + - FRAMEWORK=responder + - FRAMEWORK=asgineer + - FRAMEWORK=quart + - FRAMEWORK=hug + - FRAMEWORK=blacksheep + - FRAMEWORK=japronto + - FRAMEWORK=starlette + - FRAMEWORK=clastic + - FRAMEWORK=aiohttp + - FRAMEWORK=falcon + - FRAMEWORK=molten + - FRAMEWORK=flask + - FRAMEWORK=fastapi + - FRAMEWORK=django + - FRAMEWORK=bocadillo + - FRAMEWORK=sanic + - FRAMEWORK=bottle + - FRAMEWORK=masonite + - FRAMEWORK=tornado + - FRAMEWORK=cyclone + - FRAMEWORK=ktor + - FRAMEWORK=rapidoid + - FRAMEWORK=act + - FRAMEWORK=spring-boot + - FRAMEWORK=javalin + - FRAMEWORK=dancer2 + - FRAMEWORK=suave + - FRAMEWORK=perfect + - FRAMEWORK=vapor + - FRAMEWORK=swifter + - FRAMEWORK=kitura-nio + - FRAMEWORK=kitura + +script: + - shards install + - shards build + - bin/make config --without-sieger + - bin/neph ${FRAMEWORK} + - crystal spec + notifications: email: false -before_install: bash .ci/has_to_run.sh || travis_terminate 0 -dist: bionic diff --git a/README.md b/README.md index 46c0e215941..bbe950362f5 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,13 @@ shards install shards build ~~~ -+ Make framework list ++ Initialize `sqlite` database + +~~~sh +bin/db init +~~~ + ++ Make configuration ~~~sh bin/make config @@ -66,12 +72,10 @@ bin/make config bin/neph [job1] [job2] [job3] ... ~~~ -+ Start the benchmark .... - -> tools is a list of language / framework to challenge (example : ruby kemal amber go python) ++ Export all results readme ~~~sh -bin/benchmarker [tools] +bin/db to_readme ~~~ ## Results @@ -358,7 +362,7 @@ CPU Cores: 8 | `perl` (`5.3`) | [dancer2](https://perldancer.org) (**2.0**) | 1312.00 | **2.97** MB | -## How to contribute ? +## Can I contribute ? In any way you want ... diff --git a/README.mustache.md b/README.mustache.md new file mode 100644 index 00000000000..92da251b597 --- /dev/null +++ b/README.mustache.md @@ -0,0 +1,102 @@ +# Which is the fastest? + +[![Build Status](https://travis-ci.com/the-benchmarker/web-frameworks.svg?branch=master)](https://travis-ci.com/the-benchmarker/web-frameworks) +[![Join the chat at https://gitter.im/which_is_the_fastest/Lobby](https://badges.gitter.im/which_is_the_fastest/Lobby.svg)](https://gitter.im/which_is_the_fastest/Lobby) + +This project aims to be a load benchmarking suite, no more, no less + +> Measuring response times (routing times) for each framework (middleware). + + +
+ :warning::warning::warning::warning::warning::warning::warning::warning: +
+ +
Results are not production-ready yet
+ +
+ :warning::warning::warning::warning::warning::warning::warning::warning: +
+ +### Additional purposes : + ++ Helping decide between languages, depending on use case ++ Learning languages, best practices, devops culture ... ++ Having fun :heart: + +## Requirements + ++ [Crystal](https://crystal-lang.org) as `built-in` tools are made in this language ++ [Docker](https://www.docker.com) as **frameworks** are `isolated` into _containers_ ++ [wrk](https://github.com/wg/wrk) as benchmarking tool, `>= 4.1.0` + +:information_source: you need `wrk` **stable** + +~~~sh +git clone --branch 4.1.0 https://github.com/wg/wrk +~~~ + +:warning: `docker` is used for **development** purpose, `production` results will be computed on [DigitalOcean](https://www.digitalocean.com) :warning: + +## Usage + ++ Install all dependencies + +~~~sh +shards install +~~~ + ++ Build internal tools + +~~~sh +shards build +~~~ + ++ Initialize `sqlite` database + +~~~sh +bin/db init +~~~ + ++ Make configuration + +~~~sh +bin/make config +~~~ + ++ Build containers + +> jobs are either languages (example : crystal) or frameworks (example : router.cr) + +~~~sh +bin/neph [job1] [job2] [job3] ... +~~~ + ++ Export all results readme + +~~~sh +bin/db to_readme +~~~ + +## Results + +{{#results}} +{{.}} +{{/results}} + +## How to contribute ? + +In any way you want ... + ++ Request a framework addition ++ Report a bug (on any implementation) ++ Suggest an idea ++ ... + +Any kind of idea is :heart: + +## Contributors + +- [Taichiro Suzuki](https://github.com/tbrand) - Author | Maintainer +- [OvermindDL1](https://github.com/OvermindDL1) - Maintainer +- [Marwan Rabbâa](https://github.com/waghanza) - Maintainer diff --git a/c/Dockerfile b/c/Dockerfile new file mode 100644 index 00000000000..c4ff60c7f33 --- /dev/null +++ b/c/Dockerfile @@ -0,0 +1,34 @@ +FROM gcc:9.2 + +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /usr/src/app + +RUN apt-get -qq update && \ + apt-get -qy install cmake {{#deps}} {{{.}}} {{/deps}} + +COPY . ./ + +{{#clone}} + RUN {{{.}}} +{{/clone}} + +{{#build}} + RUN {{{.}}} +{{/build}} + +FROM debian + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get -qq update +{{#bin_deps}} + RUN apt-get -qy install {{{.}}} +{{/bin_deps}} + +{{#files}} +COPY --from=0 /usr/src/app/{{.}} /usr/bin/{{{.}}} +{{/files}} + +{{#command}} + CMD {{{.}}} +{{/command}} diff --git a/c/agoo-c/Dockerfile b/c/agoo-c/Dockerfile deleted file mode 100644 index 6a97f5f794e..00000000000 --- a/c/agoo-c/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM gcc:9.2 - -WORKDIR /usr/src/app - -RUN wget -c https://github.com/ohler55/agoo-c/tarball/v0.7.0 -O agoo.tar.gz -RUN tar xzf agoo.tar.gz -RUN mv ohler55* agoo-c -WORKDIR /usr/src/app/agoo-c/src -RUN make - -WORKDIR /usr/src/app - -COPY Makefile simple.c ./ - -# build simple app -RUN make - -EXPOSE 3000 - -CMD ./simple diff --git a/c/agoo-c/config.yaml b/c/agoo-c/config.yaml index ece34f71a16..6355081c27f 100644 --- a/c/agoo-c/config.yaml +++ b/c/agoo-c/config.yaml @@ -6,3 +6,16 @@ provider: default: language: 11 +clone: + - wget -c https://github.com/ohler55/agoo-c/tarball/v0.7.0 -O agoo.tar.gz + - tar xzf agoo.tar.gz + - mv ohler55* agoo-c + - cd /usr/src/app/agoo-c/src && make + +build: + - make + +files: + - simple + +command: /usr/bin/simple diff --git a/c/kore/Dockerfile b/c/kore/Dockerfile deleted file mode 100644 index 2e9053a5f20..00000000000 --- a/c/kore/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM gcc:9.2 - -RUN wget -c https://kore.io/releases/kore-3.3.1.tar.gz && tar xvf kore-3.3.1.tar.gz -RUN cd kore-3.3.1 && TASKS=1 NOTLS=1 make && make install - -WORKDIR /usr/src/app - -COPY hello hello - -WORKDIR /usr/src/app/hello - -RUN kodev build - -EXPOSE 3000 - -CMD kore -f -n -r -c conf/hello.conf diff --git a/c/kore/config.yaml b/c/kore/config.yaml index 31edd894173..5f75b233733 100644 --- a/c/kore/config.yaml +++ b/c/kore/config.yaml @@ -5,4 +5,20 @@ framework: provider: default: language: 99 - + +clone: + - wget -c https://kore.io/releases/kore-3.3.1.tar.gz && tar xvf kore-3.3.1.tar.gz + - cd kore-3.3.1 && TASKS=1 NOTLS=1 make && make install + +build: + - cd hello && kodev build + +bin_deps: + - libssl1.1 + +files: + - ../../local/bin/kore + - hello/conf/hello.conf + - hello/hello.so + +command: cd /usr/bin/hello && /local/bin/kore -f -n -r -c conf/hello.conf \ No newline at end of file diff --git a/clojure/coast/Dockerfile b/clojure/Dockerfile similarity index 82% rename from clojure/coast/Dockerfile rename to clojure/Dockerfile index 6a7c8223b0b..5e681b2083d 100644 --- a/clojure/coast/Dockerfile +++ b/clojure/Dockerfile @@ -6,6 +6,6 @@ COPY . /coast ENV COAST_ENV=prod -RUN clj -Auberjar +RUN clojure -Auberjar CMD java -jar coast.jar 3000 diff --git a/cpp/Dockerfile b/cpp/Dockerfile new file mode 100644 index 00000000000..c4ff60c7f33 --- /dev/null +++ b/cpp/Dockerfile @@ -0,0 +1,34 @@ +FROM gcc:9.2 + +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /usr/src/app + +RUN apt-get -qq update && \ + apt-get -qy install cmake {{#deps}} {{{.}}} {{/deps}} + +COPY . ./ + +{{#clone}} + RUN {{{.}}} +{{/clone}} + +{{#build}} + RUN {{{.}}} +{{/build}} + +FROM debian + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get -qq update +{{#bin_deps}} + RUN apt-get -qy install {{{.}}} +{{/bin_deps}} + +{{#files}} +COPY --from=0 /usr/src/app/{{.}} /usr/bin/{{{.}}} +{{/files}} + +{{#command}} + CMD {{{.}}} +{{/command}} diff --git a/cpp/config.yaml b/cpp/config.yaml index ab7b5365b5b..225f8bb16d2 100644 --- a/cpp/config.yaml +++ b/cpp/config.yaml @@ -1,3 +1,9 @@ provider: default: - language: 11 \ No newline at end of file + language: 11 + +build: + - cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release + - cmake --build _builds --config Release + +command: _builds/server_cpp_evhtp \ No newline at end of file diff --git a/cpp/drogon/Dockerfile b/cpp/drogon/Dockerfile deleted file mode 100644 index 32f392589d3..00000000000 --- a/cpp/drogon/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM gcc:9.2 - -RUN apt -qq update && \ - apt -qy install cmake libjsoncpp-dev uuid-dev libssl-dev zlib1g-dev - -ENV IROOT=/install -ENV DROGON_ROOT=$IROOT/drogon -WORKDIR $IROOT - -COPY ./ ./ - -# compilation - -RUN git clone --branch v1.0.0-beta8 https://github.com/an-tao/drogon -WORKDIR $DROGON_ROOT -RUN git submodule update --init - -WORKDIR $IROOT/build -RUN cmake -DCMAKE_BUILD_TYPE=release .. -RUN make -CMD ./drogon_benchmark ../config.json - diff --git a/cpp/drogon/cmake_modules/FindDrogon.cmake b/cpp/drogon/cmake_modules/FindDrogon.cmake new file mode 100644 index 00000000000..97fcdf925ba --- /dev/null +++ b/cpp/drogon/cmake_modules/FindDrogon.cmake @@ -0,0 +1,17 @@ +# +# FindDrogon submodule and setup benchmark cmake target +# + +message(STATUS "Searching for Drogon") + +add_library(Drogon::Drogon INTERFACE IMPORTED GLOBAL) +find_package (Jsoncpp REQUIRED) + +set_target_properties(Drogon::Drogon PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_SOURCE_DIR}/drogon/lib/inc;${CMAKE_CURRENT_SOURCE_DIR}/drogon/orm_lib/inc;${CMAKE_CURRENT_SOURCE_DIR}/drogon/trantor;${JSONCPP_INCLUDE_DIRS};") + +target_link_libraries(Drogon::Drogon INTERFACE + drogon trantor dl pthread) + +message(STATUS "Drogon::Drogon interface target defined") diff --git a/cpp/drogon/cmake_modules/FindJsoncpp.cmake b/cpp/drogon/cmake_modules/FindJsoncpp.cmake new file mode 100644 index 00000000000..8c69d14f951 --- /dev/null +++ b/cpp/drogon/cmake_modules/FindJsoncpp.cmake @@ -0,0 +1,63 @@ +# Find jsoncpp +# +# Find the jsoncpp includes and library +# +# if you nee to add a custom library search path, do it via via CMAKE_PREFIX_PATH +# +# This module defines +# JSONCPP_INCLUDE_DIRS, where to find header, etc. +# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp. +# JSONCPP_FOUND, If false, do not try to use jsoncpp. +# JSONCPP_INCLUDE_PREFIX, include prefix for jsoncpp + +# only look in default directories +find_path( + JSONCPP_INCLUDE_DIR + NAMES jsoncpp/json/json.h json/json.h + DOC "jsoncpp include dir" +) + +find_library( + JSONCPP_LIBRARY + NAMES jsoncpp + DOC "jsoncpp library" +) + +set(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR}) +set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY}) + +# debug library on windows +# same naming convention as in qt (appending debug library with d) +# boost is using the same "hack" as us with "optimized" and "debug" +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + find_library( + JSONCPP_LIBRARY_DEBUG + NAMES jsoncppd + DOC "jsoncpp debug library" + ) + + set(JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARIES} debug ${JSONCPP_LIBRARY_DEBUG}) + +endif() + +# find JSONCPP_INCLUDE_PREFIX +find_path( + JSONCPP_INCLUDE_PREFIX + NAMES json.h + PATH_SUFFIXES jsoncpp/json json +) + +if (${JSONCPP_INCLUDE_PREFIX} MATCHES "jsoncpp") + set(JSONCPP_INCLUDE_PREFIX "jsoncpp") + set(JSONCPP_INCLUDE_DIRS "${JSONCPP_INCLUDE_DIRS}/jsoncpp") +else() + set(JSONCPP_INCLUDE_PREFIX "") +endif() + + +# handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE +# if all listed variables are TRUE, hide their existence from configuration view +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(jsoncpp DEFAULT_MSG + JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY) +mark_as_advanced (JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY) diff --git a/cpp/drogon/config.yaml b/cpp/drogon/config.yaml index 5a80c2cc1f6..0324b445fee 100644 --- a/cpp/drogon/config.yaml +++ b/cpp/drogon/config.yaml @@ -4,4 +4,31 @@ framework: provider: default: - language: 14/17 \ No newline at end of file + language: 14/17 + +deps: + - libjsoncpp-dev + - uuid-dev + - libssl-dev + - zlib1g-dev + +bin_deps: + - libjsoncpp1 + - uuid + - libssl1.1 + - zlib1g + +clone: + - git clone --branch v1.0.0-beta7 https://github.com/an-tao/drogon + - cd /usr/src/app/drogon && git submodule update --init + +build: + - mkdir /usr/src/app/build + - cd /usr/src/app/build && cmake -DCMAKE_BUILD_TYPE=release .. + - cd /usr/src/app/build && make + +files: + - build/drogon_benchmark + - config.json + +command: /usr/bin/build/drogon_benchmark /usr/bin/config.json \ No newline at end of file diff --git a/cpp/evhtp/Dockerfile b/cpp/evhtp/Dockerfile deleted file mode 100644 index c205f077b08..00000000000 --- a/cpp/evhtp/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM gcc:9.2 - -WORKDIR /usr/src/app -COPY . . - -RUN apt -qq update && \ - apt -qy install cmake - -RUN cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release -RUN cmake --build _builds --config Release - -EXPOSE 3000 -CMD _builds/server_cpp_evhtp diff --git a/cpp/evhtp/config.yaml b/cpp/evhtp/config.yaml index f1378f18567..493aa8e7fa3 100644 --- a/cpp/evhtp/config.yaml +++ b/cpp/evhtp/config.yaml @@ -1,3 +1,12 @@ framework: website: criticalstack/libevhtp - version: 1.2 + version: 1.2 + +build: + - cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release + - cmake --build _builds --config Release + +files: + - _builds/server_cpp_evhtp + +command: /usr/bin/_builds/server_cpp_evhtp diff --git a/crystal/Dockerfile b/crystal/Dockerfile new file mode 100644 index 00000000000..2c60787e251 --- /dev/null +++ b/crystal/Dockerfile @@ -0,0 +1,16 @@ +FROM jrei/crystal-alpine + +WORKDIR /usr/src/app + +COPY . ./ + +RUN shards install +RUN shards build --production --release --no-debug --static + +FROM alpine +COPY --from=0 /usr/src/app/bin/server /usr/bin/app +{{#files}} +COPY --from=0 /usr/src/app/{{.}} /usr/bin/{{{.}}} +{{/files}} +WORKDIR /usr/bin +CMD ./app diff --git a/crystal/amber/Dockerfile b/crystal/amber/Dockerfile deleted file mode 100644 index cd662caa46c..00000000000 --- a/crystal/amber/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY src src -COPY config config - -RUN shards build --release --no-debug - -CMD bin/server diff --git a/crystal/amber/config.yaml b/crystal/amber/config.yaml index 7de25a26416..570d4c5a6de 100644 --- a/crystal/amber/config.yaml +++ b/crystal/amber/config.yaml @@ -2,3 +2,5 @@ framework: website: amberframework.org version: 0.30 +files: + - config diff --git a/crystal/athena/Dockerfile b/crystal/athena/Dockerfile deleted file mode 100644 index 06600c5cbfa..00000000000 --- a/crystal/athena/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY src src -COPY shard.yml ./ -COPY athena.yml ./ - -RUN shards build --production --no-debug - -ENV ATHENA_ENV test - -CMD bin/server diff --git a/crystal/athena/config.yaml b/crystal/athena/config.yaml index 3fa1098ac61..4f24c987c5e 100644 --- a/crystal/athena/config.yaml +++ b/crystal/athena/config.yaml @@ -1,3 +1,6 @@ framework: github: blacksmoke16/athena version: 0.7 + +files: + - athena.yml \ No newline at end of file diff --git a/crystal/kemal/Dockerfile b/crystal/kemal/Dockerfile deleted file mode 100644 index f2023235f53..00000000000 --- a/crystal/kemal/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY src src -COPY shard.yml ./ - -RUN shards build --release --no-debug - -CMD bin/server diff --git a/crystal/lucky/Dockerfile b/crystal/lucky/Dockerfile deleted file mode 100644 index 2945669acf2..00000000000 --- a/crystal/lucky/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY public public -COPY src src -COPY config config - -RUN echo '{}' > public/manifest.json -RUN echo '{}' > public/mix-manifest.json - -RUN shards build --release --no-debug - -ENV LUCKY_ENV production - -EXPOSE 3000 - -CMD bin/server diff --git a/crystal/lucky/src/actions/api_action.cr b/crystal/lucky/src/actions/api_action.cr index 65e72560c10..c81a3b30b5e 100644 --- a/crystal/lucky/src/actions/api_action.cr +++ b/crystal/lucky/src/actions/api_action.cr @@ -1,4 +1,5 @@ abstract class ApiAction < Lucky::Action + accepted_formats [:html, :json], default: :html - # Add pipes and methods that are for all API requests + end diff --git a/crystal/lucky/src/actions/browser_action.cr b/crystal/lucky/src/actions/browser_action.cr index f6a2fcd0c4b..35815316ca6 100644 --- a/crystal/lucky/src/actions/browser_action.cr +++ b/crystal/lucky/src/actions/browser_action.cr @@ -1,15 +1,5 @@ abstract class BrowserAction < Lucky::Action include Lucky::ProtectFromForgery - accepted_formats [:html, :json], default: :html - # If something should always be exposed to your pages, expose them here. - # - # Example: - # - # expose current_user - # - # def current_user - # find_the_user... - # end - # - # Then add an assign for it in your MainLayout + + default_format :html end diff --git a/crystal/onyx/Dockerfile b/crystal/onyx/Dockerfile deleted file mode 100644 index 79704055941..00000000000 --- a/crystal/onyx/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY src src - -ENV BENCHMARK true - -RUN shards build --release --no-debug - -EXPOSE 3000 -CMD bin/server diff --git a/crystal/orion/Dockerfile b/crystal/orion/Dockerfile deleted file mode 100644 index dff31026177..00000000000 --- a/crystal/orion/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml server.cr ./ - -RUN shards build --release --no-debug - -EXPOSE 3000 -CMD bin/server diff --git a/crystal/raze/Dockerfile b/crystal/raze/Dockerfile deleted file mode 100644 index 98b51f95a07..00000000000 --- a/crystal/raze/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY src src - -RUN shards build --release --no-debug - -EXPOSE 3000 -CMD bin/server diff --git a/crystal/router.cr/Dockerfile b/crystal/router.cr/Dockerfile deleted file mode 100644 index 5c1373e0c34..00000000000 --- a/crystal/router.cr/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY src src - -RUN shards build --release --no-debug - -CMD bin/server diff --git a/crystal/spider-gazelle/Dockerfile b/crystal/spider-gazelle/Dockerfile deleted file mode 100644 index e61446fb98c..00000000000 --- a/crystal/spider-gazelle/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY spec spec -COPY src src - -RUN shards build --release --no-debug - -CMD bin/app -w $(nproc) -b 0.0.0.0 diff --git a/crystal/spider-gazelle/README.md b/crystal/spider-gazelle/README.md deleted file mode 100644 index a77d30c928b..00000000000 --- a/crystal/spider-gazelle/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Spider-Gazelle Application Template - -[![Build Status](https://travis-ci.org/spider-gazelle/spider-gazelle.svg?branch=master)](https://travis-ci.org/spider-gazelle/spider-gazelle) - -Clone this repository to start building your own spider-gazelle based application - -## Documentation - -Detailed documentation and guides available: https://spider-gazelle.net/ - -* [Action Controller](https://github.com/spider-gazelle/action-controller) base class for building [Controllers](http://guides.rubyonrails.org/action_controller_overview.html) -* [Active Model](https://github.com/spider-gazelle/active-model) base class for building [ORMs](https://en.wikipedia.org/wiki/Object-relational_mapping) -* [Habitat](https://github.com/luckyframework/habitat) configuration and settings for Crystal projects -* [router.cr](https://github.com/tbrand/router.cr) base request handling -* [Radix](https://github.com/luislavena/radix) Radix Tree implementation for request routing -* [HTTP::Server](https://crystal-lang.org/api/latest/HTTP/Server.html) built-in Crystal Lang HTTP server - * Request - * Response - * Cookies - * Headers - * Params etc - - -Spider-Gazelle builds on the amazing performance of **router.cr** [here](https://github.com/tbrand/which_is_the_fastest).:rocket: - - -## Testing - -`crystal spec` - -* to run in development mode `crystal ./src/app.cr` - -## Compiling - -`crystal build ./src/app.cr` - -### Deploying - -Once compiled you are left with a binary `./app` - -* for help `./app --help` -* viewing routes `./app --routes` -* run on a different port or host `./app -h 0.0.0.0 -p 80` diff --git a/crystal/spider-gazelle/shard.yml b/crystal/spider-gazelle/shard.yml index 8b8d83307c8..536021dc97d 100644 --- a/crystal/spider-gazelle/shard.yml +++ b/crystal/spider-gazelle/shard.yml @@ -9,5 +9,5 @@ dependencies: version: ~> 1.6.0 targets: - app: + server: main: src/app.cr diff --git a/crystal/spider-gazelle/src/app.cr b/crystal/spider-gazelle/src/app.cr index 863c57ba5f4..7b62aeb8f21 100644 --- a/crystal/spider-gazelle/src/app.cr +++ b/crystal/spider-gazelle/src/app.cr @@ -2,10 +2,9 @@ require "option_parser" require "./config" # Server defaults -port = 3000 -host = "127.0.0.1" -cluster = false -process_count = 1 +port = (ENV["SG_SERVER_PORT"]? || 3000).to_i +host = ENV["SG_SERVER_HOST"]? || "0.0.0.0" +process_count = (ENV["SG_PROCESS_COUNT"]? || 1).to_i # Command line options OptionParser.parse(ARGV.dup) do |parser| @@ -15,7 +14,6 @@ OptionParser.parse(ARGV.dup) do |parser| parser.on("-p PORT", "--port=PORT", "Specifies the server port") { |p| port = p.to_i } parser.on("-w COUNT", "--workers=COUNT", "Specifies the number of processes to handle requests") do |w| - cluster = true process_count = w.to_i end @@ -40,15 +38,20 @@ puts "Launching #{APP_NAME} v#{VERSION}" server = ActionController::Server.new(port, host) # Start clustering -server.cluster(process_count, "-w", "--workers") if cluster +# process_count < 1 == `System.cpu_count` but this is not always accurate +server.cluster(process_count, "-w", "--workers") if process_count != 1 -# Detect ctr-c to shutdown gracefully -Signal::INT.trap do |signal| +terminate = Proc(Signal, Nil).new do |signal| puts " > terminating gracefully" spawn { server.close } signal.ignore end +# Detect ctr-c to shutdown gracefully +Signal::INT.trap &terminate +# Docker containers use the term signal +Signal::TERM.trap &terminate + # Start the server server.run do puts "Listening on #{server.print_addresses}" diff --git a/crystal/toro/Dockerfile b/crystal/toro/Dockerfile deleted file mode 100644 index 5c1373e0c34..00000000000 --- a/crystal/toro/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM crystallang/crystal:0.31.1 - -WORKDIR /usr/src/app - -COPY shard.yml ./ -COPY src src - -RUN shards build --release --no-debug - -CMD bin/server diff --git a/csharp/aspnetcore/Dockerfile b/csharp/Dockerfile similarity index 100% rename from csharp/aspnetcore/Dockerfile rename to csharp/Dockerfile diff --git a/tools/bin/.gitkeep b/elixir/Dockerfile similarity index 100% rename from tools/bin/.gitkeep rename to elixir/Dockerfile diff --git a/elixir/phoenix/Dockerfile b/elixir/phoenix/Dockerfile deleted file mode 100644 index f38c1cae307..00000000000 --- a/elixir/phoenix/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM elixir:1.8 - -RUN /usr/local/bin/mix local.hex --force && \ - /usr/local/bin/mix local.rebar --force && \ - /usr/local/bin/mix hex.info - -WORKDIR /usr/src/app - -COPY config config -COPY lib lib -COPY rel rel -COPY web web -COPY mix.exs ./ - -RUN echo "yes" | mix deps.get --force -ENV MIX_ENV prod -RUN mix release --no-tar - -EXPOSE 3000 -CMD _build/prod/rel/my_phoenix/bin/my_phoenix foreground diff --git a/elixir/phoenix/README.md b/elixir/phoenix/README.md deleted file mode 100644 index e8a8ac05f36..00000000000 --- a/elixir/phoenix/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# MyPhoenix - -To start your Phoenix app: - - * Install dependencies with `mix deps.get` - * Create and migrate your database with `mix ecto.create && mix ecto.migrate` - * Install Node.js dependencies with `npm install` - * Start Phoenix endpoint with `mix phoenix.server` - -Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. - -Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment). - -## Learn more - - * Official website: http://www.phoenixframework.org/ - * Guides: http://phoenixframework.org/docs/overview - * Docs: https://hexdocs.pm/phoenix - * Mailing list: http://groups.google.com/group/phoenix-talk - * Source: https://github.com/phoenixframework/phoenix diff --git a/elixir/plug/Dockerfile b/elixir/plug/Dockerfile deleted file mode 100644 index 6515c9dfdc9..00000000000 --- a/elixir/plug/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM elixir:1.8 - -RUN /usr/local/bin/mix local.hex --force && \ - /usr/local/bin/mix local.rebar --force && \ - /usr/local/bin/mix hex.info - -WORKDIR /usr/src/app - -COPY config config -COPY lib lib -COPY rel rel -COPY test test -COPY mix.exs ./ - -RUN ls -la - -RUN echo "yes" | mix deps.get --force -ENV MIX_ENV prod -RUN mix release --no-tar - -EXPOSE 3000 -CMD _build/prod/rel/my_plug/bin/my_plug foreground diff --git a/elixir/plug/README.md b/elixir/plug/README.md deleted file mode 100644 index 3fb93a6b8e8..00000000000 --- a/elixir/plug/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Plug - -**TODO: Add description** - -## Installation - -If [available in Hex](https://hex.pm/docs/publish), the package can be installed -by adding `my_plug` to your list of dependencies in `mix.exs`: - -```elixir -def deps do - [{:my_plug, "~> 0.1.0"}] -end -``` - -Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) -and published on [HexDocs](https://hexdocs.pm). Once published, the docs can -be found at [https://hexdocs.pm/my_plug](https://hexdocs.pm/my_plug). - diff --git a/fsharp/suave/Dockerfile b/fsharp/Dockerfile similarity index 100% rename from fsharp/suave/Dockerfile rename to fsharp/Dockerfile diff --git a/go/air/Dockerfile b/go/Dockerfile similarity index 57% rename from go/air/Dockerfile rename to go/Dockerfile index 8829ab52f97..8c2ce00c45d 100644 --- a/go/air/Dockerfile +++ b/go/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13 AS buildenv +FROM golang:1.13 ENV CGO_ENABLED=0 ENV GOOS=linux @@ -10,6 +10,9 @@ ADD main.go go.mod ./ RUN go get RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] +FROM alpine +{{#environment}} +ENV {{{.}}} +{{/environment}} +COPY --from=0 /go/bin/app /go/bin/app +CMD /go/bin/app diff --git a/go/atreugo/Dockerfile b/go/atreugo/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/atreugo/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/beego/Dockerfile b/go/beego/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/beego/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/chi/Dockerfile b/go/chi/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/chi/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/echo/Dockerfile b/go/echo/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/echo/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/fasthttprouter/Dockerfile b/go/fasthttprouter/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/fasthttprouter/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gf/Dockerfile b/go/gf/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/gf/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gin/Dockerfile b/go/gin/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/gin/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gorilla-mux/Dockerfile b/go/gorilla-mux/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/gorilla-mux/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/goroute/Dockerfile b/go/goroute/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/goroute/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gorouter-fasthttp/Dockerfile b/go/gorouter-fasthttp/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/gorouter-fasthttp/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gorouter/Dockerfile b/go/gorouter/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/gorouter/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/go/gramework/Dockerfile b/go/gramework/Dockerfile deleted file mode 100644 index 7fb3f09f558..00000000000 --- a/go/gramework/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -ENV ENV production -ENV PORT 3000 -CMD ["/go/bin/app"] diff --git a/go/gramework/config.yaml b/go/gramework/config.yaml index 912a66e25a7..3e966566a91 100644 --- a/go/gramework/config.yaml +++ b/go/gramework/config.yaml @@ -1,3 +1,7 @@ framework: github: gramework/gramework version: 1.6 + +environment: + ENVIRONMENT: production + PORT: 3000 \ No newline at end of file diff --git a/go/kami/Dockerfile b/go/kami/Dockerfile deleted file mode 100644 index 67abab98f2f..00000000000 --- a/go/kami/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -ENV GOJI_BIND "0.0.0.0:3000" -CMD ["/go/bin/app"] diff --git a/go/kami/config.yaml b/go/kami/config.yaml index eb174728347..cf4c3ad69b1 100644 --- a/go/kami/config.yaml +++ b/go/kami/config.yaml @@ -2,3 +2,5 @@ framework: github: guregu/kami version: 2.2 +environment: + GOJI_BIND: 0.0.0.0:3000 \ No newline at end of file diff --git a/go/rte/Dockerfile b/go/rte/Dockerfile deleted file mode 100644 index 8669f02d535..00000000000 --- a/go/rte/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -ENV SERVER_ADDRESS ":3000" -CMD ["/go/bin/app"] diff --git a/go/rte/config.yaml b/go/rte/config.yaml index 913215aad9b..14c883936a0 100644 --- a/go/rte/config.yaml +++ b/go/rte/config.yaml @@ -1,3 +1,6 @@ framework: github: jwilner/rte version: 0.0 + +environment: + SERVER_ADDRESS: 0.0.0.0:3000 diff --git a/go/violetear/Dockerfile b/go/violetear/Dockerfile deleted file mode 100644 index 8829ab52f97..00000000000 --- a/go/violetear/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13 AS buildenv - -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=amd64 - -WORKDIR /go/src/app -ADD main.go go.mod ./ - -RUN go get -RUN go build -a -ldflags '-extldflags "-static"' -o /go/bin/app ./ - -FROM alpine:3.10 -COPY --from=buildenv /go/bin/app /go/bin/app -CMD ["/go/bin/app"] diff --git a/java/Dockerfile b/java/Dockerfile new file mode 100644 index 00000000000..dfdab86b833 --- /dev/null +++ b/java/Dockerfile @@ -0,0 +1,26 @@ +FROM maven:3.6-jdk-8 as maven +WORKDIR /usr/src/app + +COPY src src +COPY pom.xml pom.xml + +{{#build}} + RUN mvn compile assembly:single -q +{{/build}} + +{{^build}} + RUN mvn clean package -q +{{/build}} + +FROM openjdk:8-jre-slim +WORKDIR /usr/src/app +{{#files}} +COPY --from=0 /usr/src/app/{{{.}}} {{{.}}} +{{/files}} +{{#before_command}} + RUN {{{.}}} +{{/before_command}} + +{{#command}} + CMD {{{.}}} +{{/command}} diff --git a/java/act/Dockerfile b/java/act/Dockerfile deleted file mode 100644 index a5726320df3..00000000000 --- a/java/act/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM maven:3.6-jdk-8 as maven -WORKDIR /act -COPY pom.xml pom.xml -COPY src src -RUN mvn clean package -q - -FROM openjdk:8-jre-slim -WORKDIR /act -COPY --from=maven /act/target/dist/*.tar.gz app.tar.gz -RUN tar xzf app.tar.gz - -EXPOSE 3000 - -CMD ["/act/run"] diff --git a/java/act/config.yaml b/java/act/config.yaml index 16e899d2c11..f095d6eba12 100644 --- a/java/act/config.yaml +++ b/java/act/config.yaml @@ -1,4 +1,11 @@ framework: website: actframework.org version: 1.8 - + +files: + - target/dist/*.tar.gz + +before_command: + - tar -xvzf target/dist/*.tar.gz + +command: ./run diff --git a/java/javalin/Dockerfile b/java/javalin/Dockerfile deleted file mode 100644 index d6078ebeea4..00000000000 --- a/java/javalin/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM maven:3.6-jdk-8 as maven -WORKDIR /javalin -COPY pom.xml pom.xml -COPY src src -RUN mvn compile assembly:single -q - -FROM openjdk:11-jre-slim -WORKDIR /javalin -COPY --from=maven /javalin/target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar app.jar - -EXPOSE 3000 - -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "benchmark.javalin.Bench", "profiles=production"] diff --git a/java/javalin/config.yaml b/java/javalin/config.yaml index 203bcd4260a..7233d21354f 100644 --- a/java/javalin/config.yaml +++ b/java/javalin/config.yaml @@ -1,3 +1,14 @@ framework: website: javalin.io - version: 3.5 + version: 3.5 + +build: + - mvn compile assembly:single -q + +files: + - target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar + +command: > + java -server + -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts + -cp target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar benchmark.javalin.Bench profiles=production diff --git a/java/rapidoid/Dockerfile b/java/rapidoid/Dockerfile deleted file mode 100644 index c5716d83f7f..00000000000 --- a/java/rapidoid/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM maven:3.6-jdk-8 as maven -WORKDIR /rapidoid -COPY pom.xml pom.xml -COPY src src -RUN mvn compile assembly:single -q - -FROM openjdk:11-jre-slim -WORKDIR /rapidoid -COPY --from=maven /rapidoid/target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar app.jar - -EXPOSE 3000 - -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "benchmark.rapidoid.Main", "profiles=production"] diff --git a/java/rapidoid/config.yaml b/java/rapidoid/config.yaml index bebfae12601..15d915974f8 100644 --- a/java/rapidoid/config.yaml +++ b/java/rapidoid/config.yaml @@ -1,4 +1,16 @@ framework: website: rapidoid.org version: 5.5 + +build: + - mvn compile assembly:single -q + +files: + - target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar + +command: > + java -server + -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts + -cp target/benchmark-0.0.1-SNAPSHOT-jar-with-dependencies.jar + benchmark.rapidoid.Main profiles=production diff --git a/java/spring-boot/Dockerfile b/java/spring-boot/Dockerfile deleted file mode 100644 index 9d8033d8997..00000000000 --- a/java/spring-boot/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM maven:3.6-jdk-8 as maven -WORKDIR /spring-boot -COPY pom.xml pom.xml -COPY src src -RUN mvn clean package -q - -FROM openjdk:11-jre-slim -WORKDIR /spring-boot -COPY --from=maven /spring-boot/target/benchmark-0.0.1-SNAPSHOT.jar app.jar - -EXPOSE 3000 - -CMD ["java", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-jar", "app.jar"] - diff --git a/java/spring-boot/config.yaml b/java/spring-boot/config.yaml index 46322d0d856..3c5569dec7f 100644 --- a/java/spring-boot/config.yaml +++ b/java/spring-boot/config.yaml @@ -1,4 +1,11 @@ framework: website: spring.io/projects/spring-boot version: 2.1 - + +files: + - target/benchmark-0.0.1-SNAPSHOT.jar + +command: > + java + -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts + -jar target/benchmark-0.0.1-SNAPSHOT.jar diff --git a/kotlin/ktor/Dockerfile b/kotlin/Dockerfile similarity index 100% rename from kotlin/ktor/Dockerfile rename to kotlin/Dockerfile diff --git a/nim/Dockerfile b/nim/Dockerfile new file mode 100644 index 00000000000..fab31da27c4 --- /dev/null +++ b/nim/Dockerfile @@ -0,0 +1,32 @@ +FROM nimlang/nim:1.0.0 + +RUN apt -y update && \ + apt -y install musl-tools + +WORKDIR /usr/src/app + +COPY server.nim server.nimble ./ + +RUN nimble c \ + -d:danger \ + -d:noSignalHandler \ + --gc:markAndSweep \ + --listFullPaths:off \ + --excessiveStackTrace:off \ + --gcc.exe:musl-gcc \ + --gcc.linkerexe:musl-gcc \ + --passL:-static \ + --passL:"-s" \ + --passC:"-fno-ident" \ + --passC:"-flto" \ + --passC:"-ffast-math" \ + --passC:"-march=native" \ + --passC:"-mtune=native" \ + --passC:"-fsingle-precision-constant" \ + -d:release \ + --threads:on \ + -y server.nim + +FROM alpine +COPY --from=0 /usr/src/app/server /usr/src/app/server +CMD /usr/src/app/server diff --git a/nim/httpbeast/Dockerfile b/nim/httpbeast/Dockerfile deleted file mode 100644 index 70940c25974..00000000000 --- a/nim/httpbeast/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM nimlang/nim:1.0.0 - -WORKDIR /usr/src/app - -COPY server.nim server.nimble ./ - -RUN nimble c -d:release --threads:on -y server.nim - -CMD ./server diff --git a/nim/jester/Dockerfile b/nim/jester/Dockerfile deleted file mode 100644 index 980b457a65c..00000000000 --- a/nim/jester/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM nimlang/nim:1.0.0 - -WORKDIR /usr/src/app - -COPY server_nim_jester.nim server_nim_jester.nimble ./ - -RUN nimble c -d:release --threads:on -y server_nim_jester.nim - -CMD ./server_nim_jester diff --git a/nim/jester/config.yaml b/nim/jester/config.yaml index bb93a461f9b..bd12264691d 100644 --- a/nim/jester/config.yaml +++ b/nim/jester/config.yaml @@ -1,4 +1,7 @@ framework: github: dom96/jester version: 0.4 + +files: + - /usr/src/app/server diff --git a/nim/jester/server_nim_jester.nim b/nim/jester/server.nim similarity index 100% rename from nim/jester/server_nim_jester.nim rename to nim/jester/server.nim diff --git a/nim/jester/server_nim_jester.nimble b/nim/jester/server.nimble similarity index 100% rename from nim/jester/server_nim_jester.nimble rename to nim/jester/server.nimble diff --git a/nim/jester/server_nim_jester.nim.cfg b/nim/jester/server_nim_jester.nim.cfg deleted file mode 100644 index a8f48b15e54..00000000000 --- a/nim/jester/server_nim_jester.nim.cfg +++ /dev/null @@ -1,12 +0,0 @@ --d:danger --d:noSignalHandler ---gc:markAndSweep ---listFullPaths:off ---excessiveStackTrace:off ---passL:"-s" ---passC:"-fno-ident" ---passC:"-flto" ---passC:"-ffast-math" ---passC:"-march=native" ---passC:"-mtune=native" ---passC:"-fsingle-precision-constant" diff --git a/node/0http/Dockerfile b/node/Dockerfile similarity index 100% rename from node/0http/Dockerfile rename to node/Dockerfile diff --git a/node/express/Dockerfile b/node/express/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/express/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/fastify/Dockerfile b/node/fastify/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/fastify/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/foxify/Dockerfile b/node/foxify/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/foxify/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/hapi/Dockerfile b/node/hapi/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/hapi/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/iotjs-express/Dockerfile b/node/iotjs-express/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/iotjs-express/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/koa/Dockerfile b/node/koa/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/koa/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/moleculer/Dockerfile b/node/moleculer/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/moleculer/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/muneem/Dockerfile b/node/muneem/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/muneem/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/polka/Dockerfile b/node/polka/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/polka/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/polkadot/Dockerfile b/node/polkadot/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/polkadot/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/rayo/Dockerfile b/node/rayo/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/rayo/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/restana/Dockerfile b/node/restana/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/restana/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/restify/Dockerfile b/node/restify/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/restify/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/sifrr/Dockerfile b/node/sifrr/Dockerfile deleted file mode 100644 index 44e72768b97..00000000000 --- a/node/sifrr/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_CLUSTER_SCHED_POLICY=rr -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/node/turbo_polka/Dockerfile b/node/turbo_polka/Dockerfile deleted file mode 100644 index f56513e5bb0..00000000000 --- a/node/turbo_polka/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12.11 - -RUN npm -g install pm2 - -WORKDIR /usr/src/app - -COPY app.js package.json ./ - -RUN npm install - -ENV NODE_ENV production - -CMD pm2-runtime start app.js -i $(nproc) diff --git a/objc/Dockerfile b/objc/Dockerfile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/perl/dancer2/Dockerfile b/perl/Dockerfile similarity index 100% rename from perl/dancer2/Dockerfile rename to perl/Dockerfile diff --git a/php/Dockerfile b/php/Dockerfile new file mode 100644 index 00000000000..60112fcac56 --- /dev/null +++ b/php/Dockerfile @@ -0,0 +1,67 @@ +FROM php:7.3-fpm + +RUN apt-get -qq update +RUN apt-get -qy install git zlib1g-dev libzip-dev nginx {{#deps}} {{{.}}} {{/deps}} +RUN docker-php-ext-install zip opcache + +WORKDIR /usr/src/app + +{{#php_ext}} + RUN pecl install {{{.}}} + RUN docker-php-ext-enable {{{.}}} +{{/php_ext}} + +COPY . ./ + +{{^standalone}} +RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN composer install --no-dev --prefer-dist --classmap-authoritative +RUN composer dumpautoload -o +{{/standalone}} + +{{#environment}} +ENV {{{.}}} +{{/environment}} + +{{#before_command}} + RUN {{{.}}} +{{/before_command}} + +{{#command}} + CMD {{{.}}} +{{/command}} + +{{^command}} + RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf + RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf + RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf + RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf + RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf + + RUN rm -fr /etc/nginx/sites-enabled/default + RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf + + RUN echo 'server {\n\ + root /usr/src/app/public;\n\ + listen 0.0.0.0:3000;\n\ + location / {\n\ + fastcgi_pass unix:/var/run/php-fpm.sock;\n\ + fastcgi_param SCRIPT_FILENAME $document_root/index.php;\n\ + include fastcgi_params;\n\ + }\n\ + }\n'\ + >> /etc/nginx/conf.d/www.conf + + RUN echo 'opcache.enable=1\n\ + opcache.memory_consumption=512\n\ + opcache.interned_strings_buffer=64\n\ + opcache.max_accelerated_files=32531\n\ + opcache.validate_timestamps=0\n\ + opcache.save_comments=1\n\ + opcache.fast_shutdown=0\n'\ + >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + + RUN echo "daemon off;" >> /etc/nginx/nginx.conf + + CMD /usr/local/sbin/php-fpm --daemonize; service nginx start +{{/command}} diff --git a/php/basicphp/Dockerfile b/php/basicphp/Dockerfile deleted file mode 100644 index bc75e064db4..00000000000 --- a/php/basicphp/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - -WORKDIR /usr/src/app - -COPY config.php config.php -COPY routes.php routes.php -COPY functions.php functions.php -COPY public public -COPY controllers controllers - -RUN mkdir /usr/src/app/var -RUN chmod 777 -R /usr/src/app/var -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -RUN echo 'server {\n\ - listen 0.0.0.0:3000;\n\ - - root /usr/src/app/public;\n\ - set $front_controller /index.php;\n\ - - location / {\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - - include fastcgi_params;\n\ - fastcgi_param SCRIPT_FILENAME $document_root$front_controller;\n\ - fastcgi_param SCRIPT_NAME $front_controller;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start \ No newline at end of file diff --git a/php/basicphp/config.yaml b/php/basicphp/config.yaml index d252b746104..dbd0a95e146 100644 --- a/php/basicphp/config.yaml +++ b/php/basicphp/config.yaml @@ -1,4 +1,5 @@ framework: github: ray-ang/basicphp version: 0.9 - + +standalone: true diff --git a/php/hyperf/Dockerfile b/php/hyperf/Dockerfile deleted file mode 100644 index 743832dc1a8..00000000000 --- a/php/hyperf/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM php:7.3-fpm - -RUN apt -y update -RUN apt -y install git - -RUN apt -y install libzip-dev -RUN docker-php-ext-install zip - -RUN pecl install redis -RUN docker-php-ext-enable redis - -RUN pecl install swoole-4.4.7 -RUN docker-php-ext-enable swoole - -WORKDIR /usr/src/app - -COPY app app -COPY sbin sbin -COPY config config -COPY composer.json composer.json -COPY swoole.ini /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -CMD php sbin/hyperf.php start diff --git a/php/hyperf/config.yaml b/php/hyperf/config.yaml index 289d3673c38..8babf2d9fbe 100644 --- a/php/hyperf/config.yaml +++ b/php/hyperf/config.yaml @@ -2,3 +2,11 @@ framework: website: www.hyperf.io version: 1.0 +php_ext: + - redis + - swoole + +before_command: + - echo "swoole.use_shortname = 'Off'" >> /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini + +command: php sbin/hyperf.php start diff --git a/php/imi/Dockerfile b/php/imi/Dockerfile deleted file mode 100644 index 652feaa7f08..00000000000 --- a/php/imi/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM php:7.3-fpm - -RUN apt -y update -RUN apt -y install git - -RUN pecl install redis -RUN docker-php-ext-enable redis - -RUN pecl install swoole-4.4.7 -RUN docker-php-ext-enable swoole - -WORKDIR /usr/src - -COPY .runtime .runtime -COPY ApiServer ApiServer -COPY config config -COPY composer.json composer.json -COPY Main.php Main.php - -RUN chmod -R ug+rwx /usr/src/.runtime - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -CMD php vendor/bin/imi server/start -name main diff --git a/php/imi/config.yaml b/php/imi/config.yaml index 82ec2e442b2..b92a7cb4fb4 100644 --- a/php/imi/config.yaml +++ b/php/imi/config.yaml @@ -1,4 +1,10 @@ framework: website: imiphp.com version: 1.0 + +php_ext: + - swoole + - redis + +command: php vendor/bin/imi server/start diff --git a/php/laravel/Dockerfile b/php/laravel/Dockerfile deleted file mode 100644 index 9833265c2be..00000000000 --- a/php/laravel/Dockerfile +++ /dev/null @@ -1,84 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - - -WORKDIR /usr/src/app - -COPY app app -COPY bootstrap/app.php bootstrap/app.php -COPY composer.json . -COPY routes routes -COPY config config -COPY public/index.php public/index.php - -ENV APP_ENV production -ENV APP_DEBUG false -ENV APP_KEY base64:txfHNf/SOo222Rm8I39Urb9SmvUy+nuAF98t/ukF0lk= - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -RUN mkdir bootstrap/cache -RUN mkdir storage/framework/sessions -p -RUN mkdir storage/framework/views -p -RUN mkdir storage/framework/cache -p - -RUN chown -R www-data:www-data /usr/src/app -RUN find /usr/src/app -type f -exec chmod 644 {} \; -RUN find /usr/src/app -type d -exec chmod 755 {} \; -RUN chmod -R ug+rwx storage /usr/src/app/bootstrap/cache - -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -RUN echo 'server {\n\ - root /usr/src/app/public;\n\ - listen 0.0.0.0:3000;\n\ - index index.php;\n\ -\n\ - add_header X-Frame-Options "SAMEORIGIN";\n\ - add_header X-XSS-Protection "1; mode=block";\n\ - add_header X-Content-Type-Options "nosniff";\n\ -\n\ - charset utf-8;\n\ -\n\ - location / {\n\ - try_files $uri $uri/ /index.php?$query_string;\n\ - }\n\ -\n\ - location ~ \.php$ {\n\ - fastcgi_split_path_info ^(.+\.php)(/.+)$;\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - fastcgi_index index.php;\n\ - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n\ - include fastcgi_params;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/laravel/config.yaml b/php/laravel/config.yaml index cdce86324ba..312385ed01e 100644 --- a/php/laravel/config.yaml +++ b/php/laravel/config.yaml @@ -1,3 +1,19 @@ framework: website: laravel.com version: 6.2 + +environment: + APP_ENV: production + APP_DEBUG: false + APP_KEY: base64:txfHNf/SOo222Rm8I39Urb9SmvUy+nuAF98t/ukF0lk= + +before_command: + - mkdir bootstrap/cache + - mkdir storage/framework/sessions -p + - mkdir storage/framework/views -p + - mkdir storage/framework/cache -p + + - chown -R www-data:www-data /usr/src/app + - find /usr/src/app -type f -exec chmod 644 {} \; + - find /usr/src/app -type d -exec chmod 755 {} \; + - chmod -R ug+rwx storage /usr/src/app/bootstrap/cache diff --git a/php/lumen/Dockerfile b/php/lumen/Dockerfile deleted file mode 100644 index 45fa164a9b5..00000000000 --- a/php/lumen/Dockerfile +++ /dev/null @@ -1,83 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - - -WORKDIR /usr/src/app - -COPY app app -COPY bootstrap/app.php bootstrap/app.php -COPY composer.json . -COPY routes routes -COPY public/index.php public/index.php - -ENV APP_ENV production -ENV APP_DEBUG false -ENV APP_KEY base64:txfHNf/SOo222Rm8I39Urb9SmvUy+nuAF98t/ukF0lk= - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -RUN mkdir bootstrap/cache -RUN mkdir storage/framework/sessions -p -RUN mkdir storage/framework/views -p -RUN mkdir storage/framework/cache -p - -RUN chown -R www-data:www-data /usr/src/app -RUN find /usr/src/app -type f -exec chmod 644 {} \; -RUN find /usr/src/app -type d -exec chmod 755 {} \; -RUN chmod -R ug+rwx storage /usr/src/app/bootstrap/cache - -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -RUN echo 'server {\n\ - root /usr/src/app/public;\n\ - listen 0.0.0.0:3000;\n\ - index index.php;\n\ -\n\ - add_header X-Frame-Options "SAMEORIGIN";\n\ - add_header X-XSS-Protection "1; mode=block";\n\ - add_header X-Content-Type-Options "nosniff";\n\ -\n\ - charset utf-8;\n\ -\n\ - location / {\n\ - try_files $uri $uri/ /index.php?$query_string;\n\ - }\n\ -\n\ - location ~ \.php$ {\n\ - fastcgi_split_path_info ^(.+\.php)(/.+)$;\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - fastcgi_index index.php;\n\ - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n\ - include fastcgi_params;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/one/App/Client/RpcTcp.php b/php/one/App/Client/RpcTcp.php index d511861687c..f71e45c61ec 100644 --- a/php/one/App/Client/RpcTcp.php +++ b/php/one/App/Client/RpcTcp.php @@ -73,7 +73,7 @@ private function _callRpc($data) if ($data === self::RPC_REMOTE_OBJ) { $this->_need_close = 1; return $this; - } else if (is_array($data) && isset($data['err'], $data['msg'])) { + } elseif (is_array($data) && isset($data['err'], $data['msg'])) { throw new \Exception($data['msg'], $data['err']); } else { return $data; diff --git a/php/one/App/Cloud/Actor.php b/php/one/App/Cloud/Actor.php index 65dc20f6b84..34357a43a6d 100644 --- a/php/one/App/Cloud/Actor.php +++ b/php/one/App/Cloud/Actor.php @@ -75,7 +75,7 @@ public function call($actor_id, $method, $args) $arr = explode('.', $actor_id); if ($arr[0] == self::$conf['self_key'] && $arr[1] == self::$server->worker_id) { // 同机器 同进程 return self::dispatch($actor_id, $method, $args); - } else if ($arr[0] == self::$conf['self_key']) { // 同机器 其他进程 + } elseif ($arr[0] == self::$conf['self_key']) { // 同机器 其他进程 return self::$server->sendMessage([$actor_id, $method, $args], $arr[1]); } else { // 其他机器 return self::$client->setConnect($arr[0])->setStaticMethod()->router($actor_id, $method, $args); @@ -111,4 +111,4 @@ class user extends Actor $user2 = user::init(); -*/ \ No newline at end of file +*/ diff --git a/php/one/App/Cloud/Client.php b/php/one/App/Cloud/Client.php index bf59941ef67..976a3c2ba13 100644 --- a/php/one/App/Cloud/Client.php +++ b/php/one/App/Cloud/Client.php @@ -8,7 +8,6 @@ namespace App\Cloud; - use App\Client\RpcTcp; use One\Facades\Log; use One\Swoole\Client\Tcp; @@ -39,4 +38,4 @@ public function setConnect($key) $this->_connection->setConnection($key); return $this; } -} \ No newline at end of file +} diff --git a/php/one/App/Cloud/Server.php b/php/one/App/Cloud/Server.php index b60b1925a4c..d8b29db3a6a 100644 --- a/php/one/App/Cloud/Server.php +++ b/php/one/App/Cloud/Server.php @@ -133,4 +133,4 @@ public function remote($key) { return self::$client->setConnect($key); } -} \ No newline at end of file +} diff --git a/php/one/App/Config/actor.php b/php/one/App/Config/actor.php index fd90a44fa6b..f987c61207b 100644 --- a/php/one/App/Config/actor.php +++ b/php/one/App/Config/actor.php @@ -11,4 +11,4 @@ return [ 'self_key' => 'server1', //php swoole.php protocol //'self_key' => 'server2', //php swoole.php protocol2 -]; \ No newline at end of file +]; diff --git a/php/one/App/Config/cache.php b/php/one/App/Config/cache.php index a512e86041f..8792be45808 100644 --- a/php/one/App/Config/cache.php +++ b/php/one/App/Config/cache.php @@ -31,4 +31,3 @@ ] ] ]; - diff --git a/php/one/App/Config/cloud.php b/php/one/App/Config/cloud.php index 49eb9995502..7c9fcacecce 100644 --- a/php/one/App/Config/cloud.php +++ b/php/one/App/Config/cloud.php @@ -10,4 +10,4 @@ return [ 'self_key' => 'server99' -]; \ No newline at end of file +]; diff --git a/php/one/App/Config/crypt.php b/php/one/App/Config/crypt.php index 31cc1e4391f..e352611015e 100644 --- a/php/one/App/Config/crypt.php +++ b/php/one/App/Config/crypt.php @@ -3,4 +3,4 @@ 'secret_key' => sha1(__FILE__), // 加密key 'sign_key' => sha1(__FILE__), // 签名key 'method' => 'AES-128-ECB' -]; \ No newline at end of file +]; diff --git a/php/one/App/Config/exception.php b/php/one/App/Config/exception.php index 98dfba62a57..9199d00a3cf 100644 --- a/php/one/App/Config/exception.php +++ b/php/one/App/Config/exception.php @@ -10,4 +10,4 @@ // 'render' => function(\One\Exceptions\HttpException $e){ // return 'err!'; // } -]; \ No newline at end of file +]; diff --git a/php/one/App/Config/log.php b/php/one/App/Config/log.php index a1375c1c51c..4277d892efb 100644 --- a/php/one/App/Config/log.php +++ b/php/one/App/Config/log.php @@ -4,4 +4,4 @@ 'path' => _APP_PATH_.'/RunCache/log', // 存放日志目录 'id' => uuid() // 每个请求的日志里的唯一id -]; \ No newline at end of file +]; diff --git a/php/one/App/Config/router.php b/php/one/App/Config/router.php index 5fbb016a321..5711e785022 100644 --- a/php/one/App/Config/router.php +++ b/php/one/App/Config/router.php @@ -11,4 +11,3 @@ Router::get('/user/{id}', \App\Controllers\IndexController::class . '@get'); Router::post('/user', \App\Controllers\IndexController::class . '@create'); - diff --git a/php/one/App/Config/rpc.php b/php/one/App/Config/rpc.php index 8b77e21d5e7..52656144601 100644 --- a/php/one/App/Config/rpc.php +++ b/php/one/App/Config/rpc.php @@ -7,4 +7,3 @@ */ use \One\Swoole\RpcServer; - diff --git a/php/one/App/Config/session.php b/php/one/App/Config/session.php index 1cf7c623d9b..bb73099dfc9 100644 --- a/php/one/App/Config/session.php +++ b/php/one/App/Config/session.php @@ -4,5 +4,3 @@ 'name' => 'session_id', // session_id 名字 也就是发给客户端cookie的名字 'domain' => 'app.net' ]; - - diff --git a/php/one/App/Controllers/IndexController.php b/php/one/App/Controllers/IndexController.php index 40c776c8fff..d823b673ae2 100644 --- a/php/one/App/Controllers/IndexController.php +++ b/php/one/App/Controllers/IndexController.php @@ -20,9 +20,4 @@ public function create() { return ''; } - } - - - - diff --git a/php/one/App/GlobalData/Client.php b/php/one/App/GlobalData/Client.php index 02998252f42..55da8270e40 100644 --- a/php/one/App/GlobalData/Client.php +++ b/php/one/App/GlobalData/Client.php @@ -31,4 +31,4 @@ public function __call($name, $arguments) $ret = msgpack_unpack($res); return $ret; } -} \ No newline at end of file +} diff --git a/php/one/App/GlobalData/Data.php b/php/one/App/GlobalData/Data.php index 2380808678e..a92e8f6a542 100644 --- a/php/one/App/GlobalData/Data.php +++ b/php/one/App/GlobalData/Data.php @@ -105,7 +105,7 @@ public function pop($k) } if (is_array($wr)) { $r = array_shift($wr); - } else if (is_string($wr)) { + } elseif (is_string($wr)) { $r = $wr{0}; $wr = substr($wr, 1); } else { @@ -135,7 +135,7 @@ public function length($k) } if (is_array($wr)) { return count($wr); - } else if (is_string($wr)) { + } elseif (is_string($wr)) { return strlen($wr); } else { return 0; @@ -349,5 +349,4 @@ public function getIdByFd($fd, $fd_key = 'fd', $id_key = 'id') { return $this->get("{$fd_key}-{$id_key}.{$fd}"); } - } diff --git a/php/one/App/GlobalData/Server.php b/php/one/App/GlobalData/Server.php index 78dd2177372..bd39488a86b 100644 --- a/php/one/App/GlobalData/Server.php +++ b/php/one/App/GlobalData/Server.php @@ -54,7 +54,5 @@ public function onWorkerStart(\swoole_server $server, $worker_id) public function onClose(\swoole_server $server, $fd, $reactor_id) { - } - -} \ No newline at end of file +} diff --git a/php/one/App/Model/User.php b/php/one/App/Model/User.php index 011f40091c1..2d098e1c709 100644 --- a/php/one/App/Model/User.php +++ b/php/one/App/Model/User.php @@ -6,5 +6,5 @@ class User extends Model { - CONST TABLE = 'users'; -} \ No newline at end of file + const TABLE = 'users'; +} diff --git a/php/one/App/Server/AppHttpPort.php b/php/one/App/Server/AppHttpPort.php index 0ad7085f399..ff6f1fa5cfa 100644 --- a/php/one/App/Server/AppHttpPort.php +++ b/php/one/App/Server/AppHttpPort.php @@ -14,11 +14,11 @@ class AppHttpPort extends Http { public function onRequest(\swoole_http_request $request, \swoole_http_response $response) { - $this->httpRouter($request,$response); + $this->httpRouter($request, $response); } public function onClose(\swoole_server $server, $fd, $reactor_id) { parent::onClose($server, $fd, $reactor_id); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/AppHttpServer.php b/php/one/App/Server/AppHttpServer.php index d115a59d57d..94eda03b3f6 100644 --- a/php/one/App/Server/AppHttpServer.php +++ b/php/one/App/Server/AppHttpServer.php @@ -8,7 +8,6 @@ namespace App\Server; - use App\GlobalData\Client; use One\Http\Router; use One\Swoole\Server\HttpServer; @@ -37,4 +36,4 @@ public function onWorkerStart(\swoole_server $server, $worker_id) Router::clearCache(); require _APP_PATH_ . '/config.php'; } -} \ No newline at end of file +} diff --git a/php/one/App/Server/AppTcpPort.php b/php/one/App/Server/AppTcpPort.php index 80ff2c9211d..aaaa4623b5b 100644 --- a/php/one/App/Server/AppTcpPort.php +++ b/php/one/App/Server/AppTcpPort.php @@ -23,6 +23,6 @@ class AppTcpPort extends Tcp */ public function onReceive(\swoole_server $server, $fd, $reactor_id, $data) { - $this->tcpRouter($server,$fd,$reactor_id,$data); + $this->tcpRouter($server, $fd, $reactor_id, $data); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/AppTcpServer.php b/php/one/App/Server/AppTcpServer.php index 87c1ee5523e..e93ab9232ff 100644 --- a/php/one/App/Server/AppTcpServer.php +++ b/php/one/App/Server/AppTcpServer.php @@ -23,6 +23,6 @@ class AppTcpServer extends TcpServer */ public function onReceive(\swoole_server $server, $fd, $reactor_id, $data) { - $this->tcpRouter($server,$fd,$reactor_id,$data); + $this->tcpRouter($server, $fd, $reactor_id, $data); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/AppWsServer.php b/php/one/App/Server/AppWsServer.php index 2bf04c3af0e..cd7fc1c6752 100644 --- a/php/one/App/Server/AppWsServer.php +++ b/php/one/App/Server/AppWsServer.php @@ -13,7 +13,7 @@ class AppWsServer extends WsServer { -// 分布式 + // 分布式 // protected $cloud_server = null; // // public function __construct(\swoole_server $server, array $conf) @@ -43,4 +43,4 @@ public function onClose(\swoole_server $server, $fd, $reactor_id) parent::onClose($server, $fd, $reactor_id); unset($this->session[$fd]); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/RpcHttpPort.php b/php/one/App/Server/RpcHttpPort.php index 943a470caa9..fee4853fcd2 100644 --- a/php/one/App/Server/RpcHttpPort.php +++ b/php/one/App/Server/RpcHttpPort.php @@ -22,4 +22,3 @@ public function onRequest(\swoole_http_request $request, \swoole_http_response $ $response->end($str); } } - diff --git a/php/one/App/Server/RpcHttpServer.php b/php/one/App/Server/RpcHttpServer.php index 99489a84052..691a87a6d48 100644 --- a/php/one/App/Server/RpcHttpServer.php +++ b/php/one/App/Server/RpcHttpServer.php @@ -21,4 +21,4 @@ public function onRequest(\swoole_http_request $request, \swoole_http_response $ $str = $this->callRpc($data, 1, 'http://' . $request->header['host'] . '/', isset($request->get['px']) ? $request->get['px'] : 'Rpc'); $response->end($str); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/RpcTcpPort.php b/php/one/App/Server/RpcTcpPort.php index a54052f5a4b..9fffe3cb5ba 100644 --- a/php/one/App/Server/RpcTcpPort.php +++ b/php/one/App/Server/RpcTcpPort.php @@ -19,4 +19,4 @@ public function onReceive(\swoole_server $server, $fd, $reactor_id, $data) $str = $this->callRpc($data); $this->send($fd, $str); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/RpcTcpServer.php b/php/one/App/Server/RpcTcpServer.php index d8dcc9a28ef..4d5f15fda8d 100644 --- a/php/one/App/Server/RpcTcpServer.php +++ b/php/one/App/Server/RpcTcpServer.php @@ -19,4 +19,4 @@ public function onReceive(\swoole_server $server, $fd, $reactor_id, $data) $str = $this->callRpc($data); $this->server->send($fd, $str); } -} \ No newline at end of file +} diff --git a/php/one/App/Server/RpcTrait.php b/php/one/App/Server/RpcTrait.php index 3fa3b5f8b42..7d45905dce9 100644 --- a/php/one/App/Server/RpcTrait.php +++ b/php/one/App/Server/RpcTrait.php @@ -8,7 +8,6 @@ namespace App\Server; - use One\Facades\Log; use One\Swoole\RpcServer; @@ -22,14 +21,14 @@ private function callRpc($data, $ide = 0, $host = '', $px = '') $go_id = Log::setTraceId($arr['i'] . '.' . uuid()); $str = msgpack_pack(RpcServer::call($arr)); Log::flushTraceId($go_id); - } else if ($ide === 1) { + } elseif ($ide === 1) { $str = RpcServer::ideHelper($host, $px); } else { $str = msgpack_pack('params error'); } return $str; } catch (\Throwable $e) { - if(isset($go_id)){ + if (isset($go_id)) { Log::flushTraceId($go_id); } error_report($e); @@ -38,6 +37,5 @@ private function callRpc($data, $ide = 0, $host = '', $px = '') 'msg' => $e->getMessage() ]); } - } -} \ No newline at end of file +} diff --git a/php/one/App/Server/RpcWsServer.php b/php/one/App/Server/RpcWsServer.php index d67c4ce6c6c..35f6c2d71a4 100644 --- a/php/one/App/Server/RpcWsServer.php +++ b/php/one/App/Server/RpcWsServer.php @@ -19,4 +19,4 @@ public function onMessage(\swoole_websocket_server $server, \swoole_websocket_fr $str = $this->callRpc($frame->data); $server->push($frame->fd, $str); } -} \ No newline at end of file +} diff --git a/php/one/App/View/error.php b/php/one/App/View/error.php index d70de4c9188..23d46e4aa0b 100644 --- a/php/one/App/View/error.php +++ b/php/one/App/View/error.php @@ -1 +1 @@ - \ No newline at end of file +getCode())); } - diff --git a/php/one/App/public/index.php b/php/one/App/public/index.php index fb412e2b19a..408a43310fd 100644 --- a/php/one/App/public/index.php +++ b/php/one/App/public/index.php @@ -1,2 +1,2 @@ > /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/spiral/Dockerfile b/php/spiral/Dockerfile deleted file mode 100644 index 6fee487c13a..00000000000 --- a/php/spiral/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM php:7.3 - -RUN apt-get -qy update - -WORKDIR /usr/src/app - -COPY app app -COPY app.php app.php -COPY .rr.yaml .rr.yaml -COPY composer.json composer.json - -# install composer -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# php/zip extension is required for composer -RUN apt -y update && apt -y install zlib1g-dev libzip-dev -RUN docker-php-ext-install zip - -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -# dumping autoloader require php/opcache -RUN docker-php-ext-install opcache - -# install spiral binary file -RUN vendor/bin/spiral get - -# configure -RUN php app.php configure - -# run roadrunner -CMD php app.php up > /dev/null 2>&1 && ./spiral serve diff --git a/php/spiral/config.yaml b/php/spiral/config.yaml index 3324cf8608c..dce0a671553 100644 --- a/php/spiral/config.yaml +++ b/php/spiral/config.yaml @@ -1,4 +1,9 @@ framework: github: spiral/framework version: 2.1 - + +before_command: + - vendor/bin/spiral get + - php app.php configure + +command: ./spiral serve \ No newline at end of file diff --git a/php/swoft/Dockerfile b/php/swoft/Dockerfile deleted file mode 100644 index d1219fc09e0..00000000000 --- a/php/swoft/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM php:7.3-fpm - -RUN apt -y update -RUN apt -y install git - -RUN pecl install redis -RUN docker-php-ext-enable redis - -RUN pecl install swoole-4.4.7 -RUN docker-php-ext-enable swoole - -WORKDIR /usr/src/app - -COPY app app -COPY bin bin -COPY composer.json composer.json -COPY config config - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative -RUN composer dumpautoload -o - -CMD php bin/swoft http:start diff --git a/php/swoft/composer.json b/php/swoft/composer.json index d3d4ceb81c2..0bcc62fa2e1 100644 --- a/php/swoft/composer.json +++ b/php/swoft/composer.json @@ -1,7 +1,7 @@ { "require": { "swoft/framework": "2.0.*", - "swoft/http-server": "2.0.*" + "swoft/http-server": "*" }, "autoload": { "psr-4": { diff --git a/php/swoft/config.yaml b/php/swoft/config.yaml index 1387daa5c44..f89d9481b98 100644 --- a/php/swoft/config.yaml +++ b/php/swoft/config.yaml @@ -2,3 +2,8 @@ framework: website: swoft.org version: 2.0 +php_ext: + - redis + - swoole + +command: php bin/swoft http:start diff --git a/php/symfony/Dockerfile b/php/symfony/Dockerfile deleted file mode 100644 index ed56b8fef13..00000000000 --- a/php/symfony/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - - -WORKDIR /usr/src/app - -COPY composer.json . -COPY src src -COPY config config -COPY public public -COPY bin bin - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative - -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -ENV APP_ENV prod - -RUN mkdir -p var/log && chown www-data var/log -RUN mkdir -p var/cache && chown www-data var/cache -RUN php bin/console cache:warmup - -RUN echo 'server {\n\ - root /usr/src/app/public;\n\ - listen 0.0.0.0:3000;\n\ - location / {\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - fastcgi_param SCRIPT_FILENAME $document_root/index.php;\n\ - include fastcgi_params;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/symfony/config.yaml b/php/symfony/config.yaml index 99c6555ada9..3952c8dc2c0 100644 --- a/php/symfony/config.yaml +++ b/php/symfony/config.yaml @@ -2,3 +2,14 @@ framework: website: symfony.com version: 4.3 + +deps: + - nginx + +environment: + APP_ENV: prod + +before_command: + - mkdir -p var/log && chown www-data var/log + - mkdir -p var/cache && chown www-data var/cache + - php bin/console cache:warmup \ No newline at end of file diff --git a/php/zend-expressive/Dockerfile b/php/zend-expressive/Dockerfile deleted file mode 100644 index f5a1a0073ed..00000000000 --- a/php/zend-expressive/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - - -WORKDIR /usr/src/app - -COPY composer.json . -COPY public public -COPY config config -COPY src src - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative - -RUN mkdir /usr/src/app/data -RUN chmod 777 -R /usr/src/app/data -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -ENV APP_ENV prod - -RUN echo 'server {\n\ - listen 0.0.0.0:3000;\n\ - root /usr/src/app/public;\n\ - set $front_controller /index.php;\n\ - location / {\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - include fastcgi_params;\n\ - fastcgi_param SCRIPT_FILENAME $document_root$front_controller;\n\ - fastcgi_param SCRIPT_NAME $front_controller;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/zend-expressive/config.yaml b/php/zend-expressive/config.yaml index d354fea3224..c10dfaa6c68 100644 --- a/php/zend-expressive/config.yaml +++ b/php/zend-expressive/config.yaml @@ -2,3 +2,6 @@ framework: website: zendframework.github.io/zend-expressive version: 3.2 +before_command: + - mkdir /usr/src/app/data + - chmod 777 -R /usr/src/app/data \ No newline at end of file diff --git a/php/zend-framework/Dockerfile b/php/zend-framework/Dockerfile deleted file mode 100644 index c6c26a3fd70..00000000000 --- a/php/zend-framework/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -FROM php:7.3-fpm - -RUN apt-get -qy update -RUN apt-get -y install git nginx zlib1g-dev libzip-dev -RUN docker-php-ext-install zip opcache - - -WORKDIR /usr/src/app - -COPY composer.json . -COPY public public -COPY config config -COPY module module - -RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --no-dev --prefer-dist --classmap-authoritative - -RUN mkdir /usr/src/app/data -RUN chmod 777 -R /usr/src/app/data -RUN sed -i 's/\;prefix.*/prefix = \/usr\/src\/app\/public/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\(listen =\).*/\1 \/var\/run\/php-fpm.sock/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.owner.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.group.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf -RUN sed -i 's/\;\(listen\.mode.*\).*/\1/g' /usr/local/etc/php-fpm.d/www.conf - -RUN rm -fr /etc/nginx/sites-enabled/default -RUN rm -fr /usr/local/etc/php-fpm.d/zz-docker.conf - -ENV APP_ENV prod - -RUN echo 'server {\n\ - listen 0.0.0.0:3000;\n\ - root /usr/src/app/public;\n\ - set $front_controller /index.php;\n\ - location / {\n\ - fastcgi_pass unix:/var/run/php-fpm.sock;\n\ - include fastcgi_params;\n\ - fastcgi_param SCRIPT_FILENAME $document_root$front_controller;\n\ - fastcgi_param SCRIPT_NAME $front_controller;\n\ - }\n\ -}\n'\ ->> /etc/nginx/conf.d/www.conf - -RUN echo 'opcache.enable=1\n\ -opcache.memory_consumption=512\n\ -opcache.interned_strings_buffer=64\n\ -opcache.max_accelerated_files=32531\n\ -opcache.validate_timestamps=0\n\ -opcache.save_comments=1\n\ -opcache.fast_shutdown=0\n'\ ->> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN echo "daemon off;" >> /etc/nginx/nginx.conf - - -EXPOSE 3000 - -CMD /usr/local/sbin/php-fpm --daemonize; service nginx start diff --git a/php/zend-framework/config.yaml b/php/zend-framework/config.yaml index 2b97b31472b..de338cd1e08 100644 --- a/php/zend-framework/config.yaml +++ b/php/zend-framework/config.yaml @@ -2,3 +2,6 @@ framework: website: framework.zend.com version: 3.1 +before_command: + - mkdir /usr/src/app/data + - chmod 777 -R /usr/src/app/data diff --git a/python/cyclone/Dockerfile b/python/Dockerfile similarity index 54% rename from python/cyclone/Dockerfile rename to python/Dockerfile index a24843e5858..9f0cb67915f 100644 --- a/python/cyclone/Dockerfile +++ b/python/Dockerfile @@ -2,8 +2,7 @@ FROM python:3.7 WORKDIR /usr/src/app -COPY requirements.txt server.py ./ - +COPY . ./ RUN pip install --no-cache-dir -r requirements.txt -CMD twistd --python=server.py --nodaemon +CMD {{command}} diff --git a/python/aiohttp/Dockerfile b/python/aiohttp/Dockerfile deleted file mode 100644 index 3c947668990..00000000000 --- a/python/aiohttp/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class aiohttp.GunicornUVLoopWebWorker server:app diff --git a/python/aiohttp/config.yaml b/python/aiohttp/config.yaml index 0bf9c35051c..86103c0a4ba 100644 --- a/python/aiohttp/config.yaml +++ b/python/aiohttp/config.yaml @@ -1,3 +1,12 @@ framework: website: aiohttp.readthedocs.io - version: 3.6 + version: 3.6 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class aiohttp.GunicornUVLoopWebWorker \ + server:app diff --git a/python/asgineer/Dockerfile b/python/asgineer/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/asgineer/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/asgineer/config.yaml b/python/asgineer/config.yaml index def0bbbc026..0bf99ecc3b2 100644 --- a/python/asgineer/config.yaml +++ b/python/asgineer/config.yaml @@ -1,3 +1,12 @@ framework: website: asgineer.readthedocs.io version: 0.7 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app diff --git a/python/blacksheep/Dockerfile b/python/blacksheep/Dockerfile deleted file mode 100644 index 235ab78420c..00000000000 --- a/python/blacksheep/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/blacksheep/config.yaml b/python/blacksheep/config.yaml index 311c4749c04..9d136d443d4 100644 --- a/python/blacksheep/config.yaml +++ b/python/blacksheep/config.yaml @@ -2,3 +2,11 @@ framework: github: RobertoPrevato/BlackSheep version: 0.2 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app diff --git a/python/bocadillo/Dockerfile b/python/bocadillo/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/bocadillo/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/bocadillo/config.yaml b/python/bocadillo/config.yaml index fff39828a8a..562f1efb56f 100644 --- a/python/bocadillo/config.yaml +++ b/python/bocadillo/config.yaml @@ -2,3 +2,11 @@ framework: website: bocadilloproject.github.io version: 0.18 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app diff --git a/python/bottle/Dockerfile b/python/bottle/Dockerfile deleted file mode 100644 index 7807ae6d886..00000000000 --- a/python/bottle/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker server:app diff --git a/python/bottle/config.yaml b/python/bottle/config.yaml index de8e7a05588..15fd6b09dec 100644 --- a/python/bottle/config.yaml +++ b/python/bottle/config.yaml @@ -2,3 +2,11 @@ framework: website: bottlepy.org version: 0.12 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:app diff --git a/python/clastic/Dockerfile b/python/clastic/Dockerfile deleted file mode 100644 index 01a2804bdbe..00000000000 --- a/python/clastic/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker server:app diff --git a/python/clastic/config.yaml b/python/clastic/config.yaml index 2b28dc6a595..44089805551 100644 --- a/python/clastic/config.yaml +++ b/python/clastic/config.yaml @@ -2,3 +2,11 @@ framework: github: mahmoud/clastic version: 19.9 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:app diff --git a/python/cyclone/config.yaml b/python/cyclone/config.yaml index 85cd8ca2fcf..5151a09427b 100644 --- a/python/cyclone/config.yaml +++ b/python/cyclone/config.yaml @@ -1,3 +1,5 @@ framework: website: cyclone.io version: 1.3 + +command: twistd --python=server.py --nodaemon diff --git a/python/django/Dockerfile b/python/django/Dockerfile deleted file mode 100644 index 54eaca18dd3..00000000000 --- a/python/django/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt settings.py ./ -COPY app app - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker app.wsgi diff --git a/python/django/config.yaml b/python/django/config.yaml index 99fac325080..e0adc5ec9a0 100644 --- a/python/django/config.yaml +++ b/python/django/config.yaml @@ -2,3 +2,11 @@ framework: website: djangoproject.com version: 2.2 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + app.wsgi diff --git a/python/falcon/Dockerfile b/python/falcon/Dockerfile deleted file mode 100644 index bc5d20f75bc..00000000000 --- a/python/falcon/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --worker-class meinheld.gmeinheld.MeinheldWorker --workers $(nproc) server:app diff --git a/python/falcon/config.yaml b/python/falcon/config.yaml index 71fe1a5e2ff..7e3ca2e7138 100644 --- a/python/falcon/config.yaml +++ b/python/falcon/config.yaml @@ -2,3 +2,12 @@ framework: website: falconframework.org version: 2.0 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:app \ No newline at end of file diff --git a/python/fastapi/Dockerfile b/python/fastapi/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/fastapi/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/fastapi/config.yaml b/python/fastapi/config.yaml index ca8cd6ce538..07b3af2b281 100644 --- a/python/fastapi/config.yaml +++ b/python/fastapi/config.yaml @@ -1,3 +1,12 @@ framework: website: fastapi.tiangolo.com version: 0.42 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app diff --git a/python/flask/Dockerfile b/python/flask/Dockerfile deleted file mode 100644 index 01a2804bdbe..00000000000 --- a/python/flask/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker server:app diff --git a/python/flask/config.yaml b/python/flask/config.yaml index 461299a4a91..b7b178a9983 100644 --- a/python/flask/config.yaml +++ b/python/flask/config.yaml @@ -2,3 +2,11 @@ framework: website: flask.pocoo.org version: 1.1 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:app diff --git a/python/hug/Dockerfile b/python/hug/Dockerfile deleted file mode 100644 index bf34eea4cf3..00000000000 --- a/python/hug/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker server:__hug_wsgi__ diff --git a/python/hug/config.yaml b/python/hug/config.yaml index 9295eb866d6..182de9622ea 100644 --- a/python/hug/config.yaml +++ b/python/hug/config.yaml @@ -1,4 +1,13 @@ framework: website: hug.rest version: 2.6 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:__hug_wsgi__ diff --git a/python/japronto/Dockerfile b/python/japronto/Dockerfile deleted file mode 100644 index 2db2f391d7a..00000000000 --- a/python/japronto/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD python server.py $(nproc) diff --git a/python/japronto/config.yaml b/python/japronto/config.yaml index 420d83dd9cd..aa7d5d36b56 100644 --- a/python/japronto/config.yaml +++ b/python/japronto/config.yaml @@ -2,3 +2,4 @@ framework: github: squeaky-pl/japronto version: 0.1 +command: python server.py $(nproc) \ No newline at end of file diff --git a/python/masonite/Dockerfile b/python/masonite/Dockerfile deleted file mode 100644 index b9a494b1ff7..00000000000 --- a/python/masonite/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt wsgi.py ./ -COPY app app -COPY bootstrap bootstrap -COPY config config -COPY routes routes - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker wsgi diff --git a/python/masonite/config.yaml b/python/masonite/config.yaml index 5dd9b33f5cf..bc7609be19d 100644 --- a/python/masonite/config.yaml +++ b/python/masonite/config.yaml @@ -1,4 +1,12 @@ framework: website: masoniteproject.com version: 2.2 - + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + wsgi diff --git a/python/molten/Dockerfile b/python/molten/Dockerfile deleted file mode 100644 index 7807ae6d886..00000000000 --- a/python/molten/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class meinheld.gmeinheld.MeinheldWorker server:app diff --git a/python/molten/config.yaml b/python/molten/config.yaml index 4e503442a54..fb641d3584f 100644 --- a/python/molten/config.yaml +++ b/python/molten/config.yaml @@ -2,3 +2,11 @@ framework: website: moltenframework.com version: 0.27 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class meinheld.gmeinheld.MeinheldWorker \ + server:app diff --git a/python/quart/Dockerfile b/python/quart/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/quart/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/quart/config.yaml b/python/quart/config.yaml index 02d69feef5c..7eba5da2729 100644 --- a/python/quart/config.yaml +++ b/python/quart/config.yaml @@ -1,3 +1,12 @@ framework: website: pgjones.gitlab.io/quart version: "0.10" + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app \ No newline at end of file diff --git a/python/responder/Dockerfile b/python/responder/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/responder/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/responder/config.yaml b/python/responder/config.yaml index 67a1b1bed53..8f6ba6d292f 100644 --- a/python/responder/config.yaml +++ b/python/responder/config.yaml @@ -2,3 +2,11 @@ framework: website: python-responder.org version: 1.3 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app \ No newline at end of file diff --git a/python/sanic/Dockerfile b/python/sanic/Dockerfile deleted file mode 100644 index b18f25caa1d..00000000000 --- a/python/sanic/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - -COPY requirements.txt server.py ./ - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class sanic.worker.GunicornWorker server:app diff --git a/python/sanic/config.yaml b/python/sanic/config.yaml index b5ecae5400d..d811dd68971 100644 --- a/python/sanic/config.yaml +++ b/python/sanic/config.yaml @@ -1,4 +1,12 @@ framework: github: huge-success/sanic version: 19.9 - + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class sanic.worker.GunicornWorker \ + server:app diff --git a/python/starlette/Dockerfile b/python/starlette/Dockerfile deleted file mode 100644 index 916a161d9c0..00000000000 --- a/python/starlette/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker server:app diff --git a/python/starlette/config.yaml b/python/starlette/config.yaml index 112aec5d1cb..744392d8299 100644 --- a/python/starlette/config.yaml +++ b/python/starlette/config.yaml @@ -1,4 +1,15 @@ framework: website: starlette.io version: 0.12 + +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class uvicorn.workers.UvicornWorker \ + server:app + + diff --git a/python/tornado/Dockerfile b/python/tornado/Dockerfile deleted file mode 100644 index 9fca89a4f61..00000000000 --- a/python/tornado/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.7 - -WORKDIR /usr/src/app - -COPY requirements.txt server.py ./ - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 3000 - -CMD gunicorn --log-level warning --bind 0.0.0.0:3000 --reuse-port --workers $(nproc) --worker-class gunicorn.workers.gtornado.TornadoWorker server:app diff --git a/python/tornado/config.yaml b/python/tornado/config.yaml index 5bfc988054d..b2f3a95661d 100644 --- a/python/tornado/config.yaml +++ b/python/tornado/config.yaml @@ -2,3 +2,11 @@ framework: website: tornadoweb.org version: 5.1 +command: > + gunicorn \ + --log-level warning \ + --bind 0.0.0.0:3000 \ + --reuse-port \ + --workers $(nproc) \ + --worker-class gunicorn.workers.gtornado.TornadoWorker \ + server:app \ No newline at end of file diff --git a/ruby/Dockerfile b/ruby/Dockerfile new file mode 100644 index 00000000000..f5a6ad860b8 --- /dev/null +++ b/ruby/Dockerfile @@ -0,0 +1,19 @@ +FROM ruby:2.6 + +WORKDIR /usr/src/app + +COPY . ./ + +RUN bundle install --without development test + +{{#environment}} +ENV {{{.}}} +{{/environment}} + +{{#command}} + CMD {{{command}}} +{{/command}} + +{{^command}} + CMD bundle exec puma -p 3000 -e production -w $(nproc) +{{/command}} diff --git a/ruby/agoo/Dockerfile b/ruby/agoo/Dockerfile deleted file mode 100644 index 4fdfc73c36c..00000000000 --- a/ruby/agoo/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb ./ - -RUN bundle install - -CMD AGOO_WORKER_COUNT=$(nproc) ruby app.rb diff --git a/ruby/agoo/config.yaml b/ruby/agoo/config.yaml index 5745b34824f..c754d347177 100644 --- a/ruby/agoo/config.yaml +++ b/ruby/agoo/config.yaml @@ -1,3 +1,8 @@ framework: github: ohler55/agoo version: 2.11 + +environment: + AGOO_WORKER_COUNT: $(nproc) + +command: ruby app.rb diff --git a/ruby/camping/Dockerfile b/ruby/camping/Dockerfile deleted file mode 100644 index e5f392ebf25..00000000000 --- a/ruby/camping/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb config.ru ./ - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/cuba/Dockerfile b/ruby/cuba/Dockerfile deleted file mode 100644 index e5f392ebf25..00000000000 --- a/ruby/cuba/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb config.ru ./ - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/flame/Dockerfile b/ruby/flame/Dockerfile deleted file mode 100644 index 6754fbcfb3b..00000000000 --- a/ruby/flame/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile application.rb config.ru ./ -COPY controllers controllers - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/grape/Dockerfile b/ruby/grape/Dockerfile deleted file mode 100644 index 9d90740448d..00000000000 --- a/ruby/grape/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile config.ru ./ - -RUN bundle install - -EXPOSE 3000 - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/hanami/Dockerfile b/ruby/hanami/Dockerfile deleted file mode 100644 index 73dbdd55fcf..00000000000 --- a/ruby/hanami/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile config.ru ./ -COPY apps apps -COPY config config - -ENV HANAMI_ENV production - -RUN bundle install - -EXPOSE 3000 - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/plezi/Dockerfile b/ruby/plezi/Dockerfile deleted file mode 100644 index 5d2803e5743..00000000000 --- a/ruby/plezi/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile config.ru ./ - -RUN bundle install - -CMD bundle exec iodine -w $(nproc) -p 3000 -t 1 diff --git a/ruby/plezi/config.yaml b/ruby/plezi/config.yaml index e6527658c0f..9decd6e931d 100644 --- a/ruby/plezi/config.yaml +++ b/ruby/plezi/config.yaml @@ -1,3 +1,5 @@ framework: github: boazsegev/plezi version: 0.16 + +command: bundle exec iodine -w $(nproc) -p 3000 -t 1 diff --git a/ruby/rack-routing/Dockerfile b/ruby/rack-routing/Dockerfile deleted file mode 100644 index 333742d8021..00000000000 --- a/ruby/rack-routing/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile Guardfile config.ru ./ -COPY app app -COPY config config -COPY spec spec - -RUN bundle install - -EXPOSE 3000 - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/rack-routing/README.md b/ruby/rack-routing/README.md deleted file mode 100755 index d1108cf7239..00000000000 --- a/ruby/rack-routing/README.md +++ /dev/null @@ -1,31 +0,0 @@ -## Rack Routing Demo ----- -This app shows how to use the [Rack Routing gem](https://github.com/iAmPlus/rack-routing). - -### Route http requests to Ruby methods: - -1. `GET /` => `get_root` -1. `GET /foos/:id` => `get_foo` (with `@url_params`) -1. `POST /foos` => `post_foos` - -### Examples: - -Request: `POST /foos, { "bar":"baz" }` -Ruby: - - def post_foos - Foo.create @params - Rack::Response.new( 'Foo was created.', 200 ) - end - -### To run locally: - rackup - -This will start the server on port 9292. - -### To run specs: - rspec - -or - - guard \ No newline at end of file diff --git a/ruby/rails/Dockerfile b/ruby/rails/Dockerfile deleted file mode 100644 index 7c7c95fc438..00000000000 --- a/ruby/rails/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile Rakefile config.ru ./ -COPY app app -COPY config config -COPY public public -COPY bin bin - -RUN bundle install - -EXPOSE 3000 - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/roda/Dockerfile b/ruby/roda/Dockerfile deleted file mode 100644 index e5f392ebf25..00000000000 --- a/ruby/roda/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb config.ru ./ - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/sinatra/Dockerfile b/ruby/sinatra/Dockerfile deleted file mode 100644 index e5f392ebf25..00000000000 --- a/ruby/sinatra/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb config.ru ./ - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/ruby/syro/Dockerfile b/ruby/syro/Dockerfile deleted file mode 100644 index e5f392ebf25..00000000000 --- a/ruby/syro/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.6 - -WORKDIR /usr/src/app - -COPY Gemfile app.rb config.ru ./ - -RUN bundle install - -CMD bundle exec puma -p 3000 -e production -w $(nproc) diff --git a/rust/Dockerfile b/rust/Dockerfile new file mode 100644 index 00000000000..f81f881955c --- /dev/null +++ b/rust/Dockerfile @@ -0,0 +1,20 @@ +FROM rust:1.37 + +WORKDIR /usr/src/app + +RUN apt -y update && \ + apt -y install musl-tools + +RUN rustup target add x86_64-unknown-linux-musl + + +COPY Cargo.toml ./ +COPY src src + +RUN cargo install +ENV RUSTFLAGS "-C target-cpu=native" +RUN cargo build --target x86_64-unknown-linux-musl --release + +FROM alpine +COPY --from=0 /usr/src/app/target/x86_64-unknown-linux-musl/release/server /usr/src/app/target/x86_64-unknown-linux-musl/release/server +CMD /usr/src/app/target/x86_64-unknown-linux-musl/release/server diff --git a/rust/actix-web/Dockerfile b/rust/actix-web/Dockerfile deleted file mode 100644 index 1e2635eefc2..00000000000 --- a/rust/actix-web/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM rust:1.38 - -WORKDIR /usr/src/app - -COPY Cargo.toml ./ -COPY src src - -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release - -EXPOSE 3000 - -CMD target/release/server diff --git a/rust/gotham/Dockerfile b/rust/gotham/Dockerfile deleted file mode 100644 index 1e2635eefc2..00000000000 --- a/rust/gotham/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM rust:1.38 - -WORKDIR /usr/src/app - -COPY Cargo.toml ./ -COPY src src - -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release - -EXPOSE 3000 - -CMD target/release/server diff --git a/rust/iron/Dockerfile b/rust/iron/Dockerfile deleted file mode 100644 index 1e2635eefc2..00000000000 --- a/rust/iron/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM rust:1.38 - -WORKDIR /usr/src/app - -COPY Cargo.toml ./ -COPY src src - -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release - -EXPOSE 3000 - -CMD target/release/server diff --git a/rust/nickel/Dockerfile b/rust/nickel/Dockerfile deleted file mode 100644 index 1e2635eefc2..00000000000 --- a/rust/nickel/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM rust:1.38 - -WORKDIR /usr/src/app - -COPY Cargo.toml ./ -COPY src src - -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release - -EXPOSE 3000 - -CMD target/release/server diff --git a/scala/http4s/Dockerfile b/scala/Dockerfile similarity index 68% rename from scala/http4s/Dockerfile rename to scala/Dockerfile index 644a89b3506..b768f8b2bf5 100644 --- a/scala/http4s/Dockerfile +++ b/scala/Dockerfile @@ -8,6 +8,4 @@ COPY project project RUN sbt assembly -EXPOSE 3000 - -CMD java -jar target/scala-2.12/*assembly*.jar +CMD {{command}} diff --git a/scala/akkahttp/Dockerfile b/scala/akkahttp/Dockerfile deleted file mode 100644 index ac3b9cb1349..00000000000 --- a/scala/akkahttp/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM bigtruedata/sbt:0.13.15-2.12.3 - -WORKDIR /usr/src/app - -COPY build.sbt ./ -COPY src src -COPY project project - -RUN sbt assembly - -EXPOSE 3000 - -CMD java -jar target/scala-2.12/server_scala_akkahttp diff --git a/scala/akkahttp/config.yaml b/scala/akkahttp/config.yaml index 85e74b90710..996558196a1 100644 --- a/scala/akkahttp/config.yaml +++ b/scala/akkahttp/config.yaml @@ -1,4 +1,6 @@ framework: website: akka.io version: 10.1 + +command: java -jar /usr/src/app/target/scala-2.12/server_scala_akkahttp diff --git a/scala/http4s/config.yaml b/scala/http4s/config.yaml index 5d2c3207b58..25196ed2cb7 100644 --- a/scala/http4s/config.yaml +++ b/scala/http4s/config.yaml @@ -1,4 +1,5 @@ framework: website: http4s.org version: 0.18 - + +command: java -jar /usr/src/app/target/scala-2.12/http4s-assembly-0.0.1-SNAPSHOT.jar \ No newline at end of file diff --git a/shard.yml b/shard.yml index 33687ff7e84..961bf948a29 100644 --- a/shard.yml +++ b/shard.yml @@ -10,21 +10,21 @@ dependencies: neph: github: tbrand/neph version: ~> 0.2.11 - kiwi: - github: crystal-community/kiwi - version: ~> 0.1.0 crustache: github: MakeNowJust/crustache version: ~> 2.4.0 admiral: github: jwaldrip/admiral.cr version: ~> 1.8.0 + sqlite3: + github: crystal-lang/crystal-sqlite3 + version: ~> 0.14.0 targets: + db: + main: tools/src/db.cr neph: main: lib/neph/src/bin/neph_bin.cr - benchmarker: - main: tools/src/benchmarker.cr client: main: tools/src/client.cr make: diff --git a/swift/Dockerfile b/swift/Dockerfile new file mode 100644 index 00000000000..942369174ab --- /dev/null +++ b/swift/Dockerfile @@ -0,0 +1,14 @@ +FROM swift:5.1 + +RUN apt -y update +RUN apt -y install libssl-dev zlib1g-dev libcurl4-openssl-dev uuid-dev + +WORKDIR /usr/src/app + +COPY Package.swift main.swift ./ + +RUN swift build -c release + +FROM swift:5.1-slim +COPY --from=0 /usr/src/app/.build/release/server /usr/src/app/.build/release/server +CMD /usr/src/app/.build/release/server {{options}} diff --git a/swift/kitura-nio/Dockerfile b/swift/kitura-nio/Dockerfile deleted file mode 100644 index 670de960a74..00000000000 --- a/swift/kitura-nio/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM swift:5.1 - -WORKDIR /usr/src/app - -COPY Package.swift main.swift ./ - -RUN apt-get update && apt-get install -y libssl-dev libcurl4-openssl-dev - -RUN export KITURA_NIO=1 && swift build -c release - -CMD .build/release/server diff --git a/swift/kitura/Dockerfile b/swift/kitura/Dockerfile deleted file mode 100644 index 1bb6b65c02b..00000000000 --- a/swift/kitura/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM swift:5.1 - -WORKDIR /usr/src/app - -COPY Package.swift main.swift ./ - -RUN apt-get update && apt-get install -y libssl-dev libcurl4-openssl-dev - -RUN swift build -c release - -CMD .build/release/server diff --git a/swift/perfect/Dockerfile b/swift/perfect/Dockerfile deleted file mode 100644 index e8c4fc716d8..00000000000 --- a/swift/perfect/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM swift:5.1 - -# install perfect deps -# @see https://www.perfect.org/docs/gettingStarted.html -RUN apt-get -qq update -RUN apt-get -qy install openssl libssl-dev uuid-dev - -WORKDIR /usr/src/app - -COPY Package.swift main.swift ./ - -RUN swift build -c release - -CMD .build/release/server diff --git a/swift/swifter/Dockerfile b/swift/swifter/Dockerfile deleted file mode 100644 index d7a119923af..00000000000 --- a/swift/swifter/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM swift:5.1 - -RUN apt-get -qq update -RUN apt-get -qy install libssl-dev zlib1g-dev -WORKDIR /usr/src/app - -COPY Package.swift main.swift ./ - -RUN swift build -c release - -CMD .build/release/server diff --git a/swift/vapor/Dockerfile b/swift/vapor/Dockerfile deleted file mode 100644 index a84ff8af47e..00000000000 --- a/swift/vapor/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM swift:5.1 - -RUN apt-get -qq update -RUN apt-get -qy install libssl-dev zlib1g-dev -WORKDIR /usr/src/app - -COPY Package.swift main.swift ./ - -RUN swift build -c release - -CMD .build/release/server serve --hostname 0.0.0.0 --port 3000 --env prod diff --git a/swift/vapor/config.yaml b/swift/vapor/config.yaml index 3c5d073b961..773061ecf82 100644 --- a/swift/vapor/config.yaml +++ b/swift/vapor/config.yaml @@ -1,4 +1,6 @@ framework: website: vapor.codes version: 3.3 + +options: serve --hostname 0.0.0.0 --port 3000 --env prod diff --git a/tools/pipeline.lua b/tools/pipeline.lua index f2e65c641c3..44a9c90028f 100644 --- a/tools/pipeline.lua +++ b/tools/pipeline.lua @@ -12,6 +12,7 @@ -- average latency -- standard deviation -- percentile : 50 +-- percentile : 75 -- percentile : 90 -- percentile : 99 -- percentile : 99.999 @@ -33,6 +34,7 @@ done = function(summary, latency, requests) latency.mean, latency.stdev, latency:percentile(50), + latency:percentile(75), latency:percentile(90), latency:percentile(99), latency:percentile(99.999) diff --git a/tools/pipeline_post.lua b/tools/pipeline_post.lua index 05fa6b75191..6ed107b38a6 100644 --- a/tools/pipeline_post.lua +++ b/tools/pipeline_post.lua @@ -16,6 +16,7 @@ wrk.headers["Content-Type"] = "application/x-www-form-urlencoded" -- average latency -- standard deviation -- percentile : 50 +-- percentile : 75 -- percentile : 90 -- percentile : 99 -- percentile : 99.999 @@ -37,6 +38,7 @@ done = function(summary, latency, requests) latency.mean, latency.stdev, latency:percentile(50), + latency:percentile(75), latency:percentile(90), latency:percentile(99), latency:percentile(99.999) diff --git a/tools/src/benchmarker.cr b/tools/src/benchmarker.cr deleted file mode 100644 index 8b323b13efd..00000000000 --- a/tools/src/benchmarker.cr +++ /dev/null @@ -1,300 +0,0 @@ -require "http/client" -require "benchmark" -require "option_parser" -require "json" -require "kiwi/memory_store" -require "yaml" - -#################### -# # DEFAULT VALUES ## -#################### - -threads = (System.cpu_count + 1).to_i -connections = 1000 -record = false - -check = false -store = Kiwi::MemoryStore.new -duration = 15 - -class Options - class_property with_experimental : Bool = false -end - -################# -# ### OPTIONS ### -################# - -OptionParser.parse! do |parser| - parser.banner = "Usage: time ./bin/benchmark [options]" - parser.on("-t THREADS", "--threads THREADS", "# of threads") do |x| - threads = x - end - parser.on("-c CONNECTIONS", "--connections CONNECTIONS", "# of iterations of requests") do |x| - connections = x - end - parser.on("-d DURATION", "--duration DURATION", "Time to test, in seconds") do |x| - duration = x - end - parser.on("--record", "Record results in README.md") do - record = true - end - parser.on("--experimental", "Display experimental stuff (non-native, not versioned)") do - Options.with_experimental = true - end -end - -################## -# ## FRAMEWORKS ## -################## - -# Prefix of pathes for each executable -PATH_PREFIX = "../../../bin/" - -# Path for client binary -CLIENT = File.expand_path(PATH_PREFIX + "client", __FILE__) - -# Each framework -record Target, lang : String, name : String, link : String, version : String, langver : String -record Filter, req : Float64, lat : Float64 -record Ranked, res : Filter, target : Target - -def frameworks : Array(Target) - targets = [] of Target - - YAML.parse(File.read("FRAMEWORKS.yaml")).as_h.each do |lang, data| - data.as_h.each do |framework, line| - row = line.as_h - next if row.has_key?("type") && row["type"].to_s == "experimental" && !Options.with_experimental - if row.has_key?("github") - link = "github.com/#{row["github"]}" - elsif row.has_key?("website") - link = row["website"] - end - target = Target.new(lang.as_s, framework.as_s, link.to_s, row["version"].to_s.strip, row["language"].to_s.strip) - targets.push(target) - end - end - - targets -end - -class Result - JSON.mapping( - request: {type: Request, nilable: false}, - error: {type: Error, nilable: false}, - latency: {type: Latency, nilable: false}, - percentile: {type: Percentile, nilable: false}, - ) -end - -class Request - JSON.mapping( - duration: Float64, - total: Float64, - bytes: Float64, - per_second: Float64 - ) -end - -class Error - JSON.mapping( - socket: Float64, - read: Float64, - write: Float64, - http: Float64, - timeout: Float64 - ) -end - -class Latency - JSON.mapping( - maximum: Float64, - minimum: Float64, - average: Float64, - deviation: Float64 - ) -end - -class Percentile - JSON.mapping( - fifty: Float64, - ninety: Float64, - ninety_nine: Float64, - ninety_nine_ninety: Float64 - ) -end - -# Benchmark -# server : server context -# threads : number of thread to launch simultaneously -# connections : number of opened connections per thread -# target : target -# store : in-memory storage used for results -def benchmark(host, threads, connections, duration, target, store) : Filter - latency = 0.0 - requests = 0.0 - raw = `#{CLIENT} --url http://#{host}:3000 --init` - result = Result.from_json(raw) - parser = JSON::PullParser.new(raw) - results = Hash(String, Hash(String, Float64)).new(parser) - - ["/", "/user/0"].each do |route| - raw = `#{CLIENT} --duration #{duration} --connections #{connections.to_i.to_s} --threads #{threads} --url http://#{host}:3000#{route}` - result = Result.from_json(raw) - parser = JSON::PullParser.new(raw) - data = Hash(String, Hash(String, Float64)).new(parser) - data.each do |key, metrics| - results[key].merge!(metrics) { |_, v1, v2| v1 + (v2/3) } - end - requests = requests + result.request.per_second - latency = latency + result.latency.average - end - - ["/user"].each do |route| - raw = `#{CLIENT} --method POST --duration #{duration} --connections #{connections.to_i.to_s} --threads #{threads} --url http://#{host}:3000#{route}` - result = Result.from_json(raw) - parser = JSON::PullParser.new(raw) - data = Hash(String, Hash(String, Float64)).new(parser) - data.each do |key, metrics| - results[key].merge!(metrics) { |_, v1, v2| v1 + (v2/3) } - end - requests = requests + result.request.per_second - latency = latency + result.latency.average - end - - store.set("#{target.lang}:#{target.name}", results.to_json) - - Filter.new((requests/3), (latency/3)) -end - -m_lines = [] of String - -def puts_markdown(line, m_lines = nil, m = false) - puts line - m_lines.push(line) if m && m_lines -end - -targets = [] of Target -frameworks.each do |target| - if ARGV.includes?(target.lang) || ARGV.includes?(target.name) - targets << target - end -end - -if targets.size == 0 - targets = frameworks -end - -puts_markdown "Last update: #{Time.now.to_s("%Y-%m-%d")}", m_lines, true -puts_markdown "```", m_lines, true -puts_markdown "OS: #{`uname -s`.rstrip} (version: #{`uname -r`.rstrip}, arch: #{`uname -m`.rstrip})", m_lines, true -puts_markdown "CPU Cores: #{System.cpu_count}", m_lines, true -puts_markdown "threads: #{threads}, connections: #{connections}" -puts_markdown "```", m_lines, true -puts_markdown "Benchmark running ..." - -all = [] of Ranked -ranks = [] of Ranked -emojis = [] of String -emojis << "one" -emojis << "two" -emojis << "three" -emojis << "four" -emojis << "five" - -targets.each do |target| - cid = `docker run -td #{target.name}`.strip - - sleep 20 # due to external program usage - - remote_ip = `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' #{cid}`.strip - - result = benchmark(remote_ip, threads, connections, duration, target, store) - - all.push(Ranked.new(result, target)) - - puts_markdown "Done. <- #{target.name}" - - `docker stop #{cid}` -end - -ranks_by_requests = all.sort do |rank0, rank1| - rank1.res.req <=> rank0.res.req -end - -ranks_by_latency = all.sort do |rank0, rank1| - rank0.res.lat <=> rank1.res.lat -end - -# --- Ranking of frameworks - -puts_markdown "", m_lines, true -puts_markdown "### Latency", m_lines, true -puts_markdown "", m_lines, true - -puts_markdown "", m_lines, true -puts_markdown "#### Ranking (top 5)", m_lines, true -puts_markdown "", m_lines, true - -ranks = ranks_by_latency[0...5] -ranks.each_with_index do |framework, i| - puts_markdown "", m_lines, true - puts_markdown ":%s: %s (%s)" % [emojis[i], framework.target.name, framework.target.lang], m_lines, true - puts_markdown "", m_lines, true -end - -puts_markdown "", m_lines, true -puts_markdown "#### Full table", m_lines, true -puts_markdown "", m_lines, true - -puts_markdown "| %s | %s | %s | %s | %s | %s | %s | %s |" % ["Language (Runtime)", "Framework (Middleware)", "Average", "50th percentile", "90th percentile", "99th percentile", "99.9th percentile", "Standard deviation"], m_lines, true -puts_markdown "|---------------------------|---------------------------|----------------:|----------------:|----------------:|----------------:|----------------:|----------------:|", m_lines, true - -ranks_by_latency.each do |framework| - raw = store.get("#{framework.target.lang}:#{framework.target.name}").as(String) - result = Result.from_json(raw) - puts_markdown "| `%s` (`%s`) | [%s](%s) (**%s**) | **%.2f** ms | %.2f ms | %.2f ms | %.2f ms | %.2f ms | **%.2f** | " % [framework.target.lang, framework.target.langver, framework.target.name, framework.target.link, framework.target.version, (result.latency.average/1000), (result.percentile.fifty/1000), (result.percentile.ninety/1000), (result.percentile.ninety_nine/1000), (result.percentile.ninety_nine_ninety/1000), (result.latency.deviation)], m_lines, true -end - -puts_markdown "", m_lines, true -puts_markdown "### Requests per seconds", m_lines, true -puts_markdown "", m_lines, true - -puts_markdown "", m_lines, true -puts_markdown "#### Ranking (top 5)", m_lines, true -puts_markdown "", m_lines, true - -ranks = ranks_by_requests[0...5] -ranks.each_with_index do |framework, i| - puts_markdown "", m_lines, true - puts_markdown ":%s: (%s) (%s)" % [emojis[i], framework.target.name, framework.target.lang], m_lines, true - puts_markdown "", m_lines, true -end - -puts_markdown "", m_lines, true -puts_markdown "#### Full table", m_lines, true -puts_markdown "", m_lines, true - -puts_markdown "| %s | %s | %s | %s |" % ["Language (Runtime)", "Framework (Middleware)", "Requests / s", "Throughput"], m_lines, true -puts_markdown "|---------------------------|---------------------------|----------------:|---------:|", m_lines, true - -ranks_by_requests.each do |framework| - raw = store.get("#{framework.target.lang}:#{framework.target.name}").as(String) - result = Result.from_json(raw) - puts_markdown "| `%s` (`%s`) | [%s](%s) (**%s**) | %.2f | **%.2f** MB |" % [framework.target.lang, framework.target.langver, framework.target.name, framework.target.link, framework.target.version, result.request.per_second, (result.request.bytes/1000000)], m_lines, true -end - -if record - path = File.expand_path("../../../README.md", __FILE__) - tag_from = "" - tag_till = "" - m_lines.insert(0, tag_from) - m_lines.push(tag_till) - prev_readme = File.read(path) - next_readme = prev_readme.gsub( - /\[\s\S]*?/, - m_lines.join('\n')) - - File.write(path, next_readme) -end diff --git a/tools/src/client.cr b/tools/src/client.cr index 4d9709c7ec1..7f58cfc5744 100644 --- a/tools/src/client.cr +++ b/tools/src/client.cr @@ -1,97 +1,84 @@ -require "json" -require "http/client" -require "option_parser" - -PIPELINE_GET = File.expand_path("../../" + "pipeline.lua", __FILE__) -PIPELINE_POST = File.expand_path("../../" + "pipeline_post.lua", __FILE__) - -class Client - def initialize - @threads = 16 - @duration = 15 - @url = "" - @method = "GET" - @connections = 1000.0 - @init = false - - OptionParser.parse! do |parser| - parser.banner = "Usage: time ./bin/benchmark [options]" - parser.on("-t THREADS", "--threads THREADS", "# of threads") do |threads| - @threads = threads.to_i - end - parser.on("-c CONNECTIONS", "--connections CONNECTIONS", "# of opened connections") do |connections| - @connections = connections.to_f - end - parser.on("-d DURATION", "--duration DURATION", "Time to test, in seconds") do |duration| - @duration = duration.to_i - end - parser.on("-u URL", "--url URL", "URL to call") do |url| - @url = url - end - parser.on("-m METHOD", "--method METHOD", "HTTP method to use") do |method| - @method = method - end - parser.on("-i", "--init", "Initialize (create json with 0 values)") do |x| - @init = true - end - end +require "admiral" +require "sqlite3" + +PIPELINES = { + "GET": File.expand_path("../../" + "pipeline.lua", __FILE__), + "POST": File.expand_path("../../" + "pipeline_post.lua", __FILE__), +} + +def insert(db, framework_id, metric, value) + row = db.exec "insert or ignore into metric_keys values (null, ?, ?)", metric, framework_id + metric_id = row.last_insert_id + if metric_id == 0 + metric_id = db.scalar "select id from metric_keys where label = ? and framework_id = ?", metric, framework_id end + db.exec "insert into metric_values values (null, ?, ?)", metric_id, value +end + +class Client < Admiral::Command + define_flag threads : Int32, description: "# of threads", default: 16, long: "threads", short: "t" + define_flag connections : Int32, description: "# of opened connections", default: 1000, long: "connections", short: "c" + define_flag duration : Int32, description: "Time to test, in seconds", default: 15, long: "duration", short: "d" + define_flag language : String, description: "Language used", required: true, long: "language", short: "l" + define_flag framework : String, description: "Framework used", required: true, long: "framework", short: "f" + define_flag routes : Array(String), long: "routes", short: "r", default: ["GET:/"] def run - if @method == "POST" - command = "wrk -H 'Connection: keep-alive' --latency -d #{@duration}s -s #{PIPELINE_POST} -c #{@connections.to_i} --timeout 8 -t #{@threads} #{@url}" - else - command = "wrk -H 'Connection: keep-alive' --latency -d #{@duration}s -s #{PIPELINE_GET} -c #{@connections.to_i} --timeout 8 -t #{@threads} #{@url}" + db = DB.open "sqlite3://../../data.db" + row = db.exec "insert or ignore into languages values (null, ?)", flags.language + language_id = row.last_insert_id + if language_id == 0 + language_id = db.scalar "select id from languages where label = ?", flags.language end - io = IO::Memory.new - Process.run(command, shell: true, error: io) - - result = io.to_s.split(",") - - data = JSON.build do |json| - json.object do - json.field "request" do - json.object do - json.field "duration", (@init ? 0 : result[0].to_f) - json.field "total", (@init ? 0 : result[1].to_f) - json.field "per_second", (@init ? 0 : result[2].to_f) - json.field "bytes", (@init ? 0 : result[3].to_f) - end - end - - json.field "error" do - json.object do - json.field "socket", (@init ? 0 : result[4].to_f) - json.field "read", (@init ? 0 : result[5].to_f) - json.field "write", (@init ? 0 : result[6].to_f) - json.field "http", (@init ? 0 : result[7].to_f) - json.field "timeout", (@init ? 0 : result[8].to_f) - end - end - - json.field "latency" do - json.object do - json.field "minimum", (@init ? 0 : result[9].to_f) - json.field "maximum", (@init ? 0 : result[10].to_f) - json.field "average", (@init ? 0 : result[11].to_f) - json.field "deviation", (@init ? 0 : result[12].to_f) - end - end - - json.field "percentile" do - json.object do - json.field "fifty", (@init ? 0 : result[13].to_f) - json.field "ninety", (@init ? 0 : result[14].to_f) - json.field "ninety_nine", (@init ? 0 : result[15].to_f) - json.field "ninety_nine_ninety", (@init ? 0 : result[16].to_f) - end - end - end + + row = db.exec "insert or ignore into frameworks values (null, ?, ?)", language_id, flags.framework + framework_id = row.last_insert_id + if language_id == 0 + framework_id = db.scalar "select id from languages where language_id = ? and label = ?", language_id, flags.framework end - STDOUT.puts data + sleep 20 # due to external program usage + + address = File.read("ip.txt").strip + + flags.routes.each do |route| + method, uri = route.split(":") + url = "http://#{address}:3000#{uri}" + + pipeline = PIPELINES[method] + + command = "wrk -H 'Connection: keep-alive' --latency -d #{flags.duration}s -s #{pipeline} -c #{flags.connections} --timeout 8 -t #{flags.threads} #{url}" + + io = IO::Memory.new + Process.run(command, shell: true, error: io) + + result = io.to_s.split(",") + + insert(db, framework_id, "request:duration", result[0]) + insert(db, framework_id, "request:total", result[1]) + insert(db, framework_id, "request:per_second", result[2]) + insert(db, framework_id, "request:bytes", result[3]) + + insert(db, framework_id, "error:socket", result[4]) + insert(db, framework_id, "error:read", result[5]) + insert(db, framework_id, "error:write", result[6]) + insert(db, framework_id, "error:http", result[7]) + insert(db, framework_id, "error:timeout", result[8]) + + insert(db, framework_id, "latency:minimum", result[9]) + insert(db, framework_id, "latency:maximum", result[10]) + insert(db, framework_id, "latency:average", result[11]) + insert(db, framework_id, "latency:deviation", result[12]) + + insert(db, framework_id, "percentile:fifty", result[13]) + insert(db, framework_id, "percentile:seventy_five", result[14]) + insert(db, framework_id, "percentile:ninety", result[15]) + insert(db, framework_id, "percentile:ninety_nine", result[16]) + insert(db, framework_id, "percentile:ninety_nine_ninety", result[17]) + + db.close + end end end -client = Client.new -client.run +Client.run diff --git a/tools/src/db.cr b/tools/src/db.cr new file mode 100644 index 00000000000..4da63ac7ad2 --- /dev/null +++ b/tools/src/db.cr @@ -0,0 +1,78 @@ +require "admiral" +require "sqlite3" +require "crustache" + +class App < Admiral::Command + class InitializeDatabase < Admiral::Command + def run + DB.open "sqlite3://./data.db" do |db| + db.exec "create table languages (id INTEGER PRIMARY KEY AUTOINCREMENT, label text UNIQUE)" + db.exec "create table frameworks (id INTEGER PRIMARY KEY AUTOINCREMENT, language_id INTEGER, label text, FOREIGN KEY(language_id) REFERENCES languages(id))" + db.exec "create table metric_keys (id INTEGER PRIMARY KEY AUTOINCREMENT, label text, framework_id INTEGER, FOREIGN KEY(framework_id) REFERENCES frameworks(id))" + db.exec "create table metric_values (id INTEGER PRIMARY KEY AUTOINCREMENT, metric_id INTEGER, value FLOAT, FOREIGN KEY(metric_id) REFERENCES metrics(id))" + end + end + end + + class ReadmeWriter < Admiral::Command + def run + results = {} of String => Hash(String, String | Float64) + order_by_latency = <<-EOS +SELECT f.id, l.label AS language, f.label AS framework, k.label AS key, sum(v.value/3) AS value, k.label='latency:average' AS filter + FROM frameworks AS f + JOIN languages AS l on l.id = f.language_id + JOIN metric_keys as k on k.framework_id = f.id + JOIN metric_values as v on v.metric_id = k.id + GROUP BY 1,2,3,4 + ORDER BY 6 desc, 5 +EOS + DB.open "sqlite3://data.db" do |db| + db.query order_by_latency do |row| + row.each do + key = row.read(Int).to_s + language = row.read(String) + framework = row.read(String) + metric = row.read(String) + value = row.read(Float) + unless results.has_key?(key) + results[key] = {} of String => String | Float64 + results[key]["language"] = language + results[key]["framework"] = framework + end + results[key][metric] = value + end + end + end + lines = [ + "| Language | Framework | Average | 50th percentile | 75th percentile | 90th percentile | Standard deviation | Requests / s | Throughput |", + "|----|----|---------|-------------|---------|----------|----------|--------|----|", + ] + results.each do |_, row| + lines << "| %s | %s | **%.2f** ms | %.2f ms | %.2f ms | %.2f ms | %.2f | %.2f | %.2f Mb |" % [ + row["language"], + row["framework"], + row["latency:average"].to_f/1000, + row["percentile:fifty"].to_f/1000, + row["percentile:seventy_five"].to_f/1000, + row["percentile:ninety"].to_f/1000, + row["latency:deviation"].to_f, + row["request:per_second"].to_f, + row["request:bytes"].to_f / row["request:duration"].to_f, + ] + end + + path = File.expand_path("../../../README.mustache.md", __FILE__) + template = Crustache.parse(File.read(path)) + puts Crustache.render template, {"results" => lines} + end + end + + register_sub_command init : InitializeDatabase, description "Create database" + register_sub_command to_readme : ReadmeWriter, description "Update readme with results" + + def run + puts "help" + end +end + +App.run diff --git a/tools/src/make.cr b/tools/src/make.cr index e602dfb5599..92077c8bc5a 100644 --- a/tools/src/make.cr +++ b/tools/src/make.cr @@ -1,11 +1,14 @@ require "admiral" require "yaml" +require "crustache" + +alias DockerVariable = String | Array(String) struct FrameworkConfig property name : String property website : String - property version : String - property langver : String + property version : Float32 + property langver : Float32 | String def initialize(@name, @website, @version, @langver) end @@ -13,114 +16,10 @@ end class App < Admiral::Command class Config < Admiral::Command - def run - frameworks = {} of String => Array(FrameworkConfig) - Dir.glob("*/*/config.yaml").each do |file| - directory = File.dirname(file) - infos = directory.split("/") - framework = infos.pop - language = infos.pop - fwk_config = YAML.parse(File.read(file)) - lng_config = YAML.parse(File.read(File.join(language, "config.yaml"))) - config = lng_config.as_h.merge(fwk_config.as_h) - - # Discover documentation URL for this framework - - website = config["framework"]["website"]? - if website.nil? - website = "github.com/#{config["framework"]["github"]}" - end - version = config["framework"]["version"] - langver = config["provider"]["default"]["language"] - - unless frameworks.has_key?(language) - frameworks[language] = [] of FrameworkConfig - end - - if m = version.to_s.match /^(\d+)\.(\d+)$/ - version = "#{m[1]}.#{m[2]}" - end - if m = langver.to_s.match /^(\d+)\.(\d+)$/ - langver = "#{m[1]}.#{m[2]}" - end + define_flag without_sieger : Bool, description: "run sieger", default: false, long: "without-sieger" + define_flag sieger_options : String, description: "sieger options", default: "", long: "sieger-options" + define_flag docker_options : String, description: "extra argument to docker cli", default: "", long: "docker-options" - frameworks[language] << FrameworkConfig.new(framework, website.to_s, version.to_s, langver.to_s) - end - - selection = YAML.build do |yaml| - yaml.mapping do - frameworks.each do |language, configs| - yaml.scalar language - yaml.mapping do - configs.each do |config| - yaml.scalar config.name - yaml.mapping do - yaml.scalar "website" - yaml.scalar "https://#{config.website}" - yaml.scalar "version" - yaml.scalar " #{config.version}" - yaml.scalar "language" - yaml.scalar " #{config.langver.to_s}" - end - end - end - end - end - end - File.write("FRAMEWORKS.yaml", selection) - end - end - - class TravisConfig < Admiral::Command - def run - frameworks = [] of String - languages = [] of String - mapping = YAML.parse(File.read(".ci/mapping.yml")) - Dir.glob("*/*/config.yaml").each do |file| - frameworks << file.split("/")[-2] - languages << file.split("/")[-3] - end - selection = YAML.build do |yaml| - yaml.mapping do - yaml.scalar "jobs" - yaml.mapping do - yaml.scalar "include" - yaml.sequence do - frameworks.sort.each do |framework| - begin - yaml.mapping do - yaml.scalar "stage" - yaml.scalar "test" - yaml.scalar "script" - yaml.scalar "bash .ci/test.sh" - yaml.scalar "language" - yaml.scalar "crystal" - yaml.scalar "env" - yaml.scalar "FRAMEWORK=#{framework}" - yaml.scalar "services" - yaml.scalar "docker" - end - end - end - end - end - yaml.scalar "notifications" - yaml.mapping do - yaml.scalar "email" - yaml.scalar false - end - yaml.scalar "before_install" - yaml.scalar "bash .ci/has_to_run.sh || travis_terminate 0" - yaml.scalar "dist" - yaml.scalar "bionic" - end - end - - File.write(".travis.yml", selection) - end - end - - class NephConfig < Admiral::Command def run frameworks = {} of String => Array(String) Dir.glob("*/*/config.yaml").each do |file| @@ -159,12 +58,93 @@ class App < Admiral::Command end end frameworks.each do |language, tools| + lang_config = YAML.parse(File.read("#{language}/config.yaml")) + dockerfile = Crustache.parse(File.read("#{language}/Dockerfile")) + params = {} of String => DockerVariable tools.each do |tool| + params = {} of String => DockerVariable + framework_config = YAML.parse(File.read("#{language}/#{tool}/config.yaml")) + + if framework_config.as_h.has_key?("environment") + environment = [] of String + framework_config["environment"].as_h.each do |k, v| + environment << "#{k} #{v}" + end + params["environment"] = environment + end + if framework_config.as_h.has_key?("deps") + deps = [] of String + framework_config["deps"].as_a.each do |dep| + deps << dep.to_s + end + params["deps"] = deps + end + if framework_config.as_h.has_key?("bin_deps") + deps = [] of String + framework_config["bin_deps"].as_a.each do |dep| + deps << dep.to_s + end + params["bin_deps"] = deps + end + if framework_config.as_h.has_key?("php_ext") + deps = [] of String + framework_config["php_ext"].as_a.each do |ext| + deps << ext.to_s + end + params["php_ext"] = deps + end + if framework_config.as_h.has_key?("arguments") + params["arguments"] = framework_config["arguments"].to_s + end + if framework_config.as_h.has_key?("options") + params["options"] = framework_config["options"].to_s + end + if framework_config.as_h.has_key?("command") + params["command"] = framework_config["command"].to_s + end + if framework_config.as_h.has_key?("before_command") + before_command = [] of String + framework_config["before_command"].as_a.each do |cmd| + before_command << cmd.to_s + end + params["before_command"] = before_command + end + if framework_config.as_h.has_key?("standalone") + params["standalone"] = framework_config["standalone"].to_s + end + if framework_config.as_h.has_key?("build") + build = [] of String + framework_config["build"].as_a.each do |cmd| + build << cmd.to_s + end + params["build"] = build + end + if framework_config.as_h.has_key?("clone") + clone = [] of String + framework_config["clone"].as_a.each do |cmd| + clone << cmd.to_s + end + params["clone"] = clone + end + if framework_config.as_h.has_key?("files") + files = [] of String + framework_config.as_h["files"].as_a.each do |file| + files << file.to_s + end + params["files"] = files + end + File.write("#{language}/#{tool}/Dockerfile", Crustache.render(dockerfile, params)) yaml.scalar tool yaml.mapping do yaml.scalar "commands" yaml.sequence do - yaml.scalar "docker build -t #{tool} ." + yaml.scalar "docker build -t #{tool} . #{flags.docker_options}" + yaml.scalar "docker run -td #{tool} | xargs -i docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' {} > ip.txt" + + unless flags.without_sieger + yaml.scalar "../../bin/client -l #{language} -f #{tool} -r GET:/ -r GET:/user/0 -r POST:/user #{flags.sieger_options}" + yaml.scalar "docker ps -a -q --filter ancestor=#{tool} | xargs -i docker container rm -f {}" + end end yaml.scalar "dir" yaml.scalar "#{language}/#{tool}" @@ -177,6 +157,18 @@ class App < Admiral::Command end end + class TravisConfig < Admiral::Command + def run + frameworks = [] of String + Dir.glob("*/*/config.yaml").each do |file| + info = file.split("/") + frameworks << info[info.size - 2] + end + config = Crustache.parse(File.read(".ci/template.mustache")) + File.write(".travis.yml", Crustache.render(config, {"frameworks" => frameworks})) + end + end + class DependabotConfig < Admiral::Command def run mapping = YAML.parse(File.read(".dependabot/mapping.yaml")) @@ -251,7 +243,6 @@ class App < Admiral::Command end register_sub_command config : Config, description "Create framework list" - register_sub_command neph_config : NephConfig, description "Create neph build tool configuration file" register_sub_command ci_config : TravisConfig, description "Create configuration file for CI" register_sub_command deps_config : DependabotConfig, description "Create configuration file for deps update bot"