diff --git a/.devcontainer/api.dockerfile b/.devcontainer/api.dockerfile index 32929663..abed7da0 100644 --- a/.devcontainer/api.dockerfile +++ b/.devcontainer/api.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-slim +FROM python:3.9.2-slim ENV TACTICAL_DIR /opt/tactical ENV TACTICAL_GO_DIR /usr/local/rmmgo diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7e7c9a20..72d9003c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,11 +23,11 @@ jobs: rm -rf /myagent/_work/1/s/api/env cd /myagent/_work/1/s/api - python3.8 -m venv env + python3.9 -m venv env source env/bin/activate cd /myagent/_work/1/s/api/tacticalrmm pip install --no-cache-dir --upgrade pip - pip install --no-cache-dir setuptools==52.0.0 wheel==0.36.2 + pip install --no-cache-dir setuptools==53.0.0 wheel==0.36.2 pip install --no-cache-dir -r requirements.txt -r requirements-test.txt -r requirements-dev.txt displayName: "Install Python Dependencies" diff --git a/docker/containers/tactical/dockerfile b/docker/containers/tactical/dockerfile index 40afed72..b86a4015 100644 --- a/docker/containers/tactical/dockerfile +++ b/docker/containers/tactical/dockerfile @@ -1,5 +1,5 @@ # creates python virtual env -FROM python:3.8-slim AS CREATE_VENV_STAGE +FROM python:3.9.2-slim AS CREATE_VENV_STAGE ARG DEBIAN_FRONTEND=noninteractive @@ -24,7 +24,7 @@ RUN apt-get update && \ # runtime image -FROM python:3.8-slim +FROM python:3.9.2-slim # set env variables ENV VIRTUAL_ENV /opt/venv diff --git a/install.sh b/install.sh index 105db044..10d4bc26 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION="39" +SCRIPT_VERSION="40" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/install.sh' sudo apt install -y curl wget dirmngr gnupg lsb-release @@ -226,12 +226,23 @@ sudo apt install -y mongodb-org sudo systemctl enable mongod sudo systemctl restart mongod +print_green 'Installing Python 3.9' + +sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev +numprocs=$(nproc) +cd ~ +wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz +tar -xf Python-3.9.2.tgz +cd Python-3.9.2 +./configure --enable-optimizations +make -j $numprocs +sudo make altinstall +cd ~ +sudo rm -rf Python-3.9.2 Python-3.9.2.tgz -print_green 'Installing python, redis and git' - -sudo apt update -sudo apt install -y python3-venv python3-dev python3-pip python3-setuptools python3-wheel ca-certificates redis git +print_green 'Installing redis and git' +sudo apt install -y ca-certificates redis git print_green 'Installing postgresql' @@ -371,11 +382,11 @@ sudo chmod +x /usr/local/bin/nats-api print_green 'Installing the backend' cd /rmm/api -python3 -m venv env +python3.9 -m venv env source /rmm/api/env/bin/activate cd /rmm/api/tacticalrmm pip install --no-cache-dir --upgrade pip -pip install --no-cache-dir setuptools==52.0.0 wheel==0.36.2 +pip install --no-cache-dir setuptools==53.0.0 wheel==0.36.2 pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt python manage.py migrate python manage.py collectstatic --no-input diff --git a/restore.sh b/restore.sh index 2f3c5c66..bcaa61bf 100755 --- a/restore.sh +++ b/restore.sh @@ -7,7 +7,7 @@ pgpw="hunter2" ##################################################### -SCRIPT_VERSION="17" +SCRIPT_VERSION="18" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/restore.sh' sudo apt install -y curl wget dirmngr gnupg lsb-release @@ -192,9 +192,23 @@ print_green 'Restoring systemd services' sudo cp $tmp_dir/systemd/* /etc/systemd/system/ sudo systemctl daemon-reload -print_green 'Installing python, redis and git' +print_green 'Installing Python 3.9' -sudo apt install -y python3-venv python3-dev python3-pip python3-setuptools python3-wheel ca-certificates redis git +sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev +numprocs=$(nproc) +cd ~ +wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz +tar -xf Python-3.9.2.tgz +cd Python-3.9.2 +./configure --enable-optimizations +make -j $numprocs +sudo make altinstall +cd ~ +sudo rm -rf Python-3.9.2 Python-3.9.2.tgz + + +print_green 'Installing redis and git' +sudo apt install -y ca-certificates redis git print_green 'Installing postgresql' @@ -268,11 +282,11 @@ sudo chown ${USER}:${USER} /usr/local/bin/nats-api sudo chmod +x /usr/local/bin/nats-api cd /rmm/api -python3 -m venv env +python3.9 -m venv env source /rmm/api/env/bin/activate cd /rmm/api/tacticalrmm pip install --no-cache-dir --upgrade pip -pip install --no-cache-dir setuptools==52.0.0 wheel==0.36.2 +pip install --no-cache-dir setuptools==53.0.0 wheel==0.36.2 pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt python manage.py collectstatic --no-input python manage.py reload_nats diff --git a/update.sh b/update.sh index a07b6c20..d943ce4f 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_VERSION="109" +SCRIPT_VERSION="110" SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/update.sh' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py' YELLOW='\033[1;33m' @@ -190,6 +190,22 @@ if ! [[ $CHECK_HAS_GO116 ]]; then sudo chown -R $USER:$GROUP /home/${USER}/.cache fi +HAS_PY39=$(which python3.9) +if ! [[ $HAS_PY39 ]]; then + printf >&2 "${GREEN}Updating to Python 3.9${NC}\n" + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev + numprocs=$(nproc) + cd ~ + wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz + tar -xf Python-3.9.2.tgz + cd Python-3.9.2 + ./configure --enable-optimizations + make -j $numprocs + sudo make altinstall + cd ~ + sudo rm -rf Python-3.9.2 Python-3.9.2.tgz +fi + cd /rmm git config user.email "admin@example.com" git config user.name "Bob" @@ -261,11 +277,11 @@ sudo chmod +x /usr/local/bin/nats-api if [[ "${CURRENT_PIP_VER}" != "${LATEST_PIP_VER}" ]]; then rm -rf /rmm/api/env cd /rmm/api - python3 -m venv env + python3.9 -m venv env source /rmm/api/env/bin/activate cd /rmm/api/tacticalrmm pip install --no-cache-dir --upgrade pip - pip install --no-cache-dir setuptools==52.0.0 wheel==0.36.2 + pip install --no-cache-dir setuptools==53.0.0 wheel==0.36.2 pip install --no-cache-dir -r requirements.txt else source /rmm/api/env/bin/activate