umple / umple

Umple: Model-Oriented Programming - embed models in code and vice versa and generate complete systems
https://www.umple.org
MIT License
251 stars 196 forks source link

If no ump directory exists, create one. Prevents message saying Wrong owner of /var/www/ump in docker image #1672

Open angatha opened 3 years ago

angatha commented 3 years ago

Brief Description

In the latest docker image (docker pull umple/umpleonline:6cb9d1ac95bebb1af2cfa60236322a730d666b37) generating code and loading examples is not possible (probably a lot more).

How to Reproduce

This is a minimum test case to validate the problem.

I used 6cb9d1ac95bebb1af2cfa60236322a730d666b37 instead of latest to ensure i refer the correct version. Currently latest refers to this image.

  1. docker pull umple/umpleonline:6cb9d1ac95bebb1af2cfa60236322a730d666b37
  2. docker run --rm -ti -p 8000:8000 umple/umpleonline:6cb9d1ac95bebb1af2cfa60236322a730d666b37
  3. open http://localhost:8000/umple.php
  4. Select an examples

Expected result that didn't happen

Example code shows (or the generated code is shown, when generating)

Actual Result

Endless spinning wheel shows. The output if the consol will show: `2021/03/31 07:45:50 [error] 11#11: *6 FastCGI sent in stderr: "PHP message: PHP Warning: mkdir(): Permission denied in /var/www/scripts/compiler_config.php on line 192PHP message: PHP Warning: mkdir(): No such file or directory in /var/www/scripts/compiler_config.php on line 195PHP message: PHP Warning: copy(/var/www/ump/index.html): failed to open stream: No such file or directory in /var/www/scripts/compiler_config.php on line 198PHP message: PHP Fatal error: Uncaught Error: Call to a member function readData() on null in /var/www/scripts/compiler.php:99 Stack trace:

0 {main}

thrown in /var/www/scripts/compiler.php on line 99" while reading response header from upstream, client: 172.17.0.1, server: , request: "POST /scripts/compiler.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "localhost:8000", referrer: "http://localhost:8000/umple.php"`

Solution

I investigate the permissions in /var/www and noticed that /var/www/ump is owned by root and also the root group. Changing the owner to nginx by executing chown nginx -R /var/www/ump as root inside the container, fixed the problem.

TimLethbridge commented 3 years ago

Aha! The issue really is that you don't have an ump directory at all.

You have for a little while been required to create a storage directory on your own machine and map it to the image using the -v option, as below. But the docker documentation didn't make this clear. The real issue is to fix this.

docker run --rm -ti -p 8000:8000 -v /tmp/umpleonline-tmp21609:/var/www/ump umple/umpleonline

The udock script in umple's dev-tools does this (and always has).

However, it might be sensible for the image to check if there is a mapping, and if not to use an internal directory.

The reason for having to create a directory and map it to the ump directory is because most real users wanted to do this ... to be able to get data in and out, yet it was challenging to 'clobber' the existing default ump directory when doing this mapping.

TimLethbridge commented 3 years ago

The documentation on Dockerhub has been updated. as has http://dl.umple.org which is the documentation for downloading in the main Umple website.

The only other step in fixing this issue would be to create an ump directory with the correct permissions if one does not exist at image startup.