remove natsapi from normal install
This commit is contained in:
parent
3629982237
commit
7ff6c79835
15
backup.sh
15
backup.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_VERSION="10"
|
SCRIPT_VERSION="11"
|
||||||
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/backup.sh'
|
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/backup.sh'
|
||||||
|
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
|
@ -8,17 +8,20 @@ YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
THIS_SCRIPT=$(readlink -f "$0")
|
||||||
|
|
||||||
TMP_FILE=$(mktemp -p "" "rmmbackup_XXXXXXXXXX")
|
TMP_FILE=$(mktemp -p "" "rmmbackup_XXXXXXXXXX")
|
||||||
curl -s -L "${SCRIPT_URL}" > ${TMP_FILE}
|
curl -s -L "${SCRIPT_URL}" > ${TMP_FILE}
|
||||||
NEW_VER=$(grep "^SCRIPT_VERSION" "$TMP_FILE" | awk -F'[="]' '{print $3}')
|
NEW_VER=$(grep "^SCRIPT_VERSION" "$TMP_FILE" | awk -F'[="]' '{print $3}')
|
||||||
|
|
||||||
if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then
|
if [ "${SCRIPT_VERSION}" -ne "${NEW_VER}" ]; then
|
||||||
printf >&2 "${YELLOW}A newer version of this backup script is available.${NC}\n"
|
printf >&2 "${YELLOW}Old backup script detected, downloading and replacing with the latest version...${NC}\n"
|
||||||
printf >&2 "${YELLOW}Please download the latest version from ${GREEN}${SCRIPT_URL}${YELLOW} and re-run.${NC}\n"
|
wget -q "${SCRIPT_URL}" -O backup.sh
|
||||||
rm -f $TMP_FILE
|
exec ${THIS_SCRIPT}
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f $TMP_FILE
|
||||||
|
|
||||||
if [ $EUID -eq 0 ]; then
|
if [ $EUID -eq 0 ]; then
|
||||||
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
|
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -69,7 +72,7 @@ sudo tar -czvf ${tmp_dir}/nginx/etc-nginx.tar.gz -C /etc/nginx .
|
||||||
|
|
||||||
sudo tar -czvf ${tmp_dir}/confd/etc-confd.tar.gz -C /etc/conf.d .
|
sudo tar -czvf ${tmp_dir}/confd/etc-confd.tar.gz -C /etc/conf.d .
|
||||||
|
|
||||||
sudo cp ${sysd}/rmm.service ${sysd}/celery.service ${sysd}/celerybeat.service ${sysd}/meshcentral.service ${sysd}/nats.service ${sysd}/natsapi.service ${tmp_dir}/systemd/
|
sudo cp ${sysd}/rmm.service ${sysd}/celery.service ${sysd}/celerybeat.service ${sysd}/meshcentral.service ${sysd}/nats.service ${tmp_dir}/systemd/
|
||||||
|
|
||||||
cat /rmm/api/tacticalrmm/tacticalrmm/private/log/debug.log | gzip -9 > ${tmp_dir}/rmm/debug.log.gz
|
cat /rmm/api/tacticalrmm/tacticalrmm/private/log/debug.log | gzip -9 > ${tmp_dir}/rmm/debug.log.gz
|
||||||
cp /rmm/api/tacticalrmm/tacticalrmm/local_settings.py /rmm/api/tacticalrmm/app.ini ${tmp_dir}/rmm/
|
cp /rmm/api/tacticalrmm/tacticalrmm/local_settings.py /rmm/api/tacticalrmm/app.ini ${tmp_dir}/rmm/
|
||||||
|
|
|
@ -69,7 +69,6 @@ sudo systemctl status celery
|
||||||
sudo systemctl status celerybeat
|
sudo systemctl status celerybeat
|
||||||
sudo systemctl status nginx
|
sudo systemctl status nginx
|
||||||
sudo systemctl status nats
|
sudo systemctl status nats
|
||||||
sudo systemctl status natsapi
|
|
||||||
sudo systemctl status meshcentral
|
sudo systemctl status meshcentral
|
||||||
sudo systemctl status mongod
|
sudo systemctl status mongod
|
||||||
sudo systemctl status postgresql
|
sudo systemctl status postgresql
|
||||||
|
|
23
install.sh
23
install.sh
|
@ -482,26 +482,6 @@ EOF
|
||||||
)"
|
)"
|
||||||
echo "${natsservice}" | sudo tee /etc/systemd/system/nats.service > /dev/null
|
echo "${natsservice}" | sudo tee /etc/systemd/system/nats.service > /dev/null
|
||||||
|
|
||||||
natsapi="$(cat << EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Tactical NATS API
|
|
||||||
After=network.target rmm.service nginx.service nats.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/local/bin/nats-api
|
|
||||||
User=${USER}
|
|
||||||
Group=${USER}
|
|
||||||
Restart=always
|
|
||||||
RestartSec=5s
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
)"
|
|
||||||
echo "${natsapi}" | sudo tee /etc/systemd/system/natsapi.service > /dev/null
|
|
||||||
|
|
||||||
|
|
||||||
nginxrmm="$(cat << EOF
|
nginxrmm="$(cat << EOF
|
||||||
server_tokens off;
|
server_tokens off;
|
||||||
|
|
||||||
|
@ -808,7 +788,6 @@ sleep 5
|
||||||
MESHEXE=$(node node_modules/meshcentral/meshctrl.js --url wss://${meshdomain}:443 --loginuser ${meshusername} --loginpass ${MESHPASSWD} GenerateInviteLink --group TacticalRMM --hours 8)
|
MESHEXE=$(node node_modules/meshcentral/meshctrl.js --url wss://${meshdomain}:443 --loginuser ${meshusername} --loginpass ${MESHPASSWD} GenerateInviteLink --group TacticalRMM --hours 8)
|
||||||
|
|
||||||
sudo systemctl enable nats.service
|
sudo systemctl enable nats.service
|
||||||
sudo systemctl enable natsapi.service
|
|
||||||
cd /rmm/api/tacticalrmm
|
cd /rmm/api/tacticalrmm
|
||||||
source /rmm/api/env/bin/activate
|
source /rmm/api/env/bin/activate
|
||||||
python manage.py initial_db_setup
|
python manage.py initial_db_setup
|
||||||
|
@ -820,7 +799,7 @@ sudo systemctl start nats.service
|
||||||
sed -i 's/ADMIN_ENABLED = True/ADMIN_ENABLED = False/g' /rmm/api/tacticalrmm/tacticalrmm/local_settings.py
|
sed -i 's/ADMIN_ENABLED = True/ADMIN_ENABLED = False/g' /rmm/api/tacticalrmm/tacticalrmm/local_settings.py
|
||||||
|
|
||||||
print_green 'Restarting services'
|
print_green 'Restarting services'
|
||||||
for i in rmm.service celery.service celerybeat.service natsapi.service
|
for i in rmm.service celery.service celerybeat.service
|
||||||
do
|
do
|
||||||
sudo systemctl stop ${i}
|
sudo systemctl stop ${i}
|
||||||
sudo systemctl start ${i}
|
sudo systemctl start ${i}
|
||||||
|
|
|
@ -350,10 +350,6 @@ print_green 'Starting meshcentral'
|
||||||
sudo systemctl enable meshcentral
|
sudo systemctl enable meshcentral
|
||||||
sudo systemctl start meshcentral
|
sudo systemctl start meshcentral
|
||||||
|
|
||||||
print_green 'Starting natsapi'
|
|
||||||
sudo systemctl enable natsapi.service
|
|
||||||
sudo systemctl start natsapi.service
|
|
||||||
|
|
||||||
printf >&2 "${YELLOW}%0.s*${NC}" {1..80}
|
printf >&2 "${YELLOW}%0.s*${NC}" {1..80}
|
||||||
printf >&2 "\n\n"
|
printf >&2 "\n\n"
|
||||||
printf >&2 "${YELLOW}Restore complete!${NC}\n\n"
|
printf >&2 "${YELLOW}Restore complete!${NC}\n\n"
|
||||||
|
|
16
update.sh
16
update.sh
|
@ -67,7 +67,15 @@ LATEST_NPM_VER=$(grep "^NPM_VER" "$TMP_SETTINGS" | awk -F'[= "]' '{print $5}')
|
||||||
CURRENT_PIP_VER=$(grep "^PIP_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
CURRENT_PIP_VER=$(grep "^PIP_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
||||||
CURRENT_NPM_VER=$(grep "^NPM_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
CURRENT_NPM_VER=$(grep "^NPM_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
||||||
|
|
||||||
for i in nginx nats natsapi rmm celery celerybeat
|
if [ -f /etc/systemd/system/natsapi.service ]; then
|
||||||
|
printf >&2 "${GREEN}Removing natsapi.service${NC}\n"
|
||||||
|
sudo systemctl stop natsapi.service
|
||||||
|
sudo systemctl disable natsapi.service
|
||||||
|
sudo rm -f /etc/systemd/system/natsapi.service
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in nginx nats rmm celery celerybeat
|
||||||
do
|
do
|
||||||
printf >&2 "${GREEN}Stopping ${i} service...${NC}\n"
|
printf >&2 "${GREEN}Stopping ${i} service...${NC}\n"
|
||||||
sudo systemctl stop ${i}
|
sudo systemctl stop ${i}
|
||||||
|
@ -107,10 +115,6 @@ EOF
|
||||||
)"
|
)"
|
||||||
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini
|
||||||
|
|
||||||
|
|
||||||
# forgot to add this in install script. catch any installs that don't have it enabled and enable it
|
|
||||||
sudo systemctl enable natsapi.service
|
|
||||||
|
|
||||||
CHECK_NGINX_WORKER_CONN=$(grep "worker_connections 2048" /etc/nginx/nginx.conf)
|
CHECK_NGINX_WORKER_CONN=$(grep "worker_connections 2048" /etc/nginx/nginx.conf)
|
||||||
if ! [[ $CHECK_NGINX_WORKER_CONN ]]; then
|
if ! [[ $CHECK_NGINX_WORKER_CONN ]]; then
|
||||||
printf >&2 "${GREEN}Changing nginx worker connections to 2048${NC}\n"
|
printf >&2 "${GREEN}Changing nginx worker connections to 2048${NC}\n"
|
||||||
|
@ -254,7 +258,7 @@ sudo rm -rf /var/www/rmm/dist
|
||||||
sudo cp -pr /rmm/web/dist /var/www/rmm/
|
sudo cp -pr /rmm/web/dist /var/www/rmm/
|
||||||
sudo chown www-data:www-data -R /var/www/rmm/dist
|
sudo chown www-data:www-data -R /var/www/rmm/dist
|
||||||
|
|
||||||
for i in rmm celery celerybeat nginx nats natsapi
|
for i in rmm celery celerybeat nginx nats
|
||||||
do
|
do
|
||||||
printf >&2 "${GREEN}Starting ${i} service${NC}\n"
|
printf >&2 "${GREEN}Starting ${i} service${NC}\n"
|
||||||
sudo systemctl start ${i}
|
sudo systemctl start ${i}
|
||||||
|
|
Loading…
Reference in New Issue