Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfiles to qa citus packages #379

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

m3hm3t
Copy link

@m3hm3t m3hm3t commented Feb 5, 2025

No description provided.

@m3hm3t m3hm3t self-assigned this Feb 5, 2025
# Switch to postgres user before running PostgreSQL
USER postgres

# Initialize the database only if it's not already initialized
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can we have the database already initialized?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more robust, we can check for pg_control in /var/lib/postgresql/${PG_MAJOR}/main/global/, which ensures that the database directory is actually valid before skipping initialization.

RUN if [ ! -f "/var/lib/postgresql/${PG_MAJOR}/main/global/pg_control" ]; then \
       echo "Initializing new PostgreSQL database..."; \
       /usr/lib/postgresql/${PG_MAJOR}/bin/initdb -D /var/lib/postgresql/${PG_MAJOR}/main; \
    else \
       echo "Existing PostgreSQL database detected, skipping initdb."; \
    fi

Let me know if you think this approach works, and I can push an update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants