Worker refuses to start without pg_hba.conf
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-10 14:59:41 +02:00
parent 34943eed1b
commit 7170112853

View File

@@ -196,7 +196,8 @@ func main() {
initDonePath := filepath.Join(targetDir, PostgresInitDoneFileName)
if _, err := os.Stat(initDonePath); err != nil && !os.IsNotExist(err) {
log.Fatal("Failed to access Postgres data directory")
} else if err != nil {
} else {
// Note: pg_auto_failure refuses to start without pg_hba.conf
log.WithFields(log.Fields{"path": targetDir}).Info("Postgres data dir is not initialized")
if state.hbaConfPath != "" {
go func() {
@@ -212,9 +213,10 @@ func main() {
}()
}
// Propagate the replication password
if err != nil {
// Database initialization as the storage is empty so propagate the replication password (in case this is a secondary)
// Note: There is no option to pass the replication password and even pg_autoctl create without --run already
// assumes it is present. Neither pg_autoctl config set works at this stage
// assumes it is present. Neither pg_autoctl config set works at this stage. So use PGPASSWORD
replEnvPassword := "PGPASSWORD=" + state.replicationPassword
replSet := false
initEnv := innerEnv
@@ -245,6 +247,7 @@ func main() {
log.WithError(err).Fatal("Failed to set password of user pgautofailover_replicator in the configuration")
}
}
}
innerArgs = append(innerArgs, "--run")
log.Info("Starting a worker node.")