diff --git a/app/serve.json b/app/serve.json new file mode 100644 index 00000000..9d0ade3c --- /dev/null +++ b/app/serve.json @@ -0,0 +1,13 @@ +{ + "rewrites": [ + { + "source": "/epub/epub.html", + "destination": "/epub/epub.html" + }, + { + "source": "**", + "destination": "/index.html" + } + ], + "cleanUrls": false +} \ No newline at end of file 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 326b9325..73d8fe45 100644 --- a/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot +++ b/debian-live-config/config/hooks/normal/9999-wrolpi.hook.chroot @@ -18,6 +18,7 @@ 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@2.0.73 readability-extractor@0.0.6 carto@1.2.0 diff --git a/etc/raspberrypios/wrolpi-app.service b/etc/raspberrypios/wrolpi-app.service index 1483bb14..51bc0bec 100644 --- a/etc/raspberrypios/wrolpi-app.service +++ b/etc/raspberrypios/wrolpi-app.service @@ -4,8 +4,8 @@ Wants=wrolpi-api.service PartOf=wrolpi.target [Service] -# Use development React app -ExecStart=/usr/bin/npm run start +# Use explicit `serve.json` so `epub.html` is not lost. +ExecStart=/usr/local/bin/serve build -l 3000 -c /opt/wrolpi/app/serve.json Group=wrolpi User=wrolpi WorkingDirectory=/opt/wrolpi/app/ diff --git a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh index a9e5a127..e28118af 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) +(cd /opt/wrolpi/app && npm install && npm run build) chown -R wrolpi:wrolpi /opt/wrolpi