I wholeheartedly agree that mental health and stress levels are the primary determiner in whether you'll succeed with maintaining a good diet and an exercise routine. Just to make things more complex, though, my experience after two years of daily workouts and strict dieting is that exercise, eating clean and sleeping well are the primary drivers of good mental health in my life. It's absolutely a feedback loop. If you set yourself up for success, you'll tend to spiral upward as your metabolism improves, your sleep gets better and your blood sugar is no longer the primary cause of an emotional rollercoaster. Conversely, if you think that you can make the base mechanical changes without re-engineering your entire life you're not very likely to succeed and your success will plateau early.

In recovery, particularly AA, there is the concept of a "dry drunk" who is, eli5, a person who is trying to quit using by simply not using anymore and not examining themselves or their surroundings to determine how they ended up there in the first place. Addiction as a disease is a good model for empirically researching treatments on a population scale but for an individual in recovery it's much more effective to realize that addiction is who you are and the process is about changing yourself, not just being the same guy but without the drug. When I got clean I had to quit my job, ditch a lot of my friends, totally reengineer my life because staying clean is a matter of moments that could break one way or the other and the best way to ensure they never break the wrong way is two-pronged: you maximize the odds of you making the right choice and you minimize the number of times you have to choose.

This idea also works for diet and exercise: a gym membership is good, but an exercise bike in the basement means you don't have to go through all the intervening steps between "I should work out" and actually doing the thing. By the time you've started to try to talk yourself out of it you're already doing it. It's easy to eat cookies and hard to eat celery. But it's easier to eat celery from your fridge than it is to go to the store to get cookies. All of these things help you make choices that support your goals and not make choices that are detrimental to them. Eventually those choices go from efforts of will to part of who you are. I'm not fat me having a salad, I'm the guy who eats salads. I'm not checking out the gym, I'm the guy who works out. I'm not just not high today, I'm Sober and so are all of my friends. I'm a Sober man and a member of a Sober community.