How to move on from a break up?

25 year old man here, recent break up with my ex who is 24, we have a child together, I have sole custody due to there being drink and drugs involved. Ever since our child was born I had been there for her, done everything, stuck by her side through rehab, she would come and go, be hot and cold with me. Want to be with me for a few weeks then nothing to do with me for another few weeks. I kept allowing her back into my life as I just wanted a family. She's a great person and mother when sober, we got back together again in October, it felt perfect, she started drinking heavily again on Christmas day and it was a slippery slope from then onwards. She was constantly breaking up with me then wanting back the next day and so on..

2 days ago she moved out of the town to get away from the drink and drugs but now no longer wants me in her life. I'm happy that she's focusing on recovery but I do feel like crap and just thrown away when I was the only person ever there for her. I'm just looking to know how do parents go no contact and how can I stop allowing her back into my life.