Is it best-practice to run filament:upgrade on every deploy?

We have pretty extensive Filament admin panels, and we've been encountering some users having squished forms and various naughtiness. Running filament:upgrade via SSH seems to fix layout for some users (maybe all?). The built assets are in version control, and we deploy to DigitalOcean, via Ploi. Running filament:upgrade on every deploy feels... dangerous. But I don't want to manually run it after each upgrade... So, is running filament:upgrade generally considered a good-idea to put into our deploy script? Thanks! 🙂
Solution:
Yea. Especially if part of your deploy runs composer update, then definitely add it to the composer scripts. The filament:install command should have done it automatically though. That’s why I asked.
Jump to solution
7 Replies
JJBigThoughts
JJBigThoughtsOP6d ago
FYI: these are the types of issues we're trying to avoid.
No description
awcodes
awcodes6d ago
Do you not have it in your composer post auto load dump script? You should only need to run it if you’re updating filament itself.
JJBigThoughts
JJBigThoughtsOP6d ago
@awcodes It might be almost as simple as that. We have some funky scripts. I think this is exactly the nudge we need. Thanks 😎 J
Solution
awcodes
awcodes6d ago
Yea. Especially if part of your deploy runs composer update, then definitely add it to the composer scripts. The filament:install command should have done it automatically though. That’s why I asked.
JJBigThoughts
JJBigThoughtsOP6d ago
@awcodes We don't commit assets on main, only on the staging branch. So filament:upgrade wasn't getting run. That was our mistake. On our production server, we basically only run
npm cache clean --force
rm -rf node_modules
npm ci

composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
npm cache clean --force
rm -rf node_modules
npm ci

composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
So, follow-up question: Does filament:upgrade need to be run on the production server? Or can run it on, say, our staging server and commit any changes, which would later make their way to production?
awcodes
awcodes6d ago
The main thing is the underlying assets that filament publishes to public. Filament:upgrade internally also calls filament:assets which is the command that actually republishes the assets to public. So, it really could be done in a few ways, basically, anytime filament is updated via composer you should run filament:upgrade, but there could be use cases where filament:assets might be more appropriate. As for the production server it would depend on if the public assets are in version control or not. But I don’t think it would hurt to run it on the production server as a deploy step or just let composer handle it. FYI, plugins also tap into filament:assets so probably best to just run it one way or the other.
JJBigThoughts
JJBigThoughtsOP6d ago
Awesome - thanks @awcodes . You made our day!

Did you find this page helpful?