IQSS / IQSS/dataverse

Docker compose postgres volume update

Open
#10,160 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Containers Original size: 50 Type: Bug
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

Currently the docker-compose-dev.yml file defines the postgres volume as the following:

    volumes:
      - ./docker-dev-volumes/postgresql/data:/var/lib/postgresql/data

https://github.com/IQSS/dataverse/blob/b15b89f794415662ed860178c8f857446477d7b9/docker-compose-dev.yml#L79C5-L80C70

I was not able to get the Docker container for postgres to run with this setting. It was throwing errors about setting permissions for /var/lib/postgresql/data. I'm thinking the better approach would be to use a volume of - ./init.sql:/docker-entrypoint-initdb.d/init.sql or similar since you should not need to worry about permissions. The docker-entrypoint-initdb.d is the default initialization point for postgres in Docker https://hub.docker.com/_/postgres/. This will be useful when creating Docker compose instances for testing things such as an API call to update an existing file, where you want a preconfigured database and data as a starting point.

Anyway, just making this a placeholder for discussion and a pull request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the postgres service and volume definition in docker-compose-dev.yml, then reproduce the reported permission error by starting the development Compose setup. Compare the current data-volume approach with the proposed docker-entrypoint-initdb.d/init.sql approach using the Postgres image documentation. Done means the container starts without the permission error and supports the intended preconfigured database setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, postgresql
Domain
databases, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.