From 98327336ac4e2b5ea92ba7d7e07a90ba7f41c0f2 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 24 Jan 2021 19:40:00 +0100 Subject: [PATCH] Bump Taarifa to Node.js 8 build --- doc/applications/taarifa.rst | 35 ++++++++++++++++++++++++++++++++--- lxc-apps/taarifa/app | 4 ++-- lxc-apps/taarifa/image | 4 ++-- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/doc/applications/taarifa.rst b/doc/applications/taarifa.rst index 4784697..11eb34a 100644 --- a/doc/applications/taarifa.rst +++ b/doc/applications/taarifa.rst @@ -31,7 +31,33 @@ Data need to be prepopulated before the application can be used for the first ti Frontend build -------------- -Frontend requires ancient verions of packages to work correctly. Following sequence produces usable dist directory on Debian 10. +Frontend requires Node.js 8, ancient verions of packages, and a bunch of patches to work correctly. Following sequence produces usable dist directory on Debian 10. + +.. code-block:: bash + + # Install build packages + apt-get update + apt-get -y install build-essential git libpng-dev xz-utils wget + + # Install Node.js 8 + mkdir /usr/local/lib/nodejs ~/.npm-global + wget https://nodejs.org/dist/latest-v8.x/node-v8.17.0-linux-x64.tar.xz -O - | tar -xJf - -C /usr/local/lib/nodejs + export PATH=~/.npm-global/bin:/usr/local/lib/nodejs/node-v8.17.0-linux-x64/bin:${PATH} + npm config set prefix '~/.npm-global' + + # Clone Taarifa Waterpoints + git clone https://github.com/trendspotter/TaarifaWaterpoints.git /tmp/taarifa + cd /tmp/taarifa + git cherry-pick -n 0650b76314133bee8f2a7421ecacfb1c1c572aa8 # Install leaflet-maskcanvas which still supports L.TileLayer.MaskCanvas + git cherry-pick -n 8576a9d038baf9fd959a948501d1ccf6b3acfaad # Fail gracefully when geolocation fails + git cherry-pick -n 219814faaa9bfd1ec4edb0afc2580ce8d1bc5dfd # Add Czech translation + + # Install NPM packages + export HOME=/root + npm install + ./node_modules/.bin/grunt build --verbose + +Should some problems occur using this approach, there is a possibility to revert to the once-working codebase from ~2015 and build frontend using Node.js 4. .. code-block:: bash @@ -46,10 +72,13 @@ Frontend requires ancient verions of packages to work correctly. Following seque export PATH=/usr/local/lib/nodejs/node-v4.9.1-linux-x64/bin:${PATH} # Clone Taarifa Waterpoints - git clone https://github.com/taarifa/TaarifaWaterpoints.git /tmp/taarifa + git clone https://github.com/trendspotter/TaarifaWaterpoints.git /tmp/taarifa cd /tmp/taarifa git checkout 7d0c784eb01b811e65c829796c88d9367f8fa5f7 - git cherry-pick -n 984a6353f8b50e9f7f643d22e5c77ad0eb352bcb + git cherry-pick -n 984a6353f8b50e9f7f643d22e5c77ad0eb352bcb # Load tiles via https + git cherry-pick -n 0650b76314133bee8f2a7421ecacfb1c1c572aa8 # Install leaflet-maskcanvas which still supports L.TileLayer.MaskCanvas + git cherry-pick -n 8576a9d038baf9fd959a948501d1ccf6b3acfaad # Fail gracefully when geolocation fails + git cherry-pick -n 219814faaa9bfd1ec4edb0afc2580ce8d1bc5dfd # Add Czech translation # Install NPM packages export HOME=/root diff --git a/lxc-apps/taarifa/app b/lxc-apps/taarifa/app index 6dc2715..57675e0 100644 --- a/lxc-apps/taarifa/app +++ b/lxc-apps/taarifa/app @@ -1,5 +1,5 @@ { - "version": "0.2.0-210123", + "version": "0.2.0-210124", "meta": { "title": "Taarifa Waterpoints", "desc-cs": "Systém správy mapování vodních bodů", @@ -8,7 +8,7 @@ }, "containers": { "taarifa": { - "image": "taarifa_0.2.0-210123", + "image": "taarifa_0.2.0-210124", "depends": [ "taarifa-mongodb" ] diff --git a/lxc-apps/taarifa/image b/lxc-apps/taarifa/image index 664ff89..3379662 100644 --- a/lxc-apps/taarifa/image +++ b/lxc-apps/taarifa/image @@ -1,4 +1,4 @@ -IMAGE taarifa_0.2.0-210123 +IMAGE taarifa_0.2.0-210124 FROM alpine3.12-python3.8_3.8.5-210106 RUN EOF @@ -10,7 +10,7 @@ RUN EOF # Install Taarifa mkdir /srv/taarifa - wget https://github.com/trendspotter/TaarifaWaterpoints/releases/download/0.2-hybrid/0.2-hybrid.tar.xz -O - | tar xJf - -C /srv/taarifa + wget https://github.com/trendspotter/TaarifaWaterpoints/releases/download/0.2/TaarifaWaterpoints-0.2.tar.xz -O - | tar xJf - -C /srv/taarifa pip3 install -r /srv/taarifa/requirements.txt mv src/taarifaapi/taarifa_api /usr/lib/python3.8/site-packages/taarifa_api