  Long gamma-ray bursts are produced during the dramatic deaths of massive
stars with very short lifetimes, meaning that they explode close to the birth
place of their progenitors. During a short period they become the most luminous
objects observable in the Universe, being perfect beacons to study
high-redshift star-forming regions. To use the afterglow of GRB 161023A at a
redshift $z=2.710$ as a background source to study the environment of the
explosion and the intervening systems along its line-of-sight. r the first
time, we complement UV/Optical/NIR spectroscopy with millimetre spectroscopy
using ALMA, which allows us to probe the molecular content of the host galaxy.
The X-shooter spectrum shows a plethora of absorption features including
fine-structure and metastable transitions of Fe, Ni, Si, C and O. We present
photometry ranging from 43 s to over 500 days after the burst. We infer a
host-galaxy metallicity of [Zn/H] $=-1.11\pm0.07$, which corrected for dust
depletion results in [X/H] $=-0.94\pm0.08$. We do not detect molecular features
in the ALMA data, but we derive limits on the molecular content of
$log(N_{CO}/cm^{-2})<15.7$ and $log(N_{HCO+}/cm^{-2})<13.2$, which are
consistent with those that we obtain from the optical spectra,
$log(N_{H_2}/cm^{-2})<15.2$ and $log(N_{CO}/cm^{-2})<14.5$. Within the host
galaxy we detect three velocity systems through UV/Optical/NIR absorption
spectroscopy, all with levels that were excited by the GRB afterglow. We
determine the distance from these systems to the GRB to be in the range between
0.7 and 1.0 kpc. The sight-line to GRB 161023A shows 9 independent intervening
systems, most of them with multiple components. (Abridged)
