Add postgres to deployment
This commit is contained in:
parent
c8a8af9c18
commit
e097eb9c93
5 changed files with 58 additions and 56 deletions
|
|
@ -1,15 +1,7 @@
|
|||
#!/bin/bash
|
||||
echo "Running as $(whoami)..."
|
||||
|
||||
target_user='postgres'
|
||||
# This user shouldn't be mapped to postgres on the host but rather to postgres on the container.
|
||||
# This user has host uid: 558821 (in container it's uid: 70). This number is resolved by getting the start
|
||||
# of the subuid range for this user and then than adding 70 (-1) to it (since we know that that is the uid
|
||||
# of the postgres user within the container).
|
||||
target_path_subuid_start="$(su $target_user -c 'grep $USER /etc/subuid | cut -d ":" -f 2')"
|
||||
target_host_postgres_id=$(($target_path_subuid_start + 70 - 1))
|
||||
|
||||
certsPath="/home/$target_user/certs"
|
||||
certsPath="/home/postgres/certs"
|
||||
target_host_postgres_id=70
|
||||
|
||||
if [[ ! -e "$certsPath" ]]; then
|
||||
echo "Certs directory doesn't exist, creating certs directory: $certsPath..."
|
||||
|
|
@ -23,8 +15,6 @@ for srcPath in $cert_files; do
|
|||
cp -L "$srcPath" "$certsPath"
|
||||
|
||||
newFileName="$certsPath/$(basename $srcPath)"
|
||||
echo "Setting permissions for: $newFileName to uid: $target_host_postgres_id..."
|
||||
|
||||
chown "$target_host_postgres_id:$target_host_postgres_id" "$newFileName"
|
||||
chmod 0600 "$newFileName"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue