Kaizen Today I Learned by Ville Säävuori

Testing Postgres + PostGIS on GitLab CI

Setting uo PostgreSQL + PostGIX extension for GitLab CI was easy once I figured out how to configure the needed services right way. Here’s the gist of my setup for testing a Django app:

  1. Use a main image that includes needed Postgres + PostGIS deps:

    image: 'registry.gitlab.com/uninen/docker-images/python-postgis:3.9'
    

    I use my own Python Docker images which are based on optimized Revsys Python images and come with most of the commonly needed system packages preinstalled for speedy build process and testing.

  2. Instead of the typical postgres-service configure an image with PostGIS. I used postgis/postgis:13-master like so:

    services:
    - name: postgis/postgis:13-master
        alias: postgres
        command: ['-c', 'fsync=off', '-c', 'synchronous_commit=off', '-c', 'full_page_writes=off']
    

The main thing here is the more verbose way to spell out the wanted service. You can use the same format for any Docker image.

Tagged with , , ,

Published . Last modified .