Gex is a commune .
Gex is a commune in the Ain department in eastern France .