We study a lattice model of attractive colloids. It is exactly solvable on sparse random graphs. As the pressure and temperature are varied it reproduces many characteristic phenomena of liquids, glasses and colloidal systems such as ideal gel formation, liquid-glass phase coexistence, jamming, or the reentrance of the glass transition.