3liz / lizmap-docker-compose

Run Lizmap stack with docker-compose
31 stars 42 forks source link

lizmap-docker-compose error #9

Closed frazucca closed 3 years ago

frazucca commented 3 years ago

Hi, after the last twitter by Nicolas Boisteault (22.jan) I give a try to lizmap-docker-compose stack solution. But I get the following error message after the make start

_lizmap_1 | + su -c 'php /scripts/script.php jcommunity~user:create -v --no-error-if-exists --admin --reset admin' lizmap_1 | Could not open input file: /scripts/script.php lizmap-docker-compose-master_lizmap1 exited with code 1

Ubuntu 19.04 docker --version Docker version 19.03.6, build 369ce74a3c docker-compose --version docker-compose version 1.23.2, build 1110ad01

Any hints?

ciao fz

dmarteau commented 3 years ago

Sorry but I cannot reproduce the problem (Ubuntu 18.04, Docker version 20.10.2, build 2291f61).

@frazucca check the execution and directory permissions.

dmarteau commented 3 years ago

/scripts/script.php

This path seems weird to me, check your docker-compose configuration:

make env
docker-compose config
frazucca commented 3 years ago

Mercì David, I made the .env (make env) and check, as you suggest, the docker-compose config and seems correct:

_franz@franz-Z97X-Gaming-G1:~/test_docker/lizmap-docker-compose$ docker-compose config services: lizmap: command:

Again I redo make start but after a while start a loop around that

_lizmap_1 | Could not open input file: /scripts/script.php lizmap-docker-compose_lizmap_1 exited with code 1 lizmap_1 | + chown -R 1000:1000 lizmap/www lizmap_1 | + update-config.php lizmap_1 | + php lizmap/install/installer.php lizmap_1 | Installation start.. lizmap_1 | [notice] Installation starts for the entry point index lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point index lizmap_1 | [notice] Installation starts for the entry point admin lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point admin lizmap_1 | [notice] Installation starts for the entry point script lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point script lizmap_1 | Installation ended. lizmap_1 | + sh lizmap/install/set_rights.sh 1000 1000 lizmap_1 | + sh lizmap/install/clean_vartmp.sh lizmap_1 | + dirname /srv/lizmap lizmap_1 | + mkdir -p /srv lizmap_1 | + ln -sf /www/lizmap /srv/lizmap lizmap_1 | + sed -i '/^user =/c\user = 1000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^group =/c\group = 1000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^listen =/c\listen = 9000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.max_children =/c\pm.max_children = 50' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.start_servers =/c\pm.start_servers = 5' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.min_spare_servers =/c\pm.min_spare_servers = 5' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.max_spare_servers =/c\pm.max_spare_servers = 35' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm =/c\pm = dynamic' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.max_requests =/c\pm.max_requests = 100' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.process_idle_timeout =/c\pm.process_idle_timeout = 10s' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.status_path /c\pm.status_path = /status' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^session.cookie_httponly =/c\session.cookie_httponly = 1' /etc/php7/php.ini lizmap_1 | + sed -i '/^;clear_env =/c\clear_env = no' /etc/php7/php-fpm.d/www.conf lizmap_1 | + '[' php-fpm '!=' php-fpm ] lizmap_1 | + '[' php-fpm '==' php-fpm ] lizmap_1 | + shift lizmap_1 | + set -- php-fpm7 -F -O lizmap_1 | + source= lizmap_1 | + '[' '==' ] lizmap_1 | + source=default lizmap_1 | + '[' default '==' random ] lizmap_1 | + '[' default '==' __reset ] lizmap_1 | + '[' default '==' default ] lizmap_1 | + su -c 'php /scripts/script.php jcommunity~user:create -v --no-error-if-exists --admin --reset admin' lizmap_1 | Could not open input file: /scripts/script.php lizmap-docker-compose_lizmap_1 exited with code 1_

I hope this may help to debug the trouble.

Thank

frazucca commented 3 years ago

Hi, I add the return message from make clean cause it may be useful for debug

_franz@franz-Z97X-Gaming-G1:~/test_docker/lizmap-docker-compose-master$ make clean docker-compose stop || true ................................. ................................. ................................ rm -rf /home/franz/test_docker/lizmap-docker-compose-master/lizmap/www/ rm -rf /home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/ rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/lizmap-config': Permission denied rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/lizmap-db': Permission denied rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/lizmap-theme-config': Permission denied rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/log/nginx/lizmap_access.log': Permission denied rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/log/nginx/access.log': Permission denied rm: cannot remove '/home/franz/test_docker/lizmap-docker-compose-master/lizmap/var/log/nginx/lizmap_error.log': Permission denied rm: cannot remove '/home/franz/testdocker/lizmap-docker-compose-master/lizmap/var/log/nginx/error.log': Permission denied make: *** [Makefile:59: clean] Error 1

