Terrestrial planets, with silicate mantles and metallic cores, are likely to obtain water and carbon compounds during accretion. Here I examine the conditions that allow early formation of a surface water ocean (simultaneous with cooling to clement surface conditions), and the timeline of degassing the planetary interior into the atmosphere. The greatest fraction of a planet's initial volatile budget is degassed into the atmosphere during the end of magma ocean solidification, leaving only a small fraction of the original volatiles to be released into the atmosphere through later volcanism. Rocky planets that accrete with water in their bulk mantle have two mechanisms for producing an early water ocean: First, if they accrete with at least 1 to 3 mass% of water in their bulk composition, liquid water may be extruded onto the planetary surface at the end of magma ocean solidification. Second, at initial water contents as low as 0.01 mass% or lower, during solidification a massive supercritical fluid and steam atmosphere is produced that collapses into a water ocean upon cooling. The low water contents required for this process indicate that rocky super-Earth exoplanets may be expected to commonly produce water oceans within tens to hundreds of millions of years of their last major accretionary impact, through collapse of their atmosphere.