generated from oci/template
enforce proper file ownership
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 2m43s
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 2m43s
This commit is contained in:
parent
d7a6b77e57
commit
4f4bc97f3d
1 changed files with 23 additions and 0 deletions
|
@ -26,6 +26,12 @@ log_debug() {
|
|||
|
||||
log_info "Starting TAK Server Hybrid Container..."
|
||||
|
||||
# Ensure proper ownership of key directories
|
||||
log_debug "Enforcing ownership permissions..."
|
||||
chown -R tak:tak /opt/tak 2>/dev/null || true
|
||||
chown -R postgres:postgres /var/lib/postgresql 2>/dev/null || true
|
||||
log_debug "Ownership permissions enforced"
|
||||
|
||||
# Source helper scripts
|
||||
log_debug "Sourcing helper scripts..."
|
||||
source /scripts/tak-version.sh
|
||||
|
@ -130,11 +136,20 @@ else
|
|||
# Ensure permissions are correct on existing files
|
||||
log_debug "Ensuring correct permissions on existing TAK files..."
|
||||
/scripts/tak-extract.sh permissions /opt/tak tak:tak
|
||||
|
||||
# Also enforce ownership at the directory level
|
||||
log_debug "Enforcing TAK directory ownership..."
|
||||
chown -R tak:tak /opt/tak
|
||||
fi
|
||||
|
||||
# Start PostgreSQL
|
||||
log_info "Starting PostgreSQL..."
|
||||
|
||||
# Ensure PostgreSQL directories have correct ownership
|
||||
log_debug "Enforcing PostgreSQL directory ownership..."
|
||||
chown -R postgres:postgres /var/lib/postgresql
|
||||
chown -R postgres:postgres /var/run/postgresql 2>/dev/null || true
|
||||
|
||||
# Initialize PostgreSQL if not already done
|
||||
if [ ! -f /var/lib/postgresql/15/main/PG_VERSION ]; then
|
||||
log_info "Initializing PostgreSQL database cluster..."
|
||||
|
@ -183,6 +198,10 @@ EOF
|
|||
fi
|
||||
|
||||
log_info "PostgreSQL configuration completed"
|
||||
|
||||
# Ensure ownership is correct after configuration
|
||||
log_debug "Ensuring PostgreSQL ownership after configuration..."
|
||||
chown -R postgres:postgres /var/lib/postgresql/15/main
|
||||
else
|
||||
log_error "Failed to initialize PostgreSQL!"
|
||||
exit 1
|
||||
|
@ -223,6 +242,10 @@ EOF
|
|||
fi
|
||||
|
||||
log_debug "Configuration files checked/created"
|
||||
|
||||
# Ensure ownership is correct after any config file creation
|
||||
log_debug "Ensuring PostgreSQL ownership after config check..."
|
||||
chown -R postgres:postgres /var/lib/postgresql/15/main
|
||||
fi
|
||||
|
||||
# Start PostgreSQL server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue