Saleor: Product images not created when using populatedb

Created on 4 Jan 2019  路  7Comments  路  Source: mirumee/saleor

What I'm trying to achieve

I'm trying to run a clean install of Saleor using Docker by following the documentation and populate the database with the example data using _populatedb_.

After the process has finished, the product images for example products are missing.

The directory /app/media in container saleor_web is empty.

Celery log shows messages like the following for every product image:

[2019-01-04 10:33:41,318: ERROR/ForkPoolWorker-7] Thumbnail generation failed

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/versatileimagefield/image_warmer.py", line 117, in _prewarm_versatileimagefield
    url = get_url_from_image_key(versatileimagefieldfile, size_key)
  File "/usr/local/lib/python3.6/site-packages/versatileimagefield/utils.py", line 216, in get_url_from_image_key
    img_url = img_url[size_key].url
  File "/usr/local/lib/python3.6/site-packages/versatileimagefield/datastructures/sizedimage.py", line 149, in __getitem__
    height=height
  File "/usr/local/lib/python3.6/site-packages/versatileimagefield/datastructures/sizedimage.py", line 201, in create_resized_image
    path_to_image
  File "/usr/local/lib/python3.6/site-packages/versatileimagefield/datastructures/base.py", line 140, in retrieve_image
    image = self.storage.open(path_to_image, 'rb')
  File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 33, in open
    return self._open(name, mode)
  File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 218, in _open
    return File(open(self.path(name), mode))

FileNotFoundError: [Errno 2] No such file or directory: '/app/media/category-backgrounds/DEMO-04.jpg'

Steps to reproduce the problem

  1. Clone saleor master branch
  2. Run steps described in the documentation

Screenshots

Saleor error in dashboard

System information
Operating system: Ubuntu 18.04 LTS
Docker version 18.09.0
Docker-compose version 1.23.2

devops

Most helpful comment

That sounds great thanks for the reply, I'll keep an eye out and help out where I can. It might also be worth investigating https://github.com/stephenmoloney/saleor-helm and seeing if it can / should be upstreamed.

All 7 comments

This may caused by a folder permissions issue to do with running under docker, this pull request is somewhat related: https://github.com/mirumee/saleor/pull/3117

Another alternative is if you've been starting and stopping lots of containers lately you might have run into a loop of some kind with background tasks, this commit is also related: https://github.com/mirumee/saleor/pull/3118/commits/48a6bc8bfeac4fe2c2bb7d11c04117efd9f5159e

This may caused by a folder permissions issue to do with running under docker, this pull request is somewhat related: #3117

Another alternative is if you've been starting and stopping lots of containers lately you might have run into a loop of some kind with background tasks, this commit is also related: 48a6bc8

Thanks for the reply.

What I've tried so far:

  • running migrations, db population and static collections with --rm flag, as described here
  • tweaking the file permissions / running the containers as root
  • running without the --dev flag in pipenv install command (this shouldn't matter either)
  • pruning the docker system (including containers, images, volumes and networks) and starting fresh

Unfortunately, still no success. Will try to investigate further.

For some reason the Saleor guys aren't interested in any fixes involving Docker it seems. Not sure if they just don't use it in development or whatever

Docker stuff will be tidied up in a future sprint.

Another user proposed a fix but it wasn't accepted, they have created a seperate module with their fixes that you can install: https://github.com/bennylb/saleor-docker-local

Hey, I have to admit that we hadn't time to look into this recently. There are multiple PRs that try to solve various problems related to Docker, but as far as I remember we had some objections to each of them and they eventually got stuck. We'll take a look at all of those Docker issues during this sprint and try to solve them in one batch.

Thanks for the replies. Meanwhile we managed to find a workaround by setting the shared media volume for web and celery containers.

That sounds great thanks for the reply, I'll keep an eye out and help out where I can. It might also be worth investigating https://github.com/stephenmoloney/saleor-helm and seeing if it can / should be upstreamed.

Should be resolved by #3657.

Was this page helpful?
0 / 5 - 0 ratings