Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't build others themes with languages on master branch #141

Closed
dellg5 opened this issue Jun 1, 2020 · 3 comments
Closed

Don't build others themes with languages on master branch #141

dellg5 opened this issue Jun 1, 2020 · 3 comments
Labels

Comments

@dellg5
Copy link

dellg5 commented Jun 1, 2020

Hello,

After you release v0.9.0, you changed the logic for compiling languages ​​by themes and add "-l" if
magento_deploy_languages is present in deploy.rb

So in my deploy.rb:

set :magento_deploy_jobs, 4
set :magento_deploy_themes, ['Magento/backend','Custom/theme','Custom/theme-it','Custom/theme-uk']
set :magento_deploy_languages, ['en_US', 'en_GB', 'fr_FR', 'it_IT']

on release v0.8.9, in my runner this build theme with language with this logic and it work :
touch /var/www/html/releases/20200529054247/pub/static/deployed_version.txt php -f bin/magento -- setup:static-content:deploy -f --jobs 4 en_GB -t Magento/backend -t Custom/theme -t Custom/theme-it -t Custom/theme-uk Deploy using quick strategy .....

php -f bin/magento -- setup:static-content:deploy -f --jobs 4 it_IT -t Magento/backend -t Custom/theme -t Custom/theme-it -t Custom/theme-uk Deploy using quick strategy

Now, with you release V.0.9.0 this don't work and in my runner log, i can see :
php -f bin/magento -- setup:static-content:deploy -l en_US -l en_GB -l fr_FR -l it_IT -t Magento/backend -t Custom/theme -t Custom/theme-it -t Custom/theme-uk

This build only en_US language by default.

Can you give me an explanation on your changes and how to launch the deployment on the other themes by languages ?

You have change magento_deploy_jobs too:
what is '$(nproc)' ?
is this = set :magento_deploy_jobs, '$(4)' ?

Thak you for you'r work !

@davidalger
Copy link
Owner

@dellg5 Thanks for the report! Interestingly the notes on -l read exactly the same way as those for -t but apparently it does not actually support multiple arguments as -t does:

  -t, --theme[=THEME]                            Generate static view files for only the specified themes. [default: ["all"]] (multiple values allowed)
  -l, --language[=LANGUAGE]                      Generate files only for the specified languages. [default: ["all"]] (multiple values allowed)

I'll be pushing an update very shortly which reverts back to using the space-separated list argument rather than multiple -l options. My apologies for not testing that change well enough.

With these settings...

set :magento_deploy_jobs, '$(nproc)'
set :magento_deploy_themes, ['Magento/backend', 'Magento/blank']
set :magento_deploy_languages, ['en_US', 'en_GB', 'fr_FR', 'it_IT']

…one should see the following SCD command used:

00:01 magento:setup:static-content:deploy
      01 php -f bin/magento -- setup:static-content:deploy --jobs $(nproc) en_US en_GB fr_FR it_IT -t Magento/backend -t Magento/blank
      Static content version: 1591020066
      02 #<StringIO:0x00007fb1821674f8> /var/www/dev/releases/20200601140106/pub/static/deployed_version.txt

This should bring it back to a working state where all languages are compiled:

$ php -f bin/magento -- setup:static-content:deploy --jobs $(nproc) en_US en_GB fr_FR it_IT -t Magento/backend -t Magento/blank

Deploy using quick strategy
frontend/Magento/blank/en_US            2749/2749           ============================ 100%   1 sec               
adminhtml/Magento/backend/en_US         3308/3308           ============================ 100%   < 1 sec             
frontend/Magento/blank/en_GB            2749/2749           ============================ 100%   < 1 sec             
frontend/Magento/blank/fr_FR            2749/2749           ============================ 100%   < 1 sec             
frontend/Magento/blank/it_IT            2749/2749           ============================ 100%   < 1 sec             
adminhtml/Magento/backend/en_GB         3308/3308           ============================ 100%   < 1 sec             
adminhtml/Magento/backend/fr_FR         3308/3308           ============================ 100%   < 1 sec             
adminhtml/Magento/backend/it_IT         3308/3308           ============================ 100%   0

Execution time: 8.5695939064026

You have change magento_deploy_jobs too:
what is '$(nproc)' ?
is this = set :magento_deploy_jobs, '$(4)' ?

The nproc utility is part of coreutils, so it's not POSIX and thus cannot be used as a general default value for that setting in this gem, however it's a good general purpose default value where coreutils is installed on the target system. Basically, nproc will report the number of available CPU cores and setting '$(nproc)' as the value for jobs results in bash substituting the result (a number) as the argument to --jobs when the command is executed on the server. For example, running nproc on one system of mine returns 8 and another 24. So using this setting for that allows SCD to use up to the number of available CPU cores for it's parallel execution. On small servers, it could result in 2 jobs, but on larger systems with more cores will allow SCD to create more threads and build the content faster where there are many theme/language combinations.

@davidalger
Copy link
Owner

Published fix for this in 0.9.1. Should be all set!

@dellg5
Copy link
Author

dellg5 commented Jun 1, 2020

@davidalger it works, thank you for your correction and your reactivity concerning this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants