It's a process.
It's a process of learning and knowing it's okay to feel disappointed in yourself once in a while, but real strength comes from picking yourself back up and showing the world you won't be knocked down for good.
I know just how you feel, trust me. I've been on-again off-again for years and the mentality of "my life changes here" coming and going can be an exhausting process. Just stick to it, keep dedicated, recognize your own habits and try to take steps to correct them.
You'll get there. Use these obstacles to prove to yourself you can take them on. In the meantime, don't beat yourself up over mistakes you can learn from!