Engineering resilient collective adaptive systems by self-stabilisation