Saleor: thumbnail generation, file not found error

Created on 26 Aug 2018  路  11Comments  路  Source: mirumee/saleor

What I'm trying to achieve

I'm writing helm charts for saleor and I'm on the last major component - the worker.

There seems to be some sort of directory mismatch or something like that when the worker starts trying to generate the images.

Here is the error output in this gist.

Maybe it has something to do with the permission levels that celery worker runs with.
The app deployment runs as user saleor. Also, I have an init container which sets the directory
permissions to saleor:saleor on init.

Basically, the issue seems to be that it expected a file or directory that does not exist.

No such file or directory: '/app/media/products/saleor/static/placeholders/books/book-05_DWRi802.jpg'

System information
Operating system: kubernetes
Browser: firefox

Most helpful comment

Hi @jdivins,

This is my top priority now. Gonna get back to you soon. I just started adding helm/charts/stable/sentry to requirements.yaml and I'm having to make additions to a fork of that chart to completely automate the setup. I hope to make a PR back to that the helm/charts/stable/sentry. I still have lots of docs to write, and various other changes to cleanup.

As an intermediate measure, I can create a separate repo with intermediate work.

It's going to change a lot. I'm only going to update the PR https://github.com/mirumee/saleor/pull/2702 at the end of the process.

I'll post the link to a repo soon.

All 11 comments

Looks like it's an issue with populatedb. Versatile is looking into /app/media/products/saleor/static/placeholders/coffee/ instead of /app/media/products/.

Try applying this patch on an empty db:

Index: saleor/core/utils/random_data.py
<+>UTF-8
===================================================================
--- saleor/core/utils/random_data.py    (revision 8c6b91012b3db67b8a54d4fb6517500a962a1cc1)
+++ saleor/core/utils/random_data.py    (date 1535298472000)
@@ -661,4 +661,4 @@

 def get_image(image_dir, image_name):
     img_path = os.path.join(image_dir, image_name)
-    return File(open(img_path, 'rb'))
+    return File(open(img_path, 'rb'), name=image_name)

In the DB, this is the url: products/saleor/static/placeholders/t-shirts/6.jpg [before trying the patch]

@NyanKiyoshi
I think I've figured it out now. You gave me a clue in the right direction. The populatedb script was running in a pod with incorrect permissions to /app/media.

I had the volume mount permissions set correctly for the deployments manifests but not for the job manifests. The job manifests run the migration script and populate script.

I'm currently changing it but I think that will work because when I manually ran the populatedb script in the deployment it was working.

@stephenmoloney have you finally created the helm charts?
Can you share them?
Thank you

@jdivins I have taken that effort offline in a private repo for now. I have made substantial progress, basically it works but I haven't updated the PR. I'm busy for the next few days. I'll update the PR within the next 10 days.
I'll let you know. It would be great to get feedback when I update the PR.

2702

There are a few issues though that I'm not sure how I'll tackle, for example, the saleor docker image is not really kubernetes ready. The USER should run as a UID like 1001 and not a USER saleor. Some of these changes are important to a secure kubernetes ready pod so I might also have to create a helm charts repo and try to persuade for changes in the PR. I'm just not there yet.

Ok! Thank you very much! I hadn't seen the PR.

Yea, I'd encourage you to wait until I've updated the PR though or possibly created a new repo for helm charts. I've made some decent progress and improvements beyond what's there now. I just don't have time to update it at the moment.

@stephenmoloney have you updated something? Can I pick #2702 commits as start point?
Thank you very much for your help

Hi @jdivins,

This is my top priority now. Gonna get back to you soon. I just started adding helm/charts/stable/sentry to requirements.yaml and I'm having to make additions to a fork of that chart to completely automate the setup. I hope to make a PR back to that the helm/charts/stable/sentry. I still have lots of docs to write, and various other changes to cleanup.

As an intermediate measure, I can create a separate repo with intermediate work.

It's going to change a lot. I'm only going to update the PR https://github.com/mirumee/saleor/pull/2702 at the end of the process.

I'll post the link to a repo soon.

Hi @stephenmoloney,
Have you got news about this issue?
Thank you very much! As you can see I am really interested in this solution

i still have an issue with this with latest disto-- the image thumbnail is showing up with 300x300 in the file name in s3 bucket yet site is linking to 255x255

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timuric picture timuric  路  3Comments

jujes picture jujes  路  4Comments

PiotrCzapla picture PiotrCzapla  路  3Comments

mad-anne picture mad-anne  路  3Comments

8BitAce picture 8BitAce  路  4Comments