Discourse stuck with 504 Gateway Time-Out error and 100% CPU after rebuild

We’ve just merged a change that should fix the issue:
https://github.com/discourse/discourse/commit/7324b327cdf72c2e468d33ce35074f5d1c78fe6f
It should land in latest shortly, could you try updating your droplet when the fix is available?