The Temple in Jerusalem was inaugurated with a special psalm - but nothing about the text seems to relate to the Temple at all!
In this lecture, Rabbi Fohrman explains how Psalm 30 connects to the sale of Joseph, and argues that David was hearkening back to his ancestor Judah to explain why Judah merited for his descendants to build the Temple.
Psalm 30 is recited traditionally on Hanukkah, as the psalm of the day. For more great Hanukkah content at Aleph Beta check out, What Is Hanukkah?, The Real Story of Hanukkah & What Does Hanukkah Commemorate?