auto scale uwsgi workers based on load
This commit is contained in:
@@ -111,22 +111,12 @@ EOF
|
|||||||
|
|
||||||
echo "${localvars}" > ${TACTICAL_DIR}/api/tacticalrmm/local_settings.py
|
echo "${localvars}" > ${TACTICAL_DIR}/api/tacticalrmm/local_settings.py
|
||||||
|
|
||||||
numprocs=$(nproc)
|
|
||||||
uwsgiprocs=4
|
|
||||||
if [[ "$numprocs" == "1" ]]; then
|
|
||||||
uwsgiprocs=2
|
|
||||||
else
|
|
||||||
uwsgiprocs=$numprocs
|
|
||||||
fi
|
|
||||||
|
|
||||||
uwsgiconf="$(cat << EOF
|
uwsgiconf="$(cat << EOF
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
chdir = /opt/tactical/api
|
chdir = /opt/tactical/api
|
||||||
module = tacticalrmm.wsgi
|
module = tacticalrmm.wsgi
|
||||||
home = /opt/venv
|
home = /opt/venv
|
||||||
master = true
|
master = true
|
||||||
processes = ${uwsgiprocs}
|
|
||||||
threads = ${uwsgiprocs}
|
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
socket = 0.0.0.0:8080
|
socket = 0.0.0.0:8080
|
||||||
harakiri = 300
|
harakiri = 300
|
||||||
@@ -136,6 +126,16 @@ vacuum = true
|
|||||||
die-on-term = true
|
die-on-term = true
|
||||||
max-requests = 500
|
max-requests = 500
|
||||||
disable-logging = true
|
disable-logging = true
|
||||||
|
cheaper-algo = busyness
|
||||||
|
cheaper = 4
|
||||||
|
cheaper-initial = 4
|
||||||
|
workers = 20
|
||||||
|
cheaper-step = 2
|
||||||
|
cheaper-overload = 3
|
||||||
|
cheaper-busyness-min = 5
|
||||||
|
cheaper-busyness-max = 10
|
||||||
|
# stats = /tmp/stats.socket # uncomment when debugging
|
||||||
|
# cheaper-busyness-verbose = true # uncomment when debugging
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
|
|
||||||
|
22
install.sh
22
install.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPT_VERSION="63"
|
SCRIPT_VERSION="64"
|
||||||
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh'
|
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh'
|
||||||
|
|
||||||
sudo apt install -y curl wget dirmngr gnupg lsb-release
|
sudo apt install -y curl wget dirmngr gnupg lsb-release
|
||||||
@@ -382,22 +382,12 @@ python manage.py generate_barcode ${RANDBASE} ${djangousername} ${frontenddomain
|
|||||||
deactivate
|
deactivate
|
||||||
read -n 1 -s -r -p "Press any key to continue..."
|
read -n 1 -s -r -p "Press any key to continue..."
|
||||||
|
|
||||||
echo 'Optimizing for number of processors'
|
|
||||||
uwsgiprocs=4
|
|
||||||
if [[ "$numprocs" == "1" ]]; then
|
|
||||||
uwsgiprocs=2
|
|
||||||
else
|
|
||||||
uwsgiprocs=$numprocs
|
|
||||||
fi
|
|
||||||
|
|
||||||
uwsgini="$(cat << EOF
|
uwsgini="$(cat << EOF
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
chdir = /rmm/api/tacticalrmm
|
chdir = /rmm/api/tacticalrmm
|
||||||
module = tacticalrmm.wsgi
|
module = tacticalrmm.wsgi
|
||||||
home = /rmm/api/env
|
home = /rmm/api/env
|
||||||
master = true
|
master = true
|
||||||
processes = ${uwsgiprocs}
|
|
||||||
threads = ${uwsgiprocs}
|
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
||||||
harakiri = 300
|
harakiri = 300
|
||||||
@@ -407,6 +397,16 @@ vacuum = true
|
|||||||
die-on-term = true
|
die-on-term = true
|
||||||
max-requests = 500
|
max-requests = 500
|
||||||
disable-logging = true
|
disable-logging = true
|
||||||
|
cheaper-algo = busyness
|
||||||
|
cheaper = 4
|
||||||
|
cheaper-initial = 4
|
||||||
|
workers = 20
|
||||||
|
cheaper-step = 2
|
||||||
|
cheaper-overload = 3
|
||||||
|
cheaper-busyness-min = 5
|
||||||
|
cheaper-busyness-max = 10
|
||||||
|
# stats = /tmp/stats.socket # uncomment when debugging
|
||||||
|
# cheaper-busyness-verbose = true # uncomment when debugging
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
||||||
|
23
restore.sh
23
restore.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPT_VERSION="37"
|
SCRIPT_VERSION="38"
|
||||||
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/restore.sh'
|
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/restore.sh'
|
||||||
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -245,23 +245,12 @@ npm install meshcentral@${MESH_VER}
|
|||||||
|
|
||||||
print_green 'Restoring the backend'
|
print_green 'Restoring the backend'
|
||||||
|
|
||||||
echo 'Optimize for number of processors'
|
|
||||||
numprocs=$(nproc)
|
|
||||||
uwsgiprocs=4
|
|
||||||
if [[ "$numprocs" == "1" ]]; then
|
|
||||||
uwsgiprocs=2
|
|
||||||
else
|
|
||||||
uwsgiprocs=$numprocs
|
|
||||||
fi
|
|
||||||
|
|
||||||
uwsgini="$(cat << EOF
|
uwsgini="$(cat << EOF
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
chdir = /rmm/api/tacticalrmm
|
chdir = /rmm/api/tacticalrmm
|
||||||
module = tacticalrmm.wsgi
|
module = tacticalrmm.wsgi
|
||||||
home = /rmm/api/env
|
home = /rmm/api/env
|
||||||
master = true
|
master = true
|
||||||
processes = ${uwsgiprocs}
|
|
||||||
threads = ${uwsgiprocs}
|
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
||||||
harakiri = 300
|
harakiri = 300
|
||||||
@@ -271,6 +260,16 @@ vacuum = true
|
|||||||
die-on-term = true
|
die-on-term = true
|
||||||
max-requests = 500
|
max-requests = 500
|
||||||
disable-logging = true
|
disable-logging = true
|
||||||
|
cheaper-algo = busyness
|
||||||
|
cheaper = 4
|
||||||
|
cheaper-initial = 4
|
||||||
|
workers = 20
|
||||||
|
cheaper-step = 2
|
||||||
|
cheaper-overload = 3
|
||||||
|
cheaper-busyness-min = 5
|
||||||
|
cheaper-busyness-max = 10
|
||||||
|
# stats = /tmp/stats.socket # uncomment when debugging
|
||||||
|
# cheaper-busyness-verbose = true # uncomment when debugging
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
||||||
|
22
update.sh
22
update.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPT_VERSION="135"
|
SCRIPT_VERSION="136"
|
||||||
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/update.sh'
|
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/update.sh'
|
||||||
LATEST_SETTINGS_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py'
|
LATEST_SETTINGS_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
@@ -114,22 +114,12 @@ done
|
|||||||
|
|
||||||
rm -f /rmm/api/tacticalrmm/app.ini
|
rm -f /rmm/api/tacticalrmm/app.ini
|
||||||
|
|
||||||
numprocs=$(nproc)
|
|
||||||
uwsgiprocs=4
|
|
||||||
if [[ "$numprocs" == "1" ]]; then
|
|
||||||
uwsgiprocs=2
|
|
||||||
else
|
|
||||||
uwsgiprocs=$numprocs
|
|
||||||
fi
|
|
||||||
|
|
||||||
uwsgini="$(cat << EOF
|
uwsgini="$(cat << EOF
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
chdir = /rmm/api/tacticalrmm
|
chdir = /rmm/api/tacticalrmm
|
||||||
module = tacticalrmm.wsgi
|
module = tacticalrmm.wsgi
|
||||||
home = /rmm/api/env
|
home = /rmm/api/env
|
||||||
master = true
|
master = true
|
||||||
processes = ${uwsgiprocs}
|
|
||||||
threads = ${uwsgiprocs}
|
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
|
||||||
harakiri = 300
|
harakiri = 300
|
||||||
@@ -139,6 +129,16 @@ vacuum = true
|
|||||||
die-on-term = true
|
die-on-term = true
|
||||||
max-requests = 500
|
max-requests = 500
|
||||||
disable-logging = true
|
disable-logging = true
|
||||||
|
cheaper-algo = busyness
|
||||||
|
cheaper = 4
|
||||||
|
cheaper-initial = 4
|
||||||
|
workers = 20
|
||||||
|
cheaper-step = 2
|
||||||
|
cheaper-overload = 3
|
||||||
|
cheaper-busyness-min = 5
|
||||||
|
cheaper-busyness-max = 10
|
||||||
|
# stats = /tmp/stats.socket # uncomment when debugging
|
||||||
|
# cheaper-busyness-verbose = true # uncomment when debugging
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
||||||
|
Reference in New Issue
Block a user