From 7360d2d6e1dc4b5be35f8ca5301e5bcb1c05e846 Mon Sep 17 00:00:00 2001 From: rolljee Date: Tue, 19 Sep 2023 15:35:13 +0200 Subject: [PATCH 1/2] Update doco, scripts, dockerfile to nodejs 18 --- .ci/scripts/run-monkey-tests.sh | 4 ++-- .ci/scripts/run-test-arm.sh | 4 ++-- .ci/scripts/run-test-cluster.sh | 4 ++-- .ci/scripts/run-test.sh | 4 ++-- .../controllers/server/health-check/index.md | 2 +- docker-compose.yml | 8 +++---- docker/docker-compose-swarm.yml | 4 ++-- docker/images/kuzzle/Dockerfile | 4 ++-- docker/images/kuzzle/README.md | 2 +- docker/images/plugin-dev/Dockerfile | 2 +- docker/images/plugin-dev/README.md | 22 +++++++++++++++++++ docker/scripts/docker-compose.test.yml | 11 +++++----- docker/scripts/run-dev.sh | 4 ++-- docker/scripts/run-test.sh | 4 ++-- lib/api/httpRoutes.js | 2 +- 15 files changed, 51 insertions(+), 30 deletions(-) diff --git a/.ci/scripts/run-monkey-tests.sh b/.ci/scripts/run-monkey-tests.sh index d2b278bd40..0c77e522f4 100755 --- a/.ci/scripts/run-monkey-tests.sh +++ b/.ci/scripts/run-monkey-tests.sh @@ -4,8 +4,8 @@ set -ex if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default NODE_16_VERSION" - export NODE_VERSION=$NODE_16_VERSION + echo "Missing NODE_VERSION, use default NODE_18_VERSION" + export NODE_VERSION=$NODE_18_VERSION fi echo "Testing Kuzzle against node v$NODE_VERSION" diff --git a/.ci/scripts/run-test-arm.sh b/.ci/scripts/run-test-arm.sh index 7d97c93195..4b3968024a 100755 --- a/.ci/scripts/run-test-arm.sh +++ b/.ci/scripts/run-test-arm.sh @@ -4,8 +4,8 @@ set -ex if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default NODE_16_VERSION" - NODE_VERSION=$NODE_16_VERSION + echo "Missing NODE_VERSION, use default NODE_18_VERSION" + NODE_VERSION=$NODE_18_VERSION fi echo "Testing Kuzzle against node v$NODE_VERSION" diff --git a/.ci/scripts/run-test-cluster.sh b/.ci/scripts/run-test-cluster.sh index 6cc29ce3a4..50836b7808 100755 --- a/.ci/scripts/run-test-cluster.sh +++ b/.ci/scripts/run-test-cluster.sh @@ -5,8 +5,8 @@ set -ex if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default NODE_16_VERSION" - export NODE_VERSION=$NODE_16_VERSION + echo "Missing NODE_VERSION, use default NODE_18_VERSION" + export NODE_VERSION=$NODE_18_VERSION fi echo "Testing Kuzzle against node v$NODE_VERSION" diff --git a/.ci/scripts/run-test.sh b/.ci/scripts/run-test.sh index c91500c742..0a6f29f7d5 100755 --- a/.ci/scripts/run-test.sh +++ b/.ci/scripts/run-test.sh @@ -4,8 +4,8 @@ set -ex if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default NODE_16_VERSION" - NODE_VERSION=$NODE_16_VERSION + echo "Missing NODE_VERSION, use default NODE_18_VERSION" + NODE_VERSION=$NODE_18_VERSION fi echo "Testing Kuzzle against node v$NODE_VERSION" diff --git a/doc/2/api/controllers/server/health-check/index.md b/doc/2/api/controllers/server/health-check/index.md index 67b4369d6f..effca05bfc 100644 --- a/doc/2/api/controllers/server/health-check/index.md +++ b/doc/2/api/controllers/server/health-check/index.md @@ -17,7 +17,7 @@ Returns the status of Kuzzle and it's internal services. ### HTTP ```http -URL: http://kuzzle:7512/_healthCheck[?services] +URL: http://kuzzle:7512/_healthcheck[?services] Method: GET ``` diff --git a/docker-compose.yml b/docker-compose.yml index 40c96d3a5e..cc728bf312 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,8 +36,6 @@ x-kuzzle-config: &kuzzle-config - KUZZLE_VAULT_KEY=${KUZZLE_VAULT_KEY:-secret-password} - KUZZLE_SECRETS_FILE=${KUZZLE_SECRETS_FILE:-/var/app/features/fixtures/secrets.enc.json} # Variables used by the development scripts - - NODE_12_VERSION=12.20.0 - - NODE_14_VERSION=14.17.0 - NODE_16_VERSION=16.19.1 - NODE_18_VERSION=18.17.0 - NODE_20_VERSION=20.0.0 @@ -65,7 +63,7 @@ services: - '1883:1883' # Kuzzle MQTT port - '9229:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 @@ -78,7 +76,7 @@ services: - '11883:1883' # Kuzzle MQTT port - '9230:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 @@ -91,7 +89,7 @@ services: - '11884:1883' # Kuzzle MQTT port - '9231:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 diff --git a/docker/docker-compose-swarm.yml b/docker/docker-compose-swarm.yml index 1073fa89be..353c20cae9 100644 --- a/docker/docker-compose-swarm.yml +++ b/docker/docker-compose-swarm.yml @@ -34,7 +34,7 @@ services: sysctls: - net.core.somaxconn=8192 healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:7512/_healthCheck"] + test: ["CMD", "curl", "-f", "http://localhost:7512/_healthcheck"] timeout: 1s interval: 2s retries: 30 @@ -47,7 +47,7 @@ services: - "traefik.enable=true" # Kuzzle HTTP/WS - "traefik.http.services.kuzzle_http.loadbalancer.server.port=7512" - - "traefik.http.services.kuzzle_http.loadbalancer.healthCheck.path=/_healthCheck" + - "traefik.http.services.kuzzle_http.loadbalancer.healthCheck.path=/_healthcheck" - "traefik.http.services.kuzzle_http.loadbalancer.healthCheck.interval=5s" - "traefik.http.routers.kuzzle.entrypoints=kuzzle_http" - "traefik.http.routers.kuzzle.rule=Host(`localhost`)" diff --git a/docker/images/kuzzle/Dockerfile b/docker/images/kuzzle/Dockerfile index 6bdcd49dee..6a6280d03d 100644 --- a/docker/images/kuzzle/Dockerfile +++ b/docker/images/kuzzle/Dockerfile @@ -1,7 +1,7 @@ ################################################################################ # Production build image ################################################################################ -FROM node:16-bullseye-slim as builder +FROM node:18-bullseye-slim as builder RUN set -x \ && apt-get update \ @@ -45,7 +45,7 @@ RUN set -x \ ################################################################################ # Production build 2 image ################################################################################ -FROM node:16-bullseye-slim as minifier +FROM node:18-bullseye-slim as minifier ENV NODE_ENV=production diff --git a/docker/images/kuzzle/README.md b/docker/images/kuzzle/README.md index a252aeb080..a84eca7004 100644 --- a/docker/images/kuzzle/README.md +++ b/docker/images/kuzzle/README.md @@ -10,7 +10,7 @@ You should use this image as a base build your own application: ```dockerfile # Build image -FROM node:12.18.1-alpine3.11 as builder +FROM node:18-bullseye-slim as builder ADD . /your-plugin-name diff --git a/docker/images/plugin-dev/Dockerfile b/docker/images/plugin-dev/Dockerfile index 61dff0ab07..1d3227047b 100644 --- a/docker/images/plugin-dev/Dockerfile +++ b/docker/images/plugin-dev/Dockerfile @@ -1,7 +1,7 @@ ################################################################################ # Plugin development build image ################################################################################ -FROM node:16-bullseye-slim as builder +FROM node:18-bullseye-slim as builder RUN set -x \ && apt-get update && apt-get install -y \ diff --git a/docker/images/plugin-dev/README.md b/docker/images/plugin-dev/README.md index f014090baa..3c03681147 100644 --- a/docker/images/plugin-dev/README.md +++ b/docker/images/plugin-dev/README.md @@ -18,6 +18,7 @@ version: '3' services: kuzzle: image: kuzzleio/plugin-dev:2 + container_name: kuzzle_node volumes: - ".:/var/app/plugins/enabled/your-plugin-name" cap_add: @@ -40,12 +41,33 @@ services: - DEBUG=kuzzle:plugins # Customize here - KUZZLE_PLUGIN_NAME=your-plugin-name + healthcheck: + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] + timeout: 1s + interval: 2s + retries: 10 redis: image: redis:6 + container_name: kuzzle_redis + ports: + - '6379:6379' + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + interval: 1s + timeout: 3s + retries: 30 elasticsearch: image: kuzzleio/elasticsearch:7 + container_name: kuzzle_elasticsearch + ports: + - '9200:9200' + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:9200'] + interval: 2s + timeout: 2s + retries: 10 ulimits: nofile: 65536 ``` diff --git a/docker/scripts/docker-compose.test.yml b/docker/scripts/docker-compose.test.yml index 2c2008c70b..b076010c06 100644 --- a/docker/scripts/docker-compose.test.yml +++ b/docker/scripts/docker-compose.test.yml @@ -37,8 +37,9 @@ x-kuzzle-config: &kuzzle-config - KUZZLE_VAULT_KEY=${KUZZLE_VAULT_KEY:-secret-password} - KUZZLE_SECRETS_FILE=${KUZZLE_SECRETS_FILE:-/var/app/features/fixtures/secrets.enc.json} # Variables used by the development scripts - - NODE_12_VERSION=12.20.0 - - NODE_14_VERSION=14.17.0 + - NODE_16_VERSION=16.19.1 + - NODE_18_VERSION=18.17.0 + - NODE_20_VERSION=20.0.0 - WITHOUT_KUZZLE # Run only Elasticsearch and Redis - REBUILD # Force a rebuild of npm modules @@ -63,7 +64,7 @@ services: - '1883:1883' # Kuzzle MQTT port - '9229:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 @@ -76,7 +77,7 @@ services: - '11883:1883' # Kuzzle MQTT port - '9230:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 @@ -89,7 +90,7 @@ services: - '11884:1883' # Kuzzle MQTT port - '9231:9229' # Debug port healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] timeout: 1s interval: 2s retries: 10 diff --git a/docker/scripts/run-dev.sh b/docker/scripts/run-dev.sh index ec02339803..27cd6ab4f5 100755 --- a/docker/scripts/run-dev.sh +++ b/docker/scripts/run-dev.sh @@ -8,8 +8,8 @@ fi if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default $NODE_14_VERSION" - n $NODE_14_VERSION + echo "Missing NODE_VERSION, use default $NODE_18_VERSION" + n $NODE_18_VERSION fi if [ -n "$TRAVIS" ] || [ -n "$REBUILD" ]; then diff --git a/docker/scripts/run-test.sh b/docker/scripts/run-test.sh index 2a1d016ae3..7a5da62d82 100755 --- a/docker/scripts/run-test.sh +++ b/docker/scripts/run-test.sh @@ -8,8 +8,8 @@ fi if [ -z "$NODE_VERSION" ]; then - echo "Missing NODE_VERSION, use default $NODE_14_VERSION" - n $NODE_14_VERSION + echo "Missing NODE_VERSION, use default $NODE_18_VERSION" + n $NODE_18_VERSION fi if [ -n "$TRAVIS" ] || [ -n "$REBUILD" ]; then diff --git a/lib/api/httpRoutes.js b/lib/api/httpRoutes.js index d90c1ad432..b4cb4a46ab 100644 --- a/lib/api/httpRoutes.js +++ b/lib/api/httpRoutes.js @@ -447,7 +447,7 @@ const routes = [ { verb: "get", path: "/", controller: "server", action: "info" }, { verb: "get", - path: "/_healthCheck", + path: "/_healthcheck", controller: "server", action: "healthCheck", }, From c15cf43bdd96757634cad764b94a3de8d26cd878 Mon Sep 17 00:00:00 2001 From: rolljee Date: Tue, 19 Sep 2023 15:55:50 +0200 Subject: [PATCH 2/2] Revert change inside httpRoutes.js --- lib/api/httpRoutes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/httpRoutes.js b/lib/api/httpRoutes.js index b4cb4a46ab..d90c1ad432 100644 --- a/lib/api/httpRoutes.js +++ b/lib/api/httpRoutes.js @@ -447,7 +447,7 @@ const routes = [ { verb: "get", path: "/", controller: "server", action: "info" }, { verb: "get", - path: "/_healthcheck", + path: "/_healthCheck", controller: "server", action: "healthCheck", },