tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.12k stars 527 forks source link

Create Docker for Tilemill releases #2742

Open csytsma opened 3 years ago

csytsma commented 3 years ago

Goal: Create a Docker image for Tilemill that works for Ubuntu, MacOS and Windows. This will help with new users to be able to easily setup and start using Tilemill.

Do we have any takers that can help create the Docker image, and add it to the repo?

apbarratt commented 3 years ago

Working on this. Once I have something actually usable, I'll come back here and figure out what the best way to contribute it will be.

apbarratt commented 3 years ago

I should probably point out that whilst I was aiming to make it reusable, it was really just a personal project so will likely need some one to fork it to make it a little more polished for sharing around =D

csytsma commented 3 years ago

@apbarratt This will be great. I have some co-workers that are big Docker users, so I'm sure I can get one of them to help "productionize" anything you create.

apbarratt commented 3 years ago

Have we a discord server anywhere for when I have quicky questions to ask? :)

csytsma commented 3 years ago

We don't. I've thought about setting up a Slack instance. I'd prefer Slack over discord. Would that work?

csytsma commented 3 years ago

@apbarratt Take a look at #2736, the Dockerfile may have already been created by someone.

apbarratt commented 3 years ago

Oh yes, there's a few of them around. But I'm wanting something a little friendlier. Something that'll just host the lot of port 80 and have the database and OSM-bright etc already there, ready to go. It's the last bit I'm finding tricky.

apbarratt commented 3 years ago

Here's the basic tilemill anyway. All runs using port 80, so once it's running, you can just have it loaded up by going to localhost in your browser. https://github.com/apbarratt/docker_tilemill

Stoiker commented 3 years ago

Thanks @apbarratt for your work! I am currently trying to reduce the overall image size and to create a version that will also work with podman. As one migh have guessed, the change to alpine is not straightforward and maybe someone can help me out here.

Out of the box, one runs into linker issues:

Error: Error relocating /tilemill/node_modules/gdal/lib/binding/node-v57-linux-x64/gdal.node: __printf_chk: symbol not found

which can/should be solved when building gdal explicitly with shared libs npm install gdal --build-from-source --shared_gdal

Which would install the most up to date version and that relies on node v 10++ Use of a specific version npm install gdal@0.8.0 --build-from-source --shared_gdal only leads to futher compile errors with gyp

TypeError: write() argument must be str, not bytes while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 5.13.15-100.fc33.x86_64 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tilemill/node_modules/mapnik/lib/binding/mapnik.node" "--module_name=mapnik" "--module_path=/tilemill/node_modules/mapnik/lib/binding" gyp ERR! cwd /tilemill/node_modules/mapnik gyp ERR! node -v v8.17.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok

Since I am lacking experience with the whole node dependency stack, can someone point me into the right direction? Thx

xycarto commented 3 years ago

@csytsma Regarding your question about Slack from 15 June. That would be helpful at least for me

Stoiker commented 2 years ago

Just to let you know, I dumped the alpine approach and settled for a two stage build with node and node-slim images. PR can be found here: https://github.com/tilemill-project/tilemill/pull/2748

Also, could someone verify if this setup is working for them as well? I tested it with Docker under Ubuntu 20.04.03 in a VM.

xycarto commented 2 years ago

I set up and tested this on Ubuntu 20.04. No VM.

Did as suggested in README:

git clone https://github.com/tilemill-project/tilemill.git
cd tilemill
docker-compose up

No issues. Runs great. Connections to my PostgreSQL databases work as expected.

Great job

Stoiker commented 2 years ago

@xycarto great! Thx for testing!

SaidAlSouti commented 2 years ago

Tested on Mac apple silicon. It shows error when running docker-compose Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/app/node_modules/mapnik/lib/binding/mapnik.node --module_name=mapnik --module_path=/usr/src/app/node_modules/mapnik/lib/binding' (1)

Stoiker commented 2 years ago

Hi @SaidAlSouti thx for your comment. Sadly, I don't own an apple silicon based device, hence I can not verify this issue. Can you post more output (if there is anything meaningful regarding the mapnik issue)?

csytsma commented 2 years ago

PR #2758 was created to fix Apple M1 issue, hoping someone on this thread can test and verify the fix.