Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RAM availability to configuration and settings #101

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion imageroot/actions/get-defaults/20readconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,20 @@ for key in agent.list_service_providers(rdb,'xmpp','tcp'):
}
ejabberd.append(obj)

# determine the amount of RAM available on the system
try:
with open('/proc/meminfo', 'r') as f:
for line in f:
if line.startswith('MemTotal:'):
ram_mb = int(line.split()[1]) // 1024 # Convert kB to MB
except Exception:
ram_mb = 4096

config={
"mail_modules_id": modules,
"ejabberd_modules_id": ejabberd,
"accepted_timezone_list": list_of_timezone_widget
"accepted_timezone_list": list_of_timezone_widget,
"ram_mb": ram_mb,
}

json.dump(config, fp=sys.stdout)
6 changes: 4 additions & 2 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
v-model="webapp.min_memory"
:label="$t('settings.min_webapp_memory')"
min="256"
max="4096"
:max="ram_mb"
step="1"
stepMultiplier="1023"
minLabel=""
Expand All @@ -230,7 +230,7 @@
v-model="webapp.max_memory"
:label="$t('settings.max_webapp_memory')"
min="256"
max="4096"
:max="ram_mb"
step="1"
stepMultiplier="1023"
minLabel=""
Expand Down Expand Up @@ -430,6 +430,7 @@ export default {
ejabberd_domain: "",
ejabberd_modules_id: [],
accepted_timezone_list: [],
ram_mb: "4096",
locale: "",
timezone: "",
webapp: {
Expand Down Expand Up @@ -556,6 +557,7 @@ export default {
value: "-",
});
this.accepted_timezone_list = config.accepted_timezone_list;
this.ram_mb = String(config.ram_mb);
this.getConfiguration();
this.loading.getDefaults = false;
},
Expand Down
Loading