Skip to content

其他

线上优化

为了优化 Filament 以用于生产环境,应该在部署脚本中运行以下命令开启图标缓存:

bash
php artisan filament:optimize
yaml
# ...

tasks:
  deploy:rsync:
    - deploy:release
    - rsync
    - deploy:shared
    - deploy:vendors
    - deploy:writable
    - artisan:storage:link
    - artisan:view:cache
    - artisan:config:cache
    - artisan:optimize
    - artisan:filament:optimize
    - artisan:migrate
    - deploy:publish
    - php-fpm:reload
  artisan:filament:optimize: 
    - desc: 'Optimizing Filament for production to improving performance'
    - cd: '{{release_path}}'
    - run: '{{bin/php}} artisan filament:optimize'
  yarn:run:prod:
    - desc: 'Running yarn run prod to build assets'
    - cd: '{{release_path}}'
    - run: '{{bin/yarn}} build'
  php-fpm:reload:
    - desc: 'Reloading php-fpm'
    - run: 'sudo /sbin/service {{php_fpm_service}} reload'

after:
  deploy:failed: deploy:unlock