fz

nboisteault commented 3 years ago

@dmarteau Could it be due to the user executing the script not in docker group?

nboisteault commented 3 years ago

@frazucca Did you run docker-compose with sudo? Look at docker documentation to have more information => https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

dmarteau commented 3 years ago

This is because the nginx container is running as root - something that has to be fixed - and log files are written with root permissions.

But the others files should not be mounted as root: @frazucca, delete manually all the files with sudo (with care) and rerun make clean.

frazucca commented 3 years ago

@nboisteault @dmarteau

1) I've checked and my user franz it's in docker group (id -Gn "franz" | grep -c "docker" return 1)

2) No, I didn't use sudo

3) I use sudo make clean

In your opinion I can set some user directive in the docker-compose.yml in order to run nginx container not as root?

ciao fz

dmarteau commented 3 years ago

I have commited a fix for nginx 03a06b567e196dbbd833ebe718c5b3a49cddae64.

@frazucca With this fix no directory should be created as root.

frazucca commented 3 years ago

@dmarteau mercì I've tried it immediately and of course no directory under root ownership, apart the wps-data, correct?

But unfortunately I get the same behavior in loop (below) during the make start processes.

_lizmap-docker-compose-master_lizmap_1 exited with code 1 lizmap_1 | + chown -R 1000:1000 lizmap/www lizmap_1 | + update-config.php lizmap_1 | + php lizmap/install/installer.php lizmap_1 | Installation start.. lizmap_1 | [notice] Installation starts for the entry point index lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point index lizmap_1 | [notice] Installation starts for the entry point admin lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point admin lizmap_1 | [notice] Installation starts for the entry point script lizmap_1 | All modules dependencies are ok lizmap_1 | All modules are installed or upgraded for the entry point script lizmap_1 | Installation ended. lizmap_1 | + sh lizmap/install/set_rights.sh 1000 1000 lizmap_1 | + sh lizmap/install/clean_vartmp.sh lizmap_1 | + dirname /srv/lizmap lizmap_1 | + mkdir -p /srv lizmap_1 | + ln -sf /www/lizmap /srv/lizmap lizmap_1 | + sed -i '/^user =/c\user = 1000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^group =/c\group = 1000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^listen =/c\listen = 9000' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.max_children =/c\pm.max_children = 50' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.start_servers =/c\pm.start_servers = 5' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.min_spare_servers =/c\pm.min_spare_servers = 5' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm.max_spare_servers =/c\pm.max_spare_servers = 35' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^pm =/c\pm = dynamic' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.max_requests =/c\pm.max_requests = 100' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.process_idle_timeout =/c\pm.process_idle_timeout = 10s' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^;pm.status_path /c\pm.status_path = /status' /etc/php7/php-fpm.d/www.conf lizmap_1 | + sed -i '/^session.cookie_httponly =/c\session.cookie_httponly = 1' /etc/php7/php.ini lizmap_1 | + sed -i '/^;clear_env =/c\clear_env = no' /etc/php7/php-fpm.d/www.conf lizmap_1 | + '[' php-fpm '!=' php-fpm ] lizmap_1 | + '[' php-fpm '==' php-fpm ] lizmap_1 | + shift lizmap_1 | + set -- php-fpm7 -F -O lizmap_1 | + source= lizmap_1 | + '[' '==' ] lizmap_1 | + source=default lizmap_1 | + '[' default '==' random ] lizmap_1 | + '[' default '==' __reset ] lizmap_1 | + '[' default '==' default ] lizmap_1 | + su -c 'php /scripts/script.php jcommunity~user:create -v --no-error-if-exists --admin --reset admin' lizmap1 | Could not open input file: /scripts/script.php

Can i give you more info?
fz

frazucca commented 3 years ago

@dmarteau @nboisteault

I start again make start, and I check the docker containers behavior during the docker-compose up,

_osboxes@osboxes:~/works/lizmap-docker-compose-master/lizmap$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 530762ee8baf nginx:1 "/docker-entrypoint.…" 4 minutes ago Up 4 minutes 80/tcp, 127.0.0.1:8090->8080/tcp lizmap-docker-compose_web_1 eb0629b6be03 3liz/qgis-map-server:3.10 "/docker-entrypoint.…" 4 minutes ago Up 4 minutes 127.0.0.1:8091->8080/tcp lizmap-docker-compose_map_1 dff470f8b560 redis:5-alpine "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 6379/tcp lizmap-docker-compose_redis_1 561d10b2f9de 3liz/lizmap-web-client:3.4 "/bin/lizmap-entrypo…" 4 minutes ago Restarting (1) 37 seconds ago lizmap-docker-compose_lizmap1

