diff --git a/Dockerfile b/Dockerfile index 1c0ce92..cff09e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,4 +42,4 @@ RUN apt-get remove -y wget && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "--capture-output", "aperisolve.wsgi:application"] +CMD ["sh", "-c", "rm -rf /aperisolve/results/* && gunicorn -w 4 -b 0.0.0.0:5000 --access-logfile - --error-logfile - --log-level info --capture-output aperisolve.wsgi:application"] diff --git a/aperisolve/static/js/aperisolve.js b/aperisolve/static/js/aperisolve.js index 0090c17..0294ead 100644 --- a/aperisolve/static/js/aperisolve.js +++ b/aperisolve/static/js/aperisolve.js @@ -486,7 +486,9 @@ if (browseBtn) { } catch (e) { showDanger("❌ Invalid server response.", true); } - } else { + } else if (xhr.status == 413) { + showDanger("❌ File too large. Please upload a smaller file.", true); + }else { showDanger(`❌ HTTP error ${xhr.status}`, true); } progressBar.style.width = "100%"; diff --git a/compose.dev.yml b/compose.dev.yml index df6e5c2..9df9dea 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -4,14 +4,13 @@ services: build: . container_name: aperisolve-web restart: always - command: ["flask", "--app", "aperisolve.app", "run", "--host=0.0.0.0", "--port=5000"] + command: ["/bin/sh", "-c", "rm -rf /aperisolve/results/* && flask --app aperisolve.app run --host=0.0.0.0 --port=5000"] + #command: ["/bin/sh", "-c", "flask --app aperisolve.app run --host=0.0.0.0 --port=5000"] ports: - "5000:5000" volumes: - ./aperisolve:/aperisolve - # Commented tmpfs for development to allow persistent results during code changes - tmpfs: - - /aperisolve/results + - apresults:/aperisolve/results # Shared named volume (renamed) depends_on: postgres: condition: service_healthy @@ -30,12 +29,11 @@ services: build: . container_name: aperisolve-worker restart: always - command: rq worker default --url redis://redis:6379/0 + command: ["/bin/sh", "-c", "rm -rf /aperisolve/results/* && rq worker default --url redis://redis:6379/0"] + #command: ["/bin/sh", "-c", "rq worker default --url redis://redis:6379/0"] volumes: - ./aperisolve:/aperisolve - # Commented tmpfs for development to allow persistent results during code changes - tmpfs: - - /aperisolve/results + - apresults:/aperisolve/results # Shared named volume (renamed) depends_on: - redis - postgres @@ -56,9 +54,9 @@ services: image: postgres:18 container_name: postgres restart: always - # Commented tmpfs for development to allow persistent results during code changes - tmpfs: - - /var/lib/postgresql + entrypoint: ["/bin/sh", "-c", "rm -rf /var/lib/postgresql/* && docker-entrypoint.sh postgres"] + volumes: + - pgdata:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U aperiuser -d aperisolve"] interval: 5s @@ -67,7 +65,6 @@ services: env_file: - .env - rqdashboard: image: eoranged/rq-dashboard container_name: rq-dashboard @@ -78,3 +75,7 @@ services: - redis env_file: - .env + +volumes: + apresults: + pgdata: diff --git a/compose.yml b/compose.yml index 1191cae..afa902f 100644 --- a/compose.yml +++ b/compose.yml @@ -39,11 +39,12 @@ services: - .env postgres: - image: postgres:14 + image: postgres:18 container_name: postgres restart: always - tmpfs: - - /var/lib/postgresql + entrypoint: ["/bin/sh", "-c", "rm -rf /var/lib/postgresql/* && docker-entrypoint.sh postgres"] + volumes: + - pgdata:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U aperiuser -d aperisolve"] interval: 5s @@ -69,3 +70,7 @@ services: - redis env_file: - .env + +volumes: + apresults: + pgdata: