We are such complex, almost mysterious beings. Think of all I've explored over a lifetime, to arrive at a place of acceptance. Some of us are more prone to depression, etc. due to any or all factors that you identify. There is no panacea that I ever discovered.
It takes constant effort, constant attention. It can be an interesting trip to self-knowledge, self-understanding, commitment, realization that there will be down days, but also good days. Meditation and exercise and journaling are big for me. They rest on all the shrinks and others I've read, even my time reading and posting on a valuable self-help site such as this. Don't get discouraged, keep at it and you'll be happily rewarded.