How are they miserable? Most of them seem happy to be there. There are a number of examples of crew members choosing to remain on the Enterprise instead of taking cashier jobs because of the adventure of it.
The Enterprise is either a military vessel or a business vessel. The federation is a hierarchical corporate entity. In rhetoric it is benevolent. In reality they are constantly fighting wars. The Enterprise and its crew are constantly put in harm's way. They should all have some sort of PTSD by now, but magically don't. So yes they seem happy, but really what are they living for? Exploration and adventure, well that's all nice but eventually you actually want a life. Work is not life, and living on the Enterprise is not really living. It seems that you are on duty 24/7.