From 00c4e6ece077e4d127aa0c9524d46e755944b5d6 Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 1 Oct 2024 11:30:23 -0600 Subject: [PATCH] nginx needs to serve downloads from the media directory. --- .../config/hooks/normal/9999-wrolpi.hook.chroot | 1 - docker/app/Dockerfile | 2 +- etc/raspberrypios/wrolpi-app.service | 3 ++- etc/raspberrypios/wrolpi.conf | 6 +++--- help.sh | 4 ++-- pi-gen/build.sh | 4 ++-- pi-gen/stage2/04-wrolpi/03-run-chroot.sh | 2 +- repair.sh | 3 --- wrolpi/version.txt | 2 +- 9 files changed, 12 insertions(+), 15 deletions(-) diff --git a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot index ed8ade33..36ed8660 100644 --- a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot +++ b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot @@ -18,7 +18,6 @@ cd /opt/wrolpi/app npm --version node --version npm install -npm run build # Install Node console commands. npm i -g serve@12.0.1 single-file-cli@1.1.54 readability-extractor@0.0.6 carto@1.2.0 diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 9933492f..1fe35e55 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -18,4 +18,4 @@ USER node RUN npm install # Run the production build -CMD ["serve", "-s", "build"] +CMD ["npm", "run", "start"] diff --git a/etc/raspberrypios/wrolpi-app.service b/etc/raspberrypios/wrolpi-app.service index 4f6c5e49..d6306830 100644 --- a/etc/raspberrypios/wrolpi-app.service +++ b/etc/raspberrypios/wrolpi-app.service @@ -4,7 +4,8 @@ Wants=wrolpi-api.service PartOf=wrolpi.target [Service] -ExecStart=/usr/local/bin/serve -s build -l 5000 +# Use development React app +ExecStart=/usr/bin/npm run start Group=wrolpi User=wrolpi WorkingDirectory=/opt/wrolpi/app/ diff --git a/etc/raspberrypios/wrolpi.conf b/etc/raspberrypios/wrolpi.conf index a6eb2530..b911d7c7 100644 --- a/etc/raspberrypios/wrolpi.conf +++ b/etc/raspberrypios/wrolpi.conf @@ -14,12 +14,12 @@ location /apple-touch-icon.png { location / { # React APP - proxy_pass http://0.0.0.0:5000; + proxy_pass http://0.0.0.0:3000; rewrite $1 break; } location /ws { - proxy_pass http://0.0.0.0:5000; + proxy_pass http://0.0.0.0:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; @@ -69,5 +69,5 @@ location /download { autoindex on; autoindex_exact_size off; - alias /opt/media; + alias /media/wrolpi; } diff --git a/help.sh b/help.sh index c303aad2..9ebf0c46 100755 --- a/help.sh +++ b/help.sh @@ -173,13 +173,13 @@ if [ -f /etc/systemd/system/wrolpi-app.service ]; then fi fi -if curl -s http://0.0.0.0:5000 | grep -i wrolpi >/dev/null; then +if curl -s http://0.0.0.0:3000 | grep -i wrolpi >/dev/null; then echo "OK: WROLPi app responded with UI" else echo "FAILED: WROLPi app did not respond with UI" fi -if curl -s http://0.0.0.0:5000/epub/epub.html | grep -i epub.js >/dev/null; then +if curl -s http://0.0.0.0:3000/epub/epub.html | grep -i epub.js >/dev/null; then echo "OK: WROLPi app responded with ebook interface" else echo "FAILED: WROLPi app did not respond with ebook interface" diff --git a/pi-gen/build.sh b/pi-gen/build.sh index 148f578d..ebd5a627 100755 --- a/pi-gen/build.sh +++ b/pi-gen/build.sh @@ -33,7 +33,7 @@ rsync -a "${SCRIPT_DIR}"/stage2/* "${BUILD_DIR}/stage2/" # We only need to build the Lite and Desktop images. rm "${BUILD_DIR}"/stage*/EXPORT* -echo 'IMG_SUFFIX="-lite"' > "${BUILD_DIR}/stage2/EXPORT_IMAGE" +#echo 'IMG_SUFFIX="-lite"' > "${BUILD_DIR}/stage2/EXPORT_IMAGE" echo 'IMG_SUFFIX="-desktop"' > "${BUILD_DIR}/stage5/EXPORT_IMAGE" # Build the images. @@ -45,7 +45,7 @@ grep "03-run-chroot.sh completed" "${SCRIPT_DIR}/build.log" >/dev/null 2>&1 || ( grep "04-run-chroot.sh completed" "${SCRIPT_DIR}/build.log" >/dev/null 2>&1 || (echo "script 4 failed!" && exit 1) # Move the built images out of the build directory. -mv "${BUILD_DIR}"/deploy/*lite*xz "${SCRIPT_DIR}"/WROLPi-v"${VERSION}"-aarch64-lite.img.xz +#mv "${BUILD_DIR}"/deploy/*lite*xz "${SCRIPT_DIR}"/WROLPi-v"${VERSION}"-aarch64-lite.img.xz mv "${BUILD_DIR}"/deploy/*desktop*xz "${SCRIPT_DIR}"/WROLPi-v"${VERSION}"-aarch64-desktop.img.xz chmod 644 "${SCRIPT_DIR}"/*xz chown -R 1000:1000 "${SCRIPT_DIR}" diff --git a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh index eb74cb8a..3f11d01a 100755 --- a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh @@ -29,7 +29,7 @@ python3 -m venv /opt/wrolpi/venv /opt/wrolpi/venv/bin/pip3 install -r /opt/wrolpi/requirements.txt # Install webapp. -(cd /opt/wrolpi/app && npm install && npm run build) +(cd /opt/wrolpi/app && npm install) chown -R wrolpi:wrolpi /opt/wrolpi diff --git a/repair.sh b/repair.sh index cf45d48c..a0b02acd 100755 --- a/repair.sh +++ b/repair.sh @@ -38,9 +38,6 @@ git config --global --add safe.directory /opt/wrolpi git reset HEAD --hard chown -R wrolpi:wrolpi /opt/wrolpi -# Rebuild the app after reset. -(cd app && npm run build) - # Copy configs to system. cp /opt/wrolpi/etc/raspberrypios/nginx.conf /etc/nginx/nginx.conf [ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf diff --git a/wrolpi/version.txt b/wrolpi/version.txt index b2458ba4..1fe26a9e 100644 --- a/wrolpi/version.txt +++ b/wrolpi/version.txt @@ -1 +1 @@ -0.13.0-beta \ No newline at end of file +0.13.1-beta \ No newline at end of file