ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 8 forks source link

hypernode-image-optimizer fails to run #25

Closed maartenwolfsen closed 5 years ago

maartenwolfsen commented 5 years ago

When I run hypernode-image-optimizer, I get the following error:

app@fd694d478a13:~$ hypernode-image-optimizer /data/web/public/
Traceback (most recent call last):
  File "/usr/bin/hypernode-image-optimizer", line 9, in <module>
    load_entry_point('kamikaze3==20181102.125332', 'console_scripts', 'hypernode-image-optimizer')()
  File "/usr/lib/python3/dist-packages/kamikaze3/analysis/image.py", line 314, in main
    path_profit, path_size = optimizer.optimize(path)
  File "/usr/lib/python3/dist-packages/kamikaze3/analysis/image.py", line 66, in optimize
    with tempfile.NamedTemporaryFile(dir=TMP_DIR) as tmp_img:
  File "/usr/lib/python3.5/tempfile.py", line 688, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/lib/python3.5/tempfile.py", line 399, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/run/shm/tmpgpipn_m3'

Now I don't know if this is a problem in the docker image or the hypernode-image-optimizer, but the latter is not on Github.

vdloo commented 5 years ago

Hi @maartenatmarissen, I can't seem to reproduce it. Perhaps this is something related to your environment. I'm running Docker Docker version 17.05.0-ce, build 89658be on Ubuntu 16.04.3 LTS:

root@068a32f9b5af /tmp # hypernode-image-optimizer /tmp
[ 1%] /tmp/45684735.jpg (0 KB smaller)

Safe optimization profit over 1 files: 0 MB (1%)
I have not written anything to disk, use --write for that.
root@068a32f9b5af /tmp # hypernode-image-optimizer /tmp --write
[ 1%] /tmp/45684735.jpg (0 KB smaller)

Safe optimization profit over 1 files: 0 MB (1%)
I have written the optimized files to disk.
root@068a32f9b5af /tmp # su app
app@068a32f9b5af:/tmp$ hypernode-image-optimizer /tmp
[ 1%] /tmp/45684735.jpg (0 KB smaller)

Safe optimization profit over 1 files: 0 MB (1%)
I have not written anything to disk, use --write for that.
app@068a32f9b5af:/tmp$ hypernode-image-optimizer /tmp --write
[ 1%] /tmp/45684735.jpg (0 KB smaller)

Safe optimization profit over 1 files: 0 MB (1%)
I have written the optimized files to disk.

If this is related to the NamedTemporaryFile we could perhaps change that to something else but I suspect that if that doesn't work more other (python) scripts won't work in your setup. There are some shm related flags you can pass to docker run, perhaps you can try playing with those to get it to work.

maartenwolfsen commented 5 years ago

Hello @vdloo , I will try to experiment with those shm related flags, thank you!