Bump Taarifa to Node.js 8 build

This commit is contained in:
Disassembler 2021-01-24 19:40:00 +01:00
parent 89c4e2e88f
commit 98327336ac
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
3 changed files with 36 additions and 7 deletions

View File

@ -31,7 +31,33 @@ Data need to be prepopulated before the application can be used for the first ti
Frontend build 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 .. 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} export PATH=/usr/local/lib/nodejs/node-v4.9.1-linux-x64/bin:${PATH}
# Clone Taarifa Waterpoints # 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 cd /tmp/taarifa
git checkout 7d0c784eb01b811e65c829796c88d9367f8fa5f7 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 # Install NPM packages
export HOME=/root export HOME=/root

View File

@ -1,5 +1,5 @@
{ {
"version": "0.2.0-210123", "version": "0.2.0-210124",
"meta": { "meta": {
"title": "Taarifa Waterpoints", "title": "Taarifa Waterpoints",
"desc-cs": "Systém správy mapování vodních bodů", "desc-cs": "Systém správy mapování vodních bodů",
@ -8,7 +8,7 @@
}, },
"containers": { "containers": {
"taarifa": { "taarifa": {
"image": "taarifa_0.2.0-210123", "image": "taarifa_0.2.0-210124",
"depends": [ "depends": [
"taarifa-mongodb" "taarifa-mongodb"
] ]

View File

@ -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 FROM alpine3.12-python3.8_3.8.5-210106
RUN EOF RUN EOF
@ -10,7 +10,7 @@ RUN EOF
# Install Taarifa # Install Taarifa
mkdir /srv/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 pip3 install -r /srv/taarifa/requirements.txt
mv src/taarifaapi/taarifa_api /usr/lib/python3.8/site-packages/taarifa_api mv src/taarifaapi/taarifa_api /usr/lib/python3.8/site-packages/taarifa_api