As I play rather warmongerer style, I have to use a whole strategy to avoid getting invaded while my army is elsewhere (mostly developped on 2.7) :
I rather try to spread my first cities around the capital, and, if possible, keep several (varrying with map size, and strength of neighbours/worst ennemies, at least 4-5 to have an impact on an ennemy stack, on a large map) mobile units (move>2) in the capital. As attack stacks usually comprise several siege units, infantry will do the job fine (but if you level a mobile unit to level 3/4 and up, transfer it to attack stacks). This will allow speedy reinforcements where needed in my territory, be it for improvement defense or counterattacking an ennemy stack (best is to make sure you'll be able to get back to a city afterward).
When you spread a little more, you just have to choose strategical centers in your empire to position your mobile units.
Standard defense for cities will comprise 2 to 3 units in non-sensible cities, and 4 to 5 on the frontline. Not counting the mobile units.
If a AI stack of doom threatens a city, whether regroup as many units as possible in the city, leaving only two units in each neighbouring city, or abandon it and try to regroup elsewhere ( this can be done in this mod, 'cause buildings don't disappear at the first invasion, so you won't loose that much if you temporarily fall back)
Always keep an up-to-date road network between your cities, with roads going through the shortest way possible between each and every city.