chore(helm): changed psql commands to stop on first-script-error
This commit is contained in:
parent
23ea07042f
commit
ad1b2b304b
5 changed files with 6 additions and 6 deletions
|
|
@ -79,7 +79,7 @@ for file in $(ls *.sql); do
|
|||
echo -e ${green}${bold}Restoring $file ${reset}
|
||||
kubectl exec postgresql-postgresql-0 -- /bin/bash -c "rm -rf /tmp/$file"
|
||||
kubectl cp $file postgresql-postgresql-0:/tmp/
|
||||
kubectl exec postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -U postgres -f /tmp/$file" &> $cwd/postgresql_init.log
|
||||
kubectl exec postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -v ON_ERROR_STOP=1 -U postgres -f /tmp/$file" &> $cwd/postgresql_init.log
|
||||
echo -e ${green}${bold}Done ✔${reset}
|
||||
done
|
||||
cd $cwd
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ This operation could take some time depending on the database size.
|
|||
- Once you have the backup file, you can restore it with a command like the one below:
|
||||
|
||||
```console
|
||||
$ psql -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||
$ psql -v ON_ERROR_STOP=1 -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||
```
|
||||
|
||||
In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt).
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
file="{{ item|basename }}"
|
||||
kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "rm -rf /tmp/$file"
|
||||
kubectl cp -n db {{ item }} postgresql-postgresql-0:/tmp/
|
||||
kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -U postgres -f /tmp/$file" &> "{{ playbook_dir }}"/postgresql_init.log
|
||||
kubectl exec -n db postgresql-postgresql-0 -- /bin/bash -c "PGPASSWORD=asayerPostgres psql -v ON_ERROR_STOP=1 -U postgres -f /tmp/$file" &> "{{ playbook_dir }}"/postgresql_init.log
|
||||
args:
|
||||
chdir: db/init_dbs/postgresql
|
||||
with_fileglob: "{{ db_path }}"
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ This operation could take some time depending on the database size.
|
|||
- Once you have the backup file, you can restore it with a command like the one below:
|
||||
|
||||
```console
|
||||
$ psql -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||
$ psql -v ON_ERROR_STOP=1 -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||
```
|
||||
|
||||
In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt).
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ function migrate() {
|
|||
IFS=',' read -r -a migration_versions <<< "$1"
|
||||
for version in ${migration_versions[*]}; do
|
||||
echo "Migrating postgresql version $version"
|
||||
psql -f ${pgdir}/${version}/${version}.sql 2>&1
|
||||
psql -v ON_ERROR_STOP=1 -f ${pgdir}/${version}/${version}.sql 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
function init() {
|
||||
echo "Initializing postgresql"
|
||||
psql -f ${pgdir}/init_schema.sql 2>&1
|
||||
psql -v ON_ERROR_STOP=1 -f ${pgdir}/init_schema.sql 2>&1
|
||||
}
|
||||
|
||||
# /bin/bash postgresql.sh migrate $migration_versions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue