What was going on before the Treaty of Versailles was World War I. The Treaty of Versailles was the peace treaty that was made after WWI ended.
Looking at the treaty itself, the most relevant aspect of the war was that Germany lost. Because Germany lost, the treaty was simply imposed upon them by the Allied Powers. The Germans did not really have any say in the terms of the treaty, they could either accept it or go back to fighting at a time when their military high command knew they could not win the war.
These were the circumstances that shaped the Treaty of Versailles.