-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow MIQ PG config overrides to be included #2
Allow MIQ PG config overrides to be included #2
Conversation
- Check for the existance of MIQ PG overrides, if available, include them in postgresql.conf - Defaults taken from https://github.com/ManageIQ/manageiq-appliance/blob/master/COPY/etc/manageiq/postgresql.conf.d/01_miq_overrides.conf - We use include_dir , so more configs can be stacked, PG will process *.conf in a given dir - POSTGRESQL_CONFIG_DIR is set via environment variable and can be customized at users convenience - Can be backported to euwe/4.5 builds to allow functionality to existing users
- Configmap object created with MIQ default overrides settings - Configmap is injected as a volume into /etc/manageiq/postgresql.conf.d by default - POSTGRESQL_CONFIG_DIR supplied to on template to allow flexibility on location - Related to PR : ManageIQ/container-postgresql#2 - PG image will pickup and do an include_dir if the directory is found The most important piece is that the configuration is externalized and parametized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me as long as the /etc/manageiq/postgresql.conf.d
directory exists.
I don't think we explicitly create that anywhere so if the configmap mount creates parent directories, then this is fine.
docker-assets/run-postgresql
Outdated
if [ -d "${POSTGRESQL_CONFIG_DIR}" ]; then | ||
cat >> "$PGDATA/postgresql.conf" <<EOF | ||
# Begin ManageIQ configuration overrides: | ||
include_dir '${POSTGRESQL_CONFIG_DIR}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check if this is already here to avoid having multiple entries in the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdunne Yep, working on another commit with slightly different logic for safety.
- Added a check to avoid creating multiple entries of the same config during reschedules - Create default directory location for PG_CONFIG_DIR on image not on scripts - Change default location for PG_CONFIG_DIR to a known writable location (avoid /etc)
@bdunne @carbonin A few changes :
|
docker-assets/run-postgresql
Outdated
|
||
# Check for POSTGRESQL_CONFIG_DIR presence in postgresql.conf, if already there skip. | ||
[[ $(grep ${POSTGRESQL_CONFIG_DIR} ${PGDATA}/postgresql.conf) ]] && RET=$? || RET=$? | ||
if [[ $RET == "0" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if [[ $? -eq 0 ]]
would be simpler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to avoid checking straight on $? , too many times things get in the middle by accident. That's why I chose to save status on a VAR. Script is run with set -eu and and very picky, will probably quit immediately on a false test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@carbonin @bdunne Please review, I have another PR coming with the corresponding configmaps and corresponding template modifications going to pods.
We stack after the default customs from SCL, this is how it looks on config :