train carriage rig

Hi guys,

I’ve made a simple train model which sits on a simple track which will eventually curve up, down, left and right.

As you can see there is a sphere between the carriages which I have set the carriage origin to. My question is, how would I go about rigging this so that the carriages follow each other and have them follow the curve if the rail?

Many thanks