Ion acceleration in electrostatic collisionless shock: on the optimal density profile for quasi-monoenergetic beams