I'm trying to set up a CI flow for a Django application which relies on postgis with a Kubernetes executor under the runner. In trying to do so, I've hit several kinds of problem:
Trying to use
postgresas a service obviously isn't sufficient, but it fails sanely, reporting that/usr/share/postgresql/9.6/extensions/postgis.controlcan't be found. At this point, that's expected -- but I'm including it here because it serves as proof that the Django/PostgreSQL connection works fine, since the failure occurs when trying toCREATE EXTENSION 'postgis'from a database bootstrap script.Adding a
before_scriptstep toapt install -y postgis* postgresql-9.6-postgis-scriptsas recommended by an older answer on SO also fails in the same way. Because this is a k8s executor, I'm suspecting that this doesn't install postgis on the actual postgres host, resulting in the error. Adding afind /usr postgis.controlstep confirms that the file exists on the test runner container.I've also tried using the
mdillon/postgiscontainer often referenced as a solution to this, but no dice there: usinglocalhostas the database host in the Django app (which both works for plain postgres as well as being recommended by the docs for the k8s executor type) results in errors about postgres not being reachable atlocalhost:5432. Updating the hostname tomdillon__postgislikewise fails (but this is predictable since that DNS name format is only supposed to work on Docker executors).At this point, I've also tried creating a bespoke Dockerfile, but what I have mimics
mdillon/postgis's Dockerfile very closely (there are only so many ways to install postgis and copy the initdb script), and fails in the same way.
Is there any documented, or at least, working, way to get Postgres with postgis working under a k8s gitlab-runner executor?