---
# System prepended metadata

title: Upgrade Mastodon v3 -> v4

---

# Upgrade Mastodon v3 -> v4

Stop everything:
- [X] Stop nginx on Alice
- [X] Stop sidekiq workers, puma on wakko and yakko
- [X] Stop mastodon-web, mastodon-streaming, sidekiq on alice

Alice:
- [X] unmount `/var/lib/mastodon/public/system` on alice (media share)
- [X] move old `/var/lib/mastodon/public/system` to another place for backup
- [X] backup `/var/lib/mastodon` on alice
- [X] install Mastodon v4 in `/var/lib/mastodon`
- [X] Stop postgres
- [ ] SKIP Backup `/var/lib/postgres/data` (without `/var/lib/postgres/data/archive`)
- [ ] Start postgres
- [ ] Run database migration
- [X] start mastodon-web, mastodon-streaming, sidekiq for 
- [ ] mailers and scheduler
- [ ] introduce new ingress queue (note it's in the default config for sidekiq)

Yakko and Wakko:
1. Upgrade `/var/lib/mastodon` to new Mastodon v4
2. Start sidekiqs and puma: yakko+wakko: 
    3. yakko+wakko: 16 defaults (includes default, pull, push, ingress), 4 pull, 4 push. 
    4. alice: /lib/systemd/system/mastodon-sidekiq.service



### Action Items (outcomes)

 - We need a way to control systemd units in bulk/remote 
 - Note for future selves: We should have kept postgres online during mastodon upgrade
 - We need to understand if yakko and wakko serve nginx

### Things We Did

 - We have edited `/lib/system/system/mastodon-web` directly as the `systemctl edit` override did not have an effect
 - We have edited `/var/lib/mastodon/config/puma.rb` to manually override the bind address to `0.0.0.0`
 - We had to remove the symlink for the NFS mount in order to get the `yay -S` upgrade to finish in a reasonable amount of time.
 - We found websocket errors and chrome and then started `mastodon-streaming` on Yakko and Wakko
 - Set the `MAX_THREADS` and `WEB_CONCURRENCY` on yakko/wakko `mastodon-web` to 16 each
 - restart postgres hot duplicate on buttons