and I find that the 561d10b2f9de 3liz/lizmap-web-client:3.4 restart every 1min, the same time for the loop to start and restart.

fz

dmarteau commented 3 years ago

I've tried it immediately and of course no directory under root ownership, apart the wps-data, correct?

wps-data is from an older version of the docker compose: you should have no files/directory owned by root.

AMHA you have some legacy configuration interfering with the deployement, I would suggest to clone the repo in a new directory and retry from that new repo.

frazucca commented 3 years ago

@dmarteau pardon using a new environment (Vbox with Docker version 20.10.2, build 2291f61), cloned repo in a new dir, make env and checked the docker-compose config, start the make, and again the same behaviour.

Check if containers are active, show how the lizmap-docker-compose_lizmap_1 is up and down in a loop.

osboxes@osboxes:~/lizmap-docker-compose$ docker-compose ps Name Command State Ports

lizmap-docker-compose_lizmap_1 /bin/lizmap-entrypoint.sh ... Restarting
lizmap-docker-compose_map_1 /docker-entrypoint.sh Up 127.0.0.1:8091->8080/tcp
lizmap-docker-compose_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
lizmap-docker-compose_web_1 /docker-entrypoint.sh ngin ... Up 80/tcp, 127.0.0.1:8090->8080/tcp

Check the localhost:8090 I get 502 Bad Gateway

I'm really sorry!! fz

dmarteau commented 3 years ago

@fracuzza Are you in a Virtual box ? This is may be the source of your problems, I can't help you very much on this.

I would suggest using a native Docker environment (docker-for-windows or docker-for-mac).

frazucca commented 3 years ago

@dmarteau I've tested it both in Vbox (ubuntu 20.04) as well as in a Linux server (U 20.04) of course. With the same results.

Anyway I link to http://localhost:8091/ and I get this

_{"author": "3Liz", "author_url": "http://3liz.com", "config": {"DEFAULT": {}, "cache": {"rootdir": "/srv/projects", "size": "20", "strict_check": "yes"}, "logging": {"level": "DEBUG"}, "projects.cache": {"insecure": "no", "rootdir": "/srv/projects", "size": "20", "strict_check": "yes"}, "projects.schemes": {}, "server": {"cross_origin": "yes", "enable_filters": "yes", "http_proxy": "no", "interfaces": "0.0.0.0", "pluginpath": "/srv/plugins", "port": "8080", "proxy_url": "", "restartmon": "", "ssl": "no", "ssl_cert": "", "ssl_key": "", "timeout": "20", "workers": "1"}, "zmq": {"bindaddr": "ipc:///tmp/qgssrv/broker/pool0", "broadcastaddr": "ipc:///tmp/qgssrv/broker/broadcast0", "identity": "OWS-SERVER", "maxqueue": "1000", "timeout": "15000"}}, "documentation": "http://127.0.0.1:8091/doc/", "qgis_version": "31012 (A Coru\u00f1a)", "tornadover": "6.1", "version": "1.3.3rc0"}

(from Linux server) Useful?

I'll try on Windows even .... I little bit skeptical.

Thank fz

frazucca commented 3 years ago

@dmarteau may be in some manner related to the Local configuration (eg. in your fr_FR.UTF-8)?

ciao

dmarteau commented 3 years ago

This is definitely related to a regression in the latest lzmap web client 3.4 Docker image. I have opened an issue on the problem: https://github.com/3liz/lizmap-web-client/issues/2067

In the meantime you may try with version 3.3:

make start LIZMAP_VERSION_TAG=3.3
frazucca commented 3 years ago

@dmarteau mercì beaucoup. Using version 3.3 it's ok of course. Waiting for good news on the 3.4 side!!

ciao

nboisteault commented 3 years ago

@frazucca You can also test 3.4.0 version but not 3.4.1 which introduced a bug. I have change current README.md (https://github.com/3liz/lizmap-docker-compose/commit/c4912ca313deebc0d3c3945d6a06f45b6a082007) to explain that.

In Linux, you can :

make start LIZMAP_VERSION_TAG=3.4.0

or in Windows edit .env.windows file and write:

LIZMAP_VERSION_TAG=3.4.0
ernestoherrera commented 3 years ago

Hi, I have the same issue. However, I am using OSx. Is the make command safe for use on a mac?

dmarteau commented 3 years ago

@ernestoherrera if your are not familiar with make you may use the same solution as for Windows described here

dmarteau commented 3 years ago

Closing the issue since https://github.com/3liz/lizmap-web-client/pull/2078 has been fixed.