  A system of four super-Jupiter planets around HR 8799 is the first
multi-planet configuration discovered via the direct imaging technique. Despite
over decade of research, the system's architecture remains not fully resolved.
The main difficulty comes from still narrow observing window of ~20 years that
covers small arcs of orbits with periods from roughly 50 to 500 years. Soon
after the discovery it became clear that unconstrained best-fitting astrometric
configurations self-disrupt rapidly, due to strong mutual gravitational
interactions between ~10-Jupiter-mass companions. Recently, we showed that the
HR 8799 system may be long term stable when locked in a generalized Laplace
8:4:2:1 mean motion resonance (MMR) chain, and we constrained its orbits
through the planetary migration. Here we qualitatively improve this approach by
considering the MMR in terms of an exactly periodic configuration. This
assumption enables us to construct for the first time the self-consistent
$N$-body model of the long-term stable orbital architecture, using only
available astrometric positions of the planets relative to the star. We
independently determine planetary masses, which are consistent with
thermodynamic evolution, and the parallax overlapping to $1\sigma$ with the
most recent GAIA DR2 value. We also determine the global structure of the inner
and outer debris discs in the [8, 600] au range, consistent with the updated
orbital solution.
