Meaning is more important than optimism. You don't have to like it, you just have to care.
I find comfort from entertaining a view that is a close relative of the "block universe theory". YMMV.
I find that adopting "leave no trace" not just as a backpacking code but as a core moral value changes my estimation of succeeding in life.
First, survive. Next, stop harming others (and go vegan). Finally, help others survive and grow. Supposedly that is enough to keep one busy in life.