umap icon indicating copy to clipboard operation
umap copied to clipboard

Added docker support, part 2

Open Duvel opened this issue 5 years ago • 10 comments

This pull request is based on the work of @jezdez in #456, also a mention to msgre/uwsgi_logging@4055e52 for the extra logging.

One now can run docker build --tag umap:1.2.2 . and this will result in a working image for uMap.

Duvel avatar May 15 '20 18:05 Duvel

I have tried to run the command docker build --tag umap:1.2.2 . but I got only the Error unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/sysop/Dockerfile: no such file or directory

What I have to do, that it is working. Or tell me, were I can pull a working docker container. thx.

Paris999 avatar Jul 20 '20 10:07 Paris999

@Paris999 Did you try it with the forked repo?

Duvel avatar Jul 20 '20 14:07 Duvel

Okay now I cloned with git the forked project. and it was starting, in the End it show successfully created. But during the installtion I saw two Error `npm install

[email protected] install /srv/umap/node_modules/mocha-phantomjs/node_modules/phantomjs node install.js

invalid configloglevel="notice" Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 Saving to /srv/umap/node_modules/mocha-phantomjs/node_modules/phantomjs/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2 Receiving...`

and

`Get:159 http://deb.debian.org/debian buster/main amd64 uwsgi amd64 2.0.18-1 [51.6 kB] debconf: delaying package configuration, since apt-utils is not installed

Fetched 124 MB in 12s (10.6 MB/s) Selecting previously unselected package perl-modules-5.28. (Reading database ... 6829 files and directories currently installed.)`

after it was created, I started it with run and start under docker und than I tried to start it, but it is exiting direct again. I don't know if it has something to do with the to errors during the installation. any ideas?

Is it possible to that you load up a working docker image to the docker hub?

Paris999 avatar Jul 21 '20 05:07 Paris999

I think those errors are normal during the build, I didn't even notice them I guess. You need to do more to get the image running then just to run it. You would also need a database and a redis server.

This is the docker stack file, that I use to run it:


version: '3'
services:
  db:
    image: mdillon/postgis:9.6-alpine
    volumes:
      - db:/var/lib/postgresql/data

  redis:
    image: redis:latest

  app:
    image: umap:1.2.2
    environment:
      - DATABASE_URL=postgis://postgres@db/postgres
      - REDIS_URL=redis://redis:6379/0
      - SECRET_KEY=some-long-and-weirdly-unrandom-secret-key
      - ALLOWED_HOSTS=*
      - SITE_URL=https://umap.somewhere.nl/
      - LEAFLET_STORAGE_ALLOW_ANONYMOUS=True
    volumes:
      - SOMEDIR/uploads:/srv/umap/uploads


volumes:
  db:

Duvel avatar Jul 21 '20 19:07 Duvel

whats the status here? I'd like to have a dockerized umap too :)

Loki-Afro avatar Aug 03 '21 15:08 Loki-Afro

mkdir: cannot create directory '/usr/share/man/man1': File exists
The command '/bin/sh -c mkdir /usr/share/man/man1' returned a non-zero code: 1

I'm getting the above error message trying to build the container.

Please merge proper dockerfiles in.

Coo-ops avatar Apr 19 '22 05:04 Coo-ops

mkdir: cannot create directory '/usr/share/man/man1': File exists
The command '/bin/sh -c mkdir /usr/share/man/man1' returned a non-zero code: 1

I'm getting the above error message trying to build the container.

Please merge proper dockerfiles in.

I have the same problem here too

MaxBarbet avatar Jun 08 '22 09:06 MaxBarbet

@Duvel are you still around? Would you mind rebasing?

I think RUN mkdir /usr/share/man/man1 can simply be removed. But they also removed requirements.txt so the build process changes a bit.

micheljung avatar Oct 15 '22 09:10 micheljung

@micheljung I merged the latest changes and was able to create a build. But a lot more has to probably to be done.

ALLOWED_HOSTS is now a list and apparently you need at least postgres 11 for it to run.

Duvel avatar Oct 15 '22 14:10 Duvel

With this docker-compose file and the latest changes from my repo, I have something starting again, but it gives an error.

version: '3'
services:
  db:
    image: duvel/postgis:12-2.5
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - db:/var/lib/postgresql/data

  redis:
    image: redis:latest

  app:
    image: umap:1.2.3
    ports:
      - "8001:8000"
    environment:
      - DATABASE_URL=postgis://postgres@db/postgres
      - REDIS_URL=redis://redis:6379/0
      - SECRET_KEY=some-long-and-weirdly-unrandom-secret-key
      - ALLOWED_HOSTS=[*]
      - SITE_URL=https://umap.somewhere.nl/
      - LEAFLET_STORAGE_ALLOW_ANONYMOUS=True
    volumes:
      - SOMEDIR/uploads:/srv/umap/uploads

volumes:
  db:

I don't know how to solve this error, it seems to do with Django 4.

app_1    | django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'compressor.templatetags.compress': cannot import name 'force_text' from 'django.utils.encoding' (/usr/local/lib/python3.8/site-packages/django/utils/encoding.py)

Duvel avatar Oct 15 '22 15:10 Duvel

Hi all, @Duvel thanks for all the work you've done in this PR.

I wanted to run a uMap instance in a container, but I got stuck with what you have in this PR so far. I took your contribution as an inspiration and built something similar.

I took a little different approach and built the container with the installation tutorial in mind, configuring everything as described in the installation tutorial and taking the latest version (currently 1.2.3) from PyPI. While I see quite some Exception while resolving variable 'x' in template 'y'. lines in the logs, basic functionality works (for me).

If you want to quickly run uMap in a container, feel free to try it out: https://hub.docker.com/r/pommib/umap

pommi avatar Nov 27 '22 13:11 pommi

@Duvel I managed to get the container working by simply replacing the setup.cfg file by the one in the umap repo. Basically it just prevents django >= 4 from being installed, and no errors are thrown. Thank you for your work.

tuxrinku avatar Nov 27 '22 13:11 tuxrinku

@tuxrinku ah, they solved the Django 4 issue a few days ago. I updated my fork so it is included, but now an error has been added in the Makefile, so the Docker build now fails on that.

Duvel avatar Nov 27 '22 14:11 Duvel

@tuxrinku I solved the issue in the Makefile, had to do with a difference with calling cp.

Duvel avatar Nov 27 '22 15:11 Duvel

@pommi nice work, I tried that procedure once, but more work was required then, but I guess with work from this PR it now can be done.

Duvel avatar Nov 27 '22 15:11 Duvel

I updated the Dockerfile to nodejs 18 LTS and removed phantomjs. I also installed tini with the package manager.

It now also can be build for arm64, so it can run on Raspberry Pi and Apple Silicon (M1).

Duvel avatar Nov 27 '22 16:11 Duvel

Question: shouldn't createsuperuser be added to the Dockerfile, or be somehow automated?

xerz-one avatar Jan 27 '23 23:01 xerz-one

Closing in favor of #1121 which is based on this PR. Hopefully we'll land it this time!

yohanboniface avatar Jun 05 '23 12:06 yohanboniface