So as to how I fought and beat my depressive periods took awhile to figure out but it kinda came down to a few different things:
For starters I think one of the biggest changes was going from working nights to working days. Humans are not supposed to be nocturnal and while you can stay up till 5am and sleep all day, all that time in darkness takes its affect. Especially if the place you're living isn't clean and isn't well lit.
My first apartment was like this. I was living with my two best friends but I worked second shift at a shitty job and wouldn't get home till 1AM at the earliest. We were teenage males and keeping things clean wasn't always the highest priority. I didn't make a lot of money so if a few light bulbs died, they often stayed dead. Spending your entire life in dim light really does have a big effect.
The next thing is diet. If you're living on shitty food, prepackaged frozen trash, etc. you will feel bad. Learn to cook. Buy fresh ingredients. Contrary to Jersh's beliefs you can get good, fresh products in most places in the US.
Think of it like this: Taste is one of your five senses. You wouldn't subject yourself to shitty music, you wouldn't inflict pain on yourself for no reason, you wouldn't force yourself to smell fetid rot, you wouldn't look at things you find revolting. You shouldn't ingest things that are awful either. Even a single good meal a day will make a huge difference.
That kinda stuff is like the most basic of the basic. Small changes like that will make a difference, but there's still things that I needed to change overall, this is how it worked out for me:
I had to come to some particular conclusions about why my days felt so bad. I was 6' and weighed 135 pounds. I was retardedly in love with a 6/10 girl who didn't give a shit about me and was actively malicious in my life. I lived in a dingy environment where I was literally cold 9 months out of the year because it snowed fucking constantly. I spent all my time grinding a video game latter because I was gonna be the next big Starcraft player if I could just play a bit more.
How I changed that:
I started eating well and went to the gym. I gained 50 pounds. While I still wanted the 6/10 girl, her constant malicious bitchiness didn't really matter when 7 and 8/10 girls who thought I was a degenerate skeleton before actually saw me as someone working on themselves and looking good. The common observation went from "He's too skinny and sick looking" to "he has really pretty eyes."
I moved back in with my parents, which temporarily sucked, but it let me get into a cleaner, better environment while I got my shit together.
I got fired from my shitty over night job and started a manufacturing job and then a job in a bakery. It took a year but I managed to improve my mood a lot just by changing my daily habits.
I got a goal shortly there after, one that would change my life: Get strong enough to join the Military. It took 9 months but I did that, and while the Military ended up not working out due to an injury in my third week in training, the training, the discipline, leaving my comfort zone, and forcing myself out of the comfortable rut I was in recontextualized my life. I was now confident enough to move forward.
That left one issue: The 6/10 girl. My last conversation with her was the night I left for basic. I was scared, I was leaving my home, my family, my friends. Possibly to never return. I text her looking for comfort and she was just a heartless bitch about it. It made me realize how ugly she was, that when someone was reaching out of assurance, even just plutonic assurance, she couldn't even be bothered to be supportive. I can honestly say I haven't talked to her, or even wanted to since that night.
Finally, what do I do on a particularly bad day: Like what if my pet dies or my wife and I have a fight?
I let myself feel shitty for a day. I don't try to hide from the anger, or the sadness or the frustration. I let myself feel and understand why I feel the way I feel, and then I move on from it. Whatever is, shall be, and once I've felt it, I don't need to dwell on it. I move on.
Solutions don't arise from inactivity or passivity. You have to be willing to be the change you want to see in your own life.