Joxit / docker-kosmtik

Light docker for ksomtik https://github.com/kosmtik/kosmtik
https://joxit.dev/docker-kosmtik/
Apache License 2.0
10 stars 3 forks source link

Building kosmtik Docker image gives error on plugins #5

Closed mrg12 closed 5 years ago

mrg12 commented 5 years ago

When I clone this master and try to build the Docker image as instructed in Readme I get an error when it tries to install the kosmtik plugins (I am especially interested in kosmtik-mbtiles-export). I do understand that this repository is 2 years old already but I hoped that Docker image could still be build.

The error I get is:

`[Core] No usable config file found in /root/.config/kosmtik.yml [Core] Loading plugin from ../plugins/base-exporters/index.js [Core] Loading plugin from ../plugins/hash/index.js [Core] Loading plugin from ../plugins/local-config/index.js [Core] Loading plugin from ../plugins/datasource-loader/index.js [Core] Starting installation of kosmtik-mbtiles-export /opt/kosmtik/node_modules/npm/node_modules/bluebird/js/release/async.js:61 fn = function () { throw arg; }; ^

TypeError: Cannot convert undefined or null to object at /opt/kosmtik/src/back/PluginsManager.js:100:38`

I think this has to do with the version of node. The build script installs node with apt but then you probably get the wrong (too new) version. I changed the script to install nvm and with that older versions of node. But still I get the same error. When I go below v6 of node I get a different error:

npm ERR! Linux 4.15.0-46-generic npm ERR! argv "/root/.nvm/versions/node/v5.12.0/bin/node" "/root/.nvm/versions/node/v5.12.0/bin/npm" "install" "--production" npm ERR! node v5.12.0 npm ERR! npm v3.8.6 npm ERR! code ELIFECYCLE

When I use the already build image the plugin seems to be installed but when I use it for mbtiles export I get the following error:

water.mss:252:6 The font 'Noto Sans Italic, Noto Sans Regular, Noto Sans CJK JP Regular, Noto Sans Adlam Regular, Noto Sans Adlam Unjoined Regular, Noto Sans Balinese Regular, Noto Sans Bamum Regular, Noto Sans Batak Regular, Noto Sans Bengali UI Regular, Noto Sans Buginese Regular, Noto Sans Buhid Regular, Noto Sans Canadian Aboriginal Regular, Noto Sans Chakma Regular, Noto Sans Cham Regular, Noto Sans Cherokee Regular, Noto Sans Coptic Regular, Noto Sans Devanagari UI Regular, Noto Sans Ethiopic Regular, Noto Sans Georgian Regular, Noto Sans Gujarati UI Regular, Noto Sans Gurmukhi UI Regular, Noto Sans Hanunoo Regular, Noto Sans Hebrew Regular, Noto Sans Javanese Regular, Noto Sans Kannada UI Regular, Noto Sans Kayah Li Regular, Noto Sans Khmer UI Regular, Noto Sans Lao UI Regular, Noto Sans Lepcha Regular, Noto Sans Limbu Regular, Noto Sans Lisu Regular, Noto Sans Malayalam UI Regular, Noto Sans Mandaic Regular, Noto Sans Mongolian Regular, Noto Sans Myanmar UI Regular, Noto Sans New Tai Lue Regular, Noto Sans NKo Regular, Noto Sans Ol Chiki Regular, Noto Sans Oriya UI Regular, Noto Sans Osage Regular, Noto Sans Osmanya Regular, Noto Sans Samaritan Regular, Noto Sans Saurashtra Regular, Noto Sans Shavian Regular, Noto Sans Sinhala UI Regular, Noto Sans Sinhala Regular, Noto Sans Sundanese Regular, Noto Sans Symbols Regular, Noto Sans Symbols2 Regular, Noto Sans Syriac Eastern Regular, Noto Sans Tagalog Regular, Noto Sans Tagbanwa Regular, Noto Sans Tai Le Regular, Noto Sans Tai Tham Regular, Noto Sans Tai Viet Regular, Noto Sans Tamil UI Regular, Noto Sans Telugu UI Regular, Noto Sans Thaana Regular, Noto Sans Thai UI Regular, Noto Sans Tibetan Regular, Noto Sans Tifinagh Regular, Noto Sans Vai Regular, Noto Sans Yi Regular, Noto Sans Arabic UI Regular, Noto Emoji Regular, Noto Naskh Arabic UI Regular, DejaVu Sans Book, HanaMinA Regular, HanaMinB Regular, Unifont Medium, unifont Medium, Unifont Upper Medium' (specified as text-face-name) is not a known font on your system, please provide an existing font face name. at Object.env.error (/opt/kosmtik/node_modules/carto/lib/carto/parser.js:249:55) at Rule.tree.Rule.toXML (/opt/kosmtik/node_modules/carto/lib/carto/tree/rule.js:98:28) at Definition.tree.Definition.symbolizersToXML (/opt/kosmtik/node_modules/carto/lib/carto/tree/definition.js:145:39) at Definition.tree.Definition.toXML (/opt/kosmtik/node_modules/carto/lib/carto/tree/definition.js:218:33) at /opt/kosmtik/node_modules/carto/lib/carto/tree/style.js:40:27 at Array.map (native) at Object.tree.StyleXML (/opt/kosmtik/node_modules/carto/lib/carto/tree/style.js:39:29) at Renderer.render (/opt/kosmtik/node_modules/carto/lib/carto/renderer.js:180:43) at Carto.render (/opt/kosmtik/src/back/renderer/Carto.js:20:45) at Project.render (/opt/kosmtik/src/back/Project.js:58:25)

I will try to install these fonts (shouldn't they already be on the image?)

Do you (I only see a single maintainer) have any suggestions?

Joxit commented 5 years ago

Hi,

Oh, that's weird, this may be a kosmtik issue, I will try to check this. The image does not contain any fonts. If you want your own fonts you can see this issue : #3 or the readme here (docker option -v /usr/share/fonts:/usr/share/fonts:ro)

Joxit commented 5 years ago

This is a kosmtik issue with npm

mrg218 commented 5 years ago

I got your docker build working again. If you replace in your Dockerfile the line && curl -sL https://github.com/kosmtik/kosmtik/archive/master.tar.gz | tar xz --strip-components=1 \ with && curl -sL https://github.com/kosmtik/kosmtik/archive/0.0.16.tar.gz | tar xz --strip-components=1 \ it works again (is the same version as when you originally built the docker image)

However when I use it I can generate many tiles with plugin kosmtik-mbtiles-export but from time to time I get: Error: failed to read invalid png: 'Read Error'

I think this is something that goes wrong in Mapnik with multithreading.

This is why I am really interested in a new version of your kosmtik Docker that uses the current master of kosmtik (as it uses a newer version of Mapnik in which I think/hope the issues has been fixed). Do you have any plans to update it?

mrg218 commented 5 years ago

I also added required fonts to the image by adding the following lines to the Dockerfile (but it makes the resulting image rather big):

&& apt-get install wget \
&& apt-get install unzip \
&& apt-get install -y fontconfig \
&& apt-get install -y git \
&& apt-get install -y fonts-hanazono \
&& apt-get install -y ttf-unifont \
&& mkdir -p /usr/share/fonts/opentype/noto \
&& wget https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip \
&& unzip Noto-hinted.zip \
&& mkdir -p /usr/share/fonts/opentype/noto \
&& mv *otf *ttf /usr/share/fonts/opentype/noto \
&& rm Noto-hinted.zip \
&& fc-cache -f -v \
Joxit commented 5 years ago

I updated kosmtik to v0.0.17 and the build is passing, it will be mapnik 3.7.2. There is still a issue on master.