{"id":18926074,"url":"https://github.com/getpagespeed/n98-magerun2-module-getpagespeed","last_synced_at":"2025-04-12T10:32:05.474Z","repository":{"id":134154300,"uuid":"132868408","full_name":"GetPageSpeed/n98-magerun2-module-getpagespeed","owner":"GetPageSpeed","description":"Collection of useful commands for n98-magerun2","archived":false,"fork":false,"pushed_at":"2023-05-04T15:10:47.000Z","size":34,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T18:30:15.943Z","etag":null,"topics":["cli","magento2","n98-magerun2","performance","varnish"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GetPageSpeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-10T08:01:35.000Z","updated_at":"2024-12-11T20:40:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"f378415f-65ed-4c82-a52b-2c615961a78e","html_url":"https://github.com/GetPageSpeed/n98-magerun2-module-getpagespeed","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetPageSpeed%2Fn98-magerun2-module-getpagespeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetPageSpeed%2Fn98-magerun2-module-getpagespeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetPageSpeed%2Fn98-magerun2-module-getpagespeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetPageSpeed%2Fn98-magerun2-module-getpagespeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GetPageSpeed","download_url":"https://codeload.github.com/GetPageSpeed/n98-magerun2-module-getpagespeed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239921837,"owners_count":19718844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","magento2","n98-magerun2","performance","varnish"],"created_at":"2024-11-08T11:14:26.792Z","updated_at":"2025-02-20T22:19:12.896Z","avatar_url":"https://github.com/GetPageSpeed.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `n98-magerun2-modules`\n\nThis is our collection of commands for `n98-magerun2`.\nThe commands allow to speed up compilation and deployment of static assets, as well\n as few other helper commands for Magento 2.\n\n## Synopsys\n\n```bash\nsudo yum -y install https://extras.getpagespeed.com/release-latest.rpm\nsudo yum -y install n98-magerun2-module-getpagespeed\n\ncd /path/to/magento2\n\n# Get tuned Varnish parameters specifc to your Magento 2 instance\nn98-magerun2 varnish:tuned \n\n# Get active themes\nn98-magerun2 dev:theme:active\n```\n\n## Commands available\n\n### `n98-magerun2 varnish:tuned`\n\nGets tuned Varnish parameters specifc to *your* Magento 2 instance. It will find the category with \nlargest number of products and provide Varnish parameters that will help you to avoid \n\"Backend Fetch Failed\" error as detailed in \n[documentation](https://devdocs.magento.com/guides/v2.2/config-guide/varnish/tshoot-varnish-503.html). \nExample output:\n\n\u003cpre\u003e\nVarnish params: \u003cb\u003e-p http_resp_hdr_len=54684 -p http_resp_size=79260 -p workspace_backend=112028\u003c/b\u003e\nLargest product category has this number of products: \u003cb\u003e2604\u003c/b\u003e\n\u003c/pre\u003e\n\nSimply copy-paste the suggested configuration bits to e.g. `/etc/varnish/varnish.params` or otherwise\nspecify as startup parameters to Varnish.\n\n### `n98-magerun2 dev:theme:active`\n\nAllows to get list of used themes. Example output (suitable for deploy static command):\n\n    --theme Swissup/argento-pure2\n\nThis is useful for scripts to facilitate faster builds.\n\nMany Magento 2 themes come bundled with many actual themes, and deploying static assets takes huge time.\nAll because you unnecessarily minify a ton of CSS and Javascript files for themes which are not even in use!\n\nYou can deploy just the used themes with:\n\n    bin/magento setup:static-content:deploy $(n98-magerun2 dev:theme:active)\n    \nThis is used in our zero-downtime deployment program, \n[`clearmage2`](https://www.getpagespeed.com/clearmage2).\n\n### `n98-magerun2 deploy:locale:active`\n\nAnother way to speed up deployment of static files is by generating them only for actually used\nlocales. I truly believe that Magento 2 is dumb as f* of not doing this by default.\n\nOnly if you use `n98-magerun2 deploy:mode:set production` command, it is smart enough to generate\nstatics only for used locales. But this command is dumb, because when you use it, you cannot parallelize\ndeployment, and then again, you cannot deploy for only active themes, as above allows.\n\nSo you can get list of actively used locales with `n98-magerun2 deploy:locale:active` and pass it\nover to deployment command:\n\n\u003cpre\u003e\n\u003cem\u003e#\u003e\u003c/em\u003e n98-magerun2 deploy:locale:active\n\u003cem\u003e#\u003e\u003c/em\u003e \u003cb\u003een_US en_GB\u003c/b\u003e\n\u003c/pre\u003e\n\nCombining all the things together for a no-dumb and much quicker static deployment:\n\n```bash\nTHEMES=$(n98-magerun2 dev:theme:active)\nLOCALES=$(n98-magerun2 deploy:locale:active)\nphp ./bin/magento setup:static-content:deploy --jobs=$(nproc) ${THEMES} ${LOCALES}\n```\n\nThis is also used in our zero-downtime deployment program, \n[`clearmage2`](https://www.getpagespeed.com/clearmage2).\n\n### `n98-magerun2 db:maintain:search-query`\n\nThis command trims entries for the `search_query` for queries which produce no results and were\nmade more than a month ago. Helps to prevent too much unnecessary database bloating and thus\nimproves performance. \n\nThere is no output on success. It is suitable to be set up into a `@monthly` cron, e.g.:\n\n    @monthly n98-magerun2 db:maintain:search-query --root-dir=/path/to/magento2  \n    \n### TODO\n\nExtra switch for trimming based on popularity, e.g. remove all with popularity \u003c 25    \n\n## Installation\n\n### Quick install for CentOS 6+ (7, 8, ...)\n\nThis will install our [RPM repository](https://www.getpagespeed.com/redhat), `n98-magerun2` and the module:\n\n    sudo yum install https://extras.getpagespeed.com/release-latest.rpm\n    sudo yum install n98-magerun2-module-getpagespeed\n\n### Other platforms\n\nJust place the files over to `/usr/local/share/n98-magerun2`.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetpagespeed%2Fn98-magerun2-module-getpagespeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetpagespeed%2Fn98-magerun2-module-getpagespeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetpagespeed%2Fn98-magerun2-module-getpagespeed/lists"}