This is of my own opinion.
This is what I encourage to do.
1) Build up your troops
2) If you see an incoming attack, check if it's a Colony Ship speed or a different one.
A) If it's CS, if you have defensive units use them. Try to snipe the CS if there is incoming attacks prior to the CS. Make sure you activate militia at the last second too this way the CS hits Militia instead of the prior attacks.
B) If your pretty much offensive ground troops, recall them to make them hit the CS right after it lands and before the support starts rolling in. (Fun to do!) (This means CS is inbound)
3) If it's not a CS do the following
A) Spend all resources except enough to hide in your warehouse cave
B) Dodge with your troops
C) Activate Militia. (They can be re-activated every 3 hrs)
This tells the attacker that your active and they'll get no resources from you. This means they have to hit you with a CS to destroy your troops. If they want your city, they'll do it. If they want to make you a farm. They'll get tired of hitting only militia with no resource return. Their losing a profit from this and it discourages them from them making you into their farm. (I prefer turning 2k players into farms and at this stage of the game. It depends on which ocean/area your in. Right now my area is almost demanding conquest 3k pt villages instead of the 1k-2k. By the sounds of it, they want to make you a farm.
I wish you the best of luck also.
And the alliance join thing. Choose wisely. And do never leave in the middle of the war. That rumor spreads quickly in this game and you don't get a lot of rep for it. Alliance leaders will not like you in their alliance if you seek a new one because you bail in the middle of the war. The only exception is if your alliance is being dominated easily and your recruited by the winning side. Then it's a different story. It's all about politics.