In case it’s relevant, what version of Discourse are you upgrading from?
It seems that this is where things are getting stuck. It’s a longshot, but possibly this is related: Stuck on yarn install, Time out.
It might be worth confirming that your server meets the software requirements shown here: discourse/docs/INSTALL.md at main · discourse/discourse · GitHub.