From e804f8619be8f35dd538c08e3433488c972c5578 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Tue, 18 Feb 2025 19:01:55 -0500 Subject: [PATCH 1/4] removed 'root' docker initialization requirement --- apprise_api/supervisord-startup | 64 +++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/apprise_api/supervisord-startup b/apprise_api/supervisord-startup index 6efa90d..6d001bb 100755 --- a/apprise_api/supervisord-startup +++ b/apprise_api/supervisord-startup @@ -22,42 +22,51 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -if [ $(id -u) -ne 0 ]; then - echo "You must be root to run this script." - echo "Caution: This should only be ran in a dockerized instance!" - exit 1 -fi +if [ $(id -u) -eq 0 ]; then + # + # Root User + # + echo "Apprise API Super User Startup" -# Default values -PUID=${PUID:=1000} -PGID=${PGID:=1000} + # Default values + PUID=${PUID:=1000} + PGID=${PGID:=1000} -# lookup our identifier -GROUP=$(getent group $PGID 2>/dev/null | cut -d: -f1) -[ -z "$GROUP" ] && groupadd --force -g $PGID apprise &>/dev/null && \ - GROUP=apprise + # lookup our identifier + GROUP=$(getent group $PGID 2>/dev/null | cut -d: -f1) + [ -z "$GROUP" ] && groupadd --force -g $PGID apprise &>/dev/null && \ + GROUP=apprise -USER=$(id -un $PUID 2>/dev/null) -[ $? -ne 0 ] && useradd -M -N \ - -o -u $PUID -G $GROUP -c "Apprise API User" -d /opt/apprise apprise && \ - USER=apprise + USER=$(id -un $PUID 2>/dev/null) + [ $? -ne 0 ] && useradd -M -N \ + -o -u $PUID -G $GROUP -c "Apprise API User" -d /opt/apprise apprise && \ + USER=apprise -if [ -z "$USER" ]; then - echo "The specified User ID (PUID) of $PUID is invalid; Aborting operation." - exit 1 + if [ -z "$USER" ]; then + echo "The specified User ID (PUID) of $PUID is invalid; Aborting operation." + exit 1 -elif [ -z "$GROUP" ]; then - echo "The specified Group ID (PGID) of $PGID is invalid; Aborting operation." - exit 1 -fi + elif [ -z "$GROUP" ]; then + echo "The specified Group ID (PGID) of $PGID is invalid; Aborting operation." + exit 1 + fi -# Ensure our group has been correctly assigned -usermod -a -G $GROUP $USER &>/dev/null -chmod o+w /dev/stdout /dev/stderr + # Ensure our group has been correctly assigned + usermod -a -G $GROUP $USER &>/dev/null + chmod o+w /dev/stdout /dev/stderr + +else + # + # Non-Root User + # + echo "Apprise API Non-Super User Startup" + USER=$(id -un 2>/dev/null) + GROUP=$(id -gn 2>/dev/null) +fi [ ! -d /attach ] && mkdir -p /attach chown -R $USER:$GROUP /attach -[ ! -d /config ] && mkdir -p /config /config/store +[ ! -d /config/store ] && mkdir -p /config/store chown $USER:$GROUP /config chown -R $USER:$GROUP /config/store [ ! -d /plugin ] && mkdir -p /plugin @@ -91,5 +100,6 @@ cd /opt/apprise # Launch our SupervisorD /usr/local/bin/supervisord -c /opt/apprise/webapp/etc/supervisord.conf + # Always return our SupervisorD return code exit $? From 1ea25e4ed34bf27272207bb1e514f4cfda1b3edf Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Mon, 10 Mar 2025 21:21:30 -0400 Subject: [PATCH 2/4] Upgraded to Python v3.12 --- .gitignore | 3 +++ Dockerfile | 2 +- Dockerfile.py310 => Dockerfile.py312 | 4 ++-- docker-compose.yml | 4 ++-- tox.ini | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) rename Dockerfile.py310 => Dockerfile.py312 (96%) diff --git a/.gitignore b/.gitignore index 610e6b7..4846909 100644 --- a/.gitignore +++ b/.gitignore @@ -68,5 +68,8 @@ target/ #PyCharm .idea +# Dockerfile +docker-compose.yml + # Apprise Gateway Variable/Test Configuration apprise_gw/var/* diff --git a/Dockerfile b/Dockerfile index 46530fa..19829f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim AS base +FROM python:3.12-slim AS base # set version label ARG BUILD_DATE diff --git a/Dockerfile.py310 b/Dockerfile.py312 similarity index 96% rename from Dockerfile.py310 rename to Dockerfile.py312 index 2fc7883..92b7a20 100644 --- a/Dockerfile.py310 +++ b/Dockerfile.py312 @@ -27,7 +27,7 @@ # POSSIBILITY OF SUCH DAMAGE. # Base -FROM python:3.10-buster +FROM python:3.12 RUN apt-get update && \ apt-get install -y --no-install-recommends build-essential musl-dev bash && \ rm -rf /var/lib/apt/lists/* @@ -38,7 +38,7 @@ WORKDIR /apprise-api COPY requirements.txt / COPY dev-requirements.txt / ENV PYTHONPATH /apprise-api -ENV PYTHONPYCACHEPREFIX /apprise-api/__pycache__/py310 +ENV PYTHONPYCACHEPREFIX /apprise-api/__pycache__/py312 RUN pip install --no-cache-dir -r /requirements.txt -r /dev-requirements.txt diff --git a/docker-compose.yml b/docker-compose.yml index a12fd81..47ff073 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,11 +35,11 @@ services: ## ## > Host service (visit http://localhost on host pc to access): ## ./manage.py runserver 0.0.0.0:8000 - test.py310: + test.py312: ports: - 8000:8000 build: context: . - dockerfile: Dockerfile.py310 + dockerfile: Dockerfile.py312 volumes: - ./:/apprise-api diff --git a/tox.ini b/tox.ini index a5e0566..2e7f67e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py311,coverage-report +envlist = py312,coverage-report skipsdist = true [testenv] @@ -14,7 +14,7 @@ commands = coverage run --parallel -m pytest {posargs} apprise_api flake8 apprise_api --count --show-source --statistics -[testenv:py311] +[testenv:py312] deps= -r{toxinidir}/requirements.txt -r{toxinidir}/dev-requirements.txt From 009a4d2a7e57baf55bf7182a14fde6e4e2ee08b4 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Mon, 10 Mar 2025 21:24:09 -0400 Subject: [PATCH 3/4] updated tests cover py3.12 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 084ba5b..4444955 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: # expanded using subsequent `include` items. matrix: os: ["ubuntu-latest"] - python-version: ["3.10"] + python-version: ["3.12"] bare: [false] defaults: From d60b0fcbd3273978b99995bcea06b5d12ec34187 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Mon, 10 Mar 2025 21:27:30 -0400 Subject: [PATCH 4/4] removed test code from docker-compose.yml --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 47ff073..19209e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,11 +35,11 @@ services: ## ## > Host service (visit http://localhost on host pc to access): ## ./manage.py runserver 0.0.0.0:8000 - test.py312: - ports: - - 8000:8000 - build: - context: . - dockerfile: Dockerfile.py312 - volumes: - - ./:/apprise-api + # test.py312: + # ports: + # - 8000:8000 + # build: + # context: . + # dockerfile: Dockerfile.py312 + # volumes: + # - ./:/apprise-api