The City's residential permit guide spells out what a water heater installation has to include. Tank-type heaters need an expansion tank and every heater needs an isolation valve on the cold water pipe. A pan, where one is required, needs a 1-inch drain line to the outside or to an approved receptor. In a garage, the pilot light or electrical connection must sit 18 inches above the floor. Gas heaters in an enclosed space need upper and lower combustion air, and a tankless unit may need an upgraded gas line or electrical supply.
City Code explains why some of that matters. Section 50.003 describes thermal expansion, the pressure that builds as water heats, and says the chances of it increase dramatically when a heater is old or not well maintained. It recommends exercising the temperature and pressure relief valve at least once a year and replacing it at least every five years, and notes that scale can affect those valves. With well water averaging 7 grains of hardness, plan sediment flushing along with the valve checks.