allow 1.2 times RAM
This is basically to allow 2 phabricators and another small app with no warning on a 4gb droplet :-)
This commit is contained in:
@@ -19,7 +19,7 @@ fi
|
||||
|
||||
# all sizes are in mb
|
||||
readonly physical_memory=$(free -m | awk '/Mem:/ { print $2 }')
|
||||
readonly swap_size="${physical_memory}"
|
||||
readonly swap_size="${physical_memory}" # if you change this, fix enoughResourcesAvailable() in client.js
|
||||
readonly app_count=$((${physical_memory} / 200)) # estimated app count
|
||||
readonly disk_size_gb=$(fdisk -l ${disk_device} | grep "Disk ${disk_device}" | awk '{ print $3 }')
|
||||
readonly disk_size=$((disk_size_gb * 1024))
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ exports = module.exports = {
|
||||
ADMIN_CLIENT_ID: 'webadmin', // oauth client id
|
||||
ADMIN_APPID: 'admin', // admin appid (settingsdb)
|
||||
|
||||
DEFAULT_MEMORY_LIMIT: (256 * 1024 * 1024)
|
||||
DEFAULT_MEMORY_LIMIT: (256 * 1024 * 1024) // see also client.js
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
angular.module('Application').service('Client', ['$http', 'md5', 'Notification', function ($http, md5, Notification) {
|
||||
var client = null;
|
||||
|
||||
// Keep this in sync with docs and docker.js
|
||||
var DEFAULT_MEMORY_LIMIT = 1024 * 1024 * 200;
|
||||
// Keep this in sync with docs and constants.js, docker.js
|
||||
var DEFAULT_MEMORY_LIMIT = 1024 * 1024 * 256;
|
||||
|
||||
function ClientError(statusCode, messageOrObject) {
|
||||
Error.call(this);
|
||||
@@ -762,10 +762,11 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
};
|
||||
|
||||
Client.prototype.enoughResourcesAvailable = function (app) {
|
||||
var needed = app.manifest.memoryLimit || DEFAULT_MEMORY_LIMIT;
|
||||
var needed = app.manifest.memoryLimit || DEFAULT_MEMORY_LIMIT; // RAM+Swap
|
||||
var used = this.getInstalledApps().reduce(function (prev, cur) { return prev + (cur.manifest.memoryLimit || DEFAULT_MEMORY_LIMIT); }, 0);
|
||||
var roundedMemory = Math.round(this.getConfig().memory / (1024 * 1024 * 1024)) * 1024 * 1024 * 1024; // round to nearest GB
|
||||
var available = (roundedMemory || 0) - used;
|
||||
var totalMemory = roundedMemory * 1.2; // box-setup.sh creates equal amount of swap. 1.2 factor is arbitrary
|
||||
var available = (totalMemory || 0) - used;
|
||||
|
||||
return (available - needed) >= 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user