Random periodic processes, periodic measures and ergodicity