Stoicism. The two major figures that I use to discuss stoicism are Viktor Frankl and Epictetus. Epictetus was born a slave and was crippled by his owner, but eventually was freed and found a happy life teaching Stoicism. Viktor Frankl wrote about finding meaning in life even living in the concentration camps. While not explicitly Stoic, his Logotherapy lines up very well with Stoic principles.
As for the spiritual component: https://stoickai.com/2019/09/19/the-stoic-god-a-call-to-science-or-faith/