Docker-compose does not have packages persistency

Hello guys! :lemon:
I’m deploying the docker compose installation of pulp3 but the packages don’t persist a reboot (docker compose down and docker compose up).
I’m using the compose.folder.yml with some minor changes to be automatically configured by and Ansible template.
Can you please help me find out why? The artifacts in pulp_storage seems to persist the reboot, but they are not shown when the API is queried. Could it be related to the postgres db?

compose.yml
version: '3'
services:
  postgres:
    image: "docker.io/library/postgres:13"
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: "{{ pulp3_postgres_user }}"
      POSTGRES_PASSWORD: "{{ pulp3_postgres_pw }}"
      POSTGRES_DB: "{{ pulp3_postgres_db }}"
      POSTGRES_INITDB_ARGS: '--auth-host=scram-sha-256'
      POSTGRES_HOST_AUTH_METHOD: 'scram-sha-256'
    volumes:
      - "{{ persistent_volumes_path }}/pgsql:/var/lib/postgresql:Z"
      - "./assets/postgres/passwd:/etc/passwd:Z"

  redis:
    image: "docker.io/library/redis:latest"
    volumes:
      - "{{ persistent_volumes_path }}/redis:/data"
    command: /bin/sh -c "redis-server --requirepass {{ pulp3_redis_pw }}"

  pulp_web:
    image: "pulp/pulp-web:latest"
    command: ['/usr/bin/nginx.sh']
    depends_on:
      - postgres
      - pulp_api
      - pulp_content
    ports:
      - "{{ default_local_port }}:8080"
    hostname: pulp
    user: root
    volumes:
      - "./assets/bin/nginx.sh:/usr/bin/nginx.sh:Z"
      - "./assets/nginx/nginx.conf.template:/etc/opt/rh/rh-nginx116/nginx/nginx.conf.template:Z"

  pulp_api:
    image: "pulp/pulp-minimal:latest"
    deploy:
      replicas: 2
    command: ['pulp-api']
    depends_on:
      - redis
      - postgres
    hostname: pulp-api
    user: pulp
    volumes:
      - "./assets/settings.py:/etc/pulp/settings.py:z"
      - "./assets/certs:/etc/pulp/certs:z"
      - "{{ persistent_volumes_path }}/pulp_storage:/var/lib/pulp:z"
    environment:
      POSTGRES_SERVICE_PORT: 5432
      POSTGRES_SERVICE_HOST: postgres
      PULP_ADMIN_PASSWORD: "{{ pulp3_postgres_pw }}"

  pulp_content:
    image: "pulp/pulp-minimal:latest"
    deploy:
      replicas: 2
    command: ['pulp-content']
    depends_on:
      - redis
      - postgres
    hostname: pulp-content
    user: pulp
    volumes:
      - "./assets/settings.py:/etc/pulp/settings.py:z"
      - "./assets/certs:/etc/pulp/certs:z"
      - "{{ persistent_volumes_path }}/pulp_storage:/var/lib/pulp:z"
    environment:
      POSTGRES_SERVICE_PORT: 5432
      POSTGRES_SERVICE_HOST: postgres

  pulp_worker:
    image: "pulp/pulp-minimal:latest"
    deploy:
        replicas: 2
    command: ['pulp-worker']
    depends_on:
      - redis
      - postgres
    user: pulp
    volumes:
      - "./assets/settings.py:/etc/pulp/settings.py:z"
      - "./assets/certs:/etc/pulp/certs:z"
      - "{{ persistent_volumes_path }}/pulp_storage:/var/lib/pulp:z"
    environment:
      POSTGRES_SERVICE_PORT: 5432
      POSTGRES_SERVICE_HOST: postgres

I’m aware that my version of the compose is not updated with the latest one, I tried to use older images too but the problem seems to persist.

By the way, I also run the docker compose up on the lastet compose file but the syntax seems to be wrong.
Am I missing something?
validating /home/repouser/pulp-oci-images/images/compose/compose.yml: services.pulp_api.depends_on.redis must be a mapping

It sounds like your Postgres data directory is not being persisted. Do you have a volume mounted for that directory? Similar to https://github.com/pulp/pulp-oci-images/blob/latest/images/compose/compose.folders.yml#L14

2 Likes

Looks like this is a known issue[0] that has an open PR to fix it[1]. I’ll see what needs to be done to get it merged.

[0] https://github.com/pulp/pulp-oci-images/issues/468
[1] https://github.com/pulp/pulp-oci-images/pull/477

3 Likes