Running docker-compose for Saleor appears to be caught in a loop, thoughts?

811 Views Asked by At

I'm trying to run docker-compose up following the instructions here but it appears to be stuck in a loop. I was able to bring the sample site up and make a few cosmetic changes prior to the Docker installation, but trying to do it with docker-compose has generated thumbnails 230180 times (I ran it overnight). Any ideas?

saleor-celery | saleor-celery | INFO saleor.core.utils Created 6 thumbnails [PID:11:MainThread] saleor-celery | [2018-09-14 20:03:54,249: INFO/ForkPoolWorker-1] Created 6 thumbnails saleor-celery | [2018-09-14 20:03:54,295: INFO/ForkPoolWorker-1] Task saleor.product.thumbnails.create_product_thumbnails[7a05b320-4656-4304-a8a1-e9fef3cb4cd8] succeeded in 1.5320279000000028s: None saleor-celery | [2018-09-14 20:03:54,298: INFO/MainProcess] Received task: saleor.product.thumbnails.create_product_thumbnails[fd833000-45f5-4029-abec-e6b828ee01af] saleor-celery | INFO saleor.core.utils Creating thumbnails for 230179 [PID:11:MainThread] saleor-celery | [2018-09-14 20:03:54,302: INFO/ForkPoolWorker-1] Creating thumbnails for 230179 saleor-celery | [2018-09-14 20:03:55,135: INFO/MainProcess] Received task: saleor.product.thumbnails.create_product_thumbnails[7de5385c-7fc3-45c6-9ad0-133442b2ad0c] saleor-celery | saleor-celery | INFO saleor.core.utils Created 6 thumbnails [PID:12:MainThread] saleor-celery | [2018-09-14 20:03:56,049: INFO/ForkPoolWorker-2] Created 6 thumbnails saleor-celery | saleor-celery | INFO saleor.core.utils Created 6 thumbnails [PID:11:MainThread] saleor-celery | [2018-09-14 20:03:56,404: INFO/ForkPoolWorker-1] Created 6 thumbnails saleor-celery | [2018-09-14 20:03:56,545: INFO/ForkPoolWorker-1] Task saleor.product.thumbnails.create_product_thumbnails[96859bd2-cb9d-49d0-ac6c-0010bf3bf76d] succeeded in 2.244128099999898s: None saleor-celery | INFO saleor.core.utils Creating thumbnails for 230180 [PID:11:MainThread] saleor-celery | [2018-09-14 20:03:56,550: INFO/ForkPoolWorker-1] Creating thumbnails for 230180

Windows 10

Python 3.6

Latest (stable) Saleor

3

There are 3 best solutions below

0
On BEST ANSWER

There is an issue filed for this bug in Saleor: https://github.com/mirumee/saleor/issues/3114

As of the time I wrote this, there is not an official fix but are multiple workarounds listed.

1
On

What's the version of Saleor you're using?

Could you try running:

docker-compose up -d 
docker-compose exec web /bin/sh -c ' python3  manage.py migrate && python3 manage.py collectstatic && python3 manage.py populatedb --createsuperuser'
0
On

This issue should be already resolved, using --rm has been documented.

For your case on generating the thumbnails, I would suggest to run create_thumbnails between the code for populate the Example Data and docker-compose up.

So the documented code is slightly change like below

$ docker-compose config
$ docker-compose build

$ docker-compose run --rm saleor python3 manage.py migrate
$ docker-compose run --rm saleor python3 manage.py collectstatic --noinput --clear
$ docker-compose run --rm saleor python3 manage.py populatedb --createsuperuser
$ docker-compose run --rm saleor python3 manage.py create_thumbnails

$ docker-compose up

Please note:

  • the create_thumbnails will place the thumbnails on app/media/__sized__
  • some thumbnails including that background images for category pages will be made separately by celery at app/media/__sized__/*backgrounds against a received task from redis.

Following is the complete task that is currently assigned by using celery:

Step #1: [tasks]
Step #1:   . saleor.account.emails.send_account_delete_confirmation_email
Step #1:   . saleor.account.emails.send_password_reset_email
Step #1:   . saleor.account.thumbnails.create_user_avatar_thumbnails
Step #1:   . saleor.core.analytics.ga_report
Step #1:   . saleor.core.utils.update_conversion_rates_from_openexchangerates
Step #1:   . saleor.dashboard.emails.send_promote_customer_to_staff_email
Step #1:   . saleor.dashboard.emails.send_set_password_customer_email
Step #1:   . saleor.dashboard.emails.send_set_password_staff_email
Step #1:   . saleor.order.emails.send_fulfillment_confirmation
Step #1:   . saleor.order.emails.send_fulfillment_update
Step #1:   . saleor.order.emails.send_order_confirmation
Step #1:   . saleor.order.emails.send_payment_confirmation
Step #1:   . saleor.product.tasks.update_variants_names
Step #1:   . saleor.product.thumbnails.create_category_background_image_thumbnails
Step #1:   . saleor.product.thumbnails.create_collection_background_image_thumbnails
Step #1:   . saleor.product.thumbnails.create_product_thumbnails

Whole process will consume a lot of memory if you miss place the sequence. You may also want to compose up the services one after another. I found the right sequence as below:

$ docker-compose up -d redis
$ docker-compose up -d celery
$ docker-compose up -d postgres

$ docker-compose up saleor

Combine all together

$ docker-compose config
$ docker-compose build

$ docker-compose run --rm saleor python3 manage.py migrate
$ docker-compose run --rm saleor python3 manage.py collectstatic --noinput --clear
$ docker-compose run --rm saleor python3 manage.py populatedb --createsuperuser
$ docker-compose run --rm saleor python3 manage.py create_thumbnails

$ docker-compose up -d redis
$ docker-compose up -d celery
$ docker-compose up -d postgres

$ docker-compose up saleor