nginx needs to serve downloads from the media directory.

This commit is contained in:
Roland 2024-10-01 11:30:23 -06:00
parent 04dbca7bb7
commit 00c4e6ece0
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
9 changed files with 12 additions and 15 deletions

View file

@ -18,7 +18,6 @@ cd /opt/wrolpi/app
npm --version npm --version
node --version node --version
npm install npm install
npm run build
# Install Node console commands. # 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 npm i -g serve@12.0.1 single-file-cli@1.1.54 readability-extractor@0.0.6 carto@1.2.0

View file

@ -18,4 +18,4 @@ USER node
RUN npm install RUN npm install
# Run the production build # Run the production build
CMD ["serve", "-s", "build"] CMD ["npm", "run", "start"]

View file

@ -4,7 +4,8 @@ Wants=wrolpi-api.service
PartOf=wrolpi.target PartOf=wrolpi.target
[Service] [Service]
ExecStart=/usr/local/bin/serve -s build -l 5000 # Use development React app
ExecStart=/usr/bin/npm run start
Group=wrolpi Group=wrolpi
User=wrolpi User=wrolpi
WorkingDirectory=/opt/wrolpi/app/ WorkingDirectory=/opt/wrolpi/app/

View file

@ -14,12 +14,12 @@ location /apple-touch-icon.png {
location / { location / {
# React APP # React APP
proxy_pass http://0.0.0.0:5000; proxy_pass http://0.0.0.0:3000;
rewrite $1 break; rewrite $1 break;
} }
location /ws { location /ws {
proxy_pass http://0.0.0.0:5000; proxy_pass http://0.0.0.0:3000;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
@ -69,5 +69,5 @@ location /download {
autoindex on; autoindex on;
autoindex_exact_size off; autoindex_exact_size off;
alias /opt/media; alias /media/wrolpi;
} }

View file

@ -173,13 +173,13 @@ if [ -f /etc/systemd/system/wrolpi-app.service ]; then
fi fi
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" echo "OK: WROLPi app responded with UI"
else else
echo "FAILED: WROLPi app did not respond with UI" echo "FAILED: WROLPi app did not respond with UI"
fi 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" echo "OK: WROLPi app responded with ebook interface"
else else
echo "FAILED: WROLPi app did not respond with ebook interface" echo "FAILED: WROLPi app did not respond with ebook interface"

View file

@ -33,7 +33,7 @@ rsync -a "${SCRIPT_DIR}"/stage2/* "${BUILD_DIR}/stage2/"
# We only need to build the Lite and Desktop images. # We only need to build the Lite and Desktop images.
rm "${BUILD_DIR}"/stage*/EXPORT* 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" echo 'IMG_SUFFIX="-desktop"' > "${BUILD_DIR}/stage5/EXPORT_IMAGE"
# Build the images. # 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) 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. # 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 mv "${BUILD_DIR}"/deploy/*desktop*xz "${SCRIPT_DIR}"/WROLPi-v"${VERSION}"-aarch64-desktop.img.xz
chmod 644 "${SCRIPT_DIR}"/*xz chmod 644 "${SCRIPT_DIR}"/*xz
chown -R 1000:1000 "${SCRIPT_DIR}" chown -R 1000:1000 "${SCRIPT_DIR}"

View file

@ -29,7 +29,7 @@ python3 -m venv /opt/wrolpi/venv
/opt/wrolpi/venv/bin/pip3 install -r /opt/wrolpi/requirements.txt /opt/wrolpi/venv/bin/pip3 install -r /opt/wrolpi/requirements.txt
# Install webapp. # Install webapp.
(cd /opt/wrolpi/app && npm install && npm run build) (cd /opt/wrolpi/app && npm install)
chown -R wrolpi:wrolpi /opt/wrolpi chown -R wrolpi:wrolpi /opt/wrolpi

View file

@ -38,9 +38,6 @@ git config --global --add safe.directory /opt/wrolpi
git reset HEAD --hard git reset HEAD --hard
chown -R wrolpi:wrolpi /opt/wrolpi chown -R wrolpi:wrolpi /opt/wrolpi
# Rebuild the app after reset.
(cd app && npm run build)
# Copy configs to system. # Copy configs to system.
cp /opt/wrolpi/etc/raspberrypios/nginx.conf /etc/nginx/nginx.conf 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 [ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf

View file

@ -1 +1 @@
0.13.0-beta 0.13.1-beta