Skip to content

Commit

Permalink
Merge pull request #33 from NethServer:memoryLimit
Browse files Browse the repository at this point in the history
Add upload limit configuration and mariadb upgrade to 10.11.7
  • Loading branch information
stephdl authored Mar 9, 2024
2 parents c7acb8c + 15a2120 commit 6420d3f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 4 additions & 0 deletions imageroot/actions/configure-module/20configure
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 7 additions & 1 deletion imageroot/actions/configure-module/validate-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"type": "object",
"required": [
"path",
"http2https"
"http2https",
"upload_limit"
],
"properties": {
"path": {
Expand All @@ -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"
}
}
}
12 changes: 5 additions & 7 deletions imageroot/actions/get-configuration/20read
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 0 additions & 10 deletions imageroot/actions/get-configuration/validate-input.json

This file was deleted.

21 changes: 19 additions & 2 deletions imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
4 changes: 3 additions & 1 deletion ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,29 @@
/>
</div>
</div>
<NsTextInput
:label="$t('settings.upload_limit')"
v-model.trim="upload_limit"
class="mg-bottom"
:invalid-message="$t(error.upload_limit)"
:disabled="loading.getConfiguration || loading.configureModule"
ref="upload_limit"
tooltipAlignment="center"
tooltipDirection="right"
type="number"
min="2"
max="256"
>
<template slot="tooltip">
<div
v-html="
$t(
'settings.upload_limit_tips'
)
"
></div>
</template>
</NsTextInput>
<NsButton
kind="primary"
:icon="Save20"
Expand Down Expand Up @@ -154,6 +177,7 @@ export default {
urlCheckInterval: null,
path: "",
mariadb_tcp_port: "",
upload_limit: "2",
// isLetsEncryptEnabled: false,
isHttpToHttpsEnabled: false,
loading: {
Expand All @@ -166,6 +190,7 @@ export default {
path: "",
lets_encrypt: "",
http2https: "",
upload_limit: "",
},
};
},
Expand Down Expand Up @@ -233,6 +258,7 @@ export default {
this.path = config.path;
this.hostname = config.hostname;
this.mariadb_tcp_port = config.mariadb_tcp_port;
this.upload_limit = config.upload_limit;
// this.isLetsEncryptEnabled = config.lets_encrypt;
this.isHttpToHttpsEnabled = config.http2https;
this.loading.getConfiguration = false;
Expand Down Expand Up @@ -302,6 +328,7 @@ export default {
path: this.path,
// lets_encrypt: this.isLetsEncryptEnabled,
http2https: this.isHttpToHttpsEnabled,
upload_limit: this.upload_limit,
},
extra: {
title: this.$t("settings.instance_configuration", {
Expand Down

0 comments on commit 6420d3f

Please sign in to comment.