From 97099816bd26091ed9442eb7dc38dd1424db2c9f Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:14 +0100 Subject: [PATCH 1/9] Add upload limit configuration in configure-module --- imageroot/actions/configure-module/20configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imageroot/actions/configure-module/20configure b/imageroot/actions/configure-module/20configure index 0f5404d..4037361 100755 --- a/imageroot/actions/configure-module/20configure +++ b/imageroot/actions/configure-module/20configure @@ -44,6 +44,10 @@ traefik_tcp_port = env_tcp_ports[1] agent.set_env("MARIADB_TCP_PORT", mariadb_tcp_port) agent.set_env("TRAEFIK_TCP_PORT", traefik_tcp_port) +# Setup configuration from user input. +upload_limit = data.get("upload_limit", '2') +agent.set_env("UPLOAD_LIMIT", upload_limit+'M') + # Make sure everything is saved inside the environment file # just before starting systemd unit agent.dump_env() From e942c6c6f1eae016dd4a8340d081ff2d327b7697 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:22 +0100 Subject: [PATCH 2/9] Update configuration variables in get-configuration script --- imageroot/actions/get-configuration/20read | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/imageroot/actions/get-configuration/20read b/imageroot/actions/get-configuration/20read index c00d0a5..d93817f 100755 --- a/imageroot/actions/get-configuration/20read +++ b/imageroot/actions/get-configuration/20read @@ -32,13 +32,11 @@ import agent # Prepare return variable config = {} -# Read current configuration from Redis -env = f'module/{os.environ["MODULE_ID"]}/environment' -rdb = agent.redis_connect() -config["mariadb_tcp_port"] = rdb.hget(env, "MARIADB_TCP_PORT"); -config["path"] = rdb.hget(env, "TRAEFIK_PATH"); -config["http2https"] = rdb.hget(env, "TRAEFIK_HTTP2HTTPS") == "True"; -# config["lets_encrypt"] = rdb.hget(env, "TRAEFIK_LETS_ENCRYPT") == "True"; +# Read current configuration from Environment +config["mariadb_tcp_port"] = os.environ.get("MARIADB_TCP_PORT","") +config["path"] = os.environ.get("TRAEFIK_PATH","") +config["http2https"] = os.environ.get("TRAEFIK_HTTP2HTTPS","False") == "True"; +config["upload_limit"] = os.environ.get("UPLOAD_LIMIT","2M").rstrip('M') # Find the hostname of the node config["hostname"] = agent.get_hostname() From 368615550eb8e416da8d69324a239d9b2b87861d Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:29 +0100 Subject: [PATCH 3/9] Add upload limit setting to Settings.vue --- ui/src/views/Settings.vue | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index e8d684b..d62ad78 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -115,6 +115,29 @@ /> + + + Date: Sat, 9 Mar 2024 09:49:35 +0100 Subject: [PATCH 4/9] Delete validate-input.json schema file --- .../actions/get-configuration/validate-input.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 imageroot/actions/get-configuration/validate-input.json diff --git a/imageroot/actions/get-configuration/validate-input.json b/imageroot/actions/get-configuration/validate-input.json deleted file mode 100644 index 4d37a80..0000000 --- a/imageroot/actions/get-configuration/validate-input.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "get-configuration input", - "$id": "http://schema.nethserver.org/mariadb/get-configuration-input.json", - "description": "The action does not accept any input", - "examples": [ - null - ], - "type": "null" -} From 163f910aa782d3dfc9ed01800fbc7217bb52453d Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:45 +0100 Subject: [PATCH 5/9] Add upload_limit property to validate-input.json --- imageroot/actions/configure-module/validate-input.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/imageroot/actions/configure-module/validate-input.json b/imageroot/actions/configure-module/validate-input.json index c401459..161d58f 100644 --- a/imageroot/actions/configure-module/validate-input.json +++ b/imageroot/actions/configure-module/validate-input.json @@ -10,7 +10,8 @@ "type": "object", "required": [ "path", - "http2https" + "http2https", + "upload_limit" ], "properties": { "path": { @@ -22,6 +23,11 @@ "type": "boolean", "title": "HTTP to HTTPS redirection", "description": "Redirect all the HTTP requests to HTTPS" + }, + "upload_limit": { + "type": "string", + "title": "Upload limit", + "description": "Maximum upload size" } } } From c996f96cd2567c3b9393255a8575bb009d1572cc Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:49 +0100 Subject: [PATCH 6/9] Add upload limit to configuration --- .../get-configuration/validate-output.json | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/imageroot/actions/get-configuration/validate-output.json b/imageroot/actions/get-configuration/validate-output.json index 3d39d30..411b85e 100644 --- a/imageroot/actions/get-configuration/validate-output.json +++ b/imageroot/actions/get-configuration/validate-output.json @@ -7,20 +7,37 @@ { "mariadb_tcp_port": "3306", "path": "/phpmyadmin", - "http2https": true + "http2https": true, + "upload_limit": "2M" } ], "type": "object", "required": [ "path", "http2https", - "mariadb_tcp_port" + "mariadb_tcp_port", + "upload_limit" ], "properties": { "http2https": { "type": "boolean", "title": "HTTP to HTTPS redirection", "description": "Redirect all the HTTP requests to HTTPS" + }, + "mariadb_tcp_port": { + "type": "string", + "title": "MariaDB TCP port", + "description": "TCP port used by MariaDB" + }, + "path": { + "type": "string", + "title": "Path", + "description": "Path to access phpMyAdmin" + }, + "upload_limit": { + "type": "string", + "title": "Upload limit", + "description": "Maximum upload size" } } } From 72421a75c13a83c795f3fd0a2a1a2876524338fa Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 09:49:54 +0100 Subject: [PATCH 7/9] Add upload limit configuration to translation file --- ui/public/i18n/en/translation.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index af6c6ca..14d3e10 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -40,7 +40,9 @@ "phpmyadmin_url": "PhpMyAdmin web application", "link": "Link", "admin_login_tips": "The default login:password is admin:admin, you must change it at the first login", - "phpmyadmin_path_tips": "Enter a unique HTTP path, for example '/phpmyadmin'" + "phpmyadmin_path_tips": "Enter a unique HTTP path, for example '/phpmyadmin'", + "upload_limit": "Upload limit (MB)", + "upload_limit_tips": "Maximum upload size for a database upload is 256MB" }, "about": { "title": "About" From e4e0a8211b6a1d087a794a71486d5b887c4d3a80 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 10:00:59 +0100 Subject: [PATCH 8/9] Fix upload_limit value assignment in Settings.vue --- ui/src/views/Settings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index d62ad78..ee75fb0 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -190,7 +190,7 @@ export default { path: "", lets_encrypt: "", http2https: "", - upload_limit, + upload_limit: "", }, }; }, From 15a21206ee78238cc78296fb75e2442c379453a1 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Sat, 9 Mar 2024 10:01:05 +0100 Subject: [PATCH 9/9] Update Docker image versions --- build-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-images.sh b/build-images.sh index 0e7afba..9f9134f 100644 --- a/build-images.sh +++ b/build-images.sh @@ -30,7 +30,7 @@ buildah config --entrypoint=/ \ --label="org.nethserver.tcp-ports-demand=2" \ --label="org.nethserver.rootfull=0" \ --label="org.nethserver.authorizations=traefik@node:routeadm" \ - --label="org.nethserver.images=docker.io/mariadb:10.11.5 docker.io/phpmyadmin/phpmyadmin:5.2.1" \ + --label="org.nethserver.images=docker.io/mariadb:10.11.7 docker.io/phpmyadmin/phpmyadmin:5.2.1" \ "${container}" # Commit everything buildah commit "${container}" "${repobase}/${reponame}"