Pull changes from upstream repository
This commit is contained in:
parent
228023ff21
commit
f409f0a74f
46 changed files with 5661 additions and 0 deletions
36
test/examples/s2i-dump-data/.s2i/bin/assemble
Executable file
36
test/examples/s2i-dump-data/.s2i/bin/assemble
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#! /usr/bin/bash -x
|
||||
|
||||
# fail early
|
||||
set -e
|
||||
|
||||
# source the convenience tooling
|
||||
source "${CONTAINER_SCRIPTS_PATH}/common.sh"
|
||||
|
||||
# set $PGDATA variable
|
||||
set_pgdata
|
||||
|
||||
# assert uninitialized data
|
||||
test ! -f "$PGDATA/postgresql.conf"
|
||||
|
||||
# empty config file is needed after 'initialize_database' call
|
||||
touch "$POSTGRESQL_CONFIG_FILE"
|
||||
|
||||
initialize_database
|
||||
|
||||
# start local PostgreSQL server (wait with '-w')
|
||||
pg_ctl -w start -o "-h ''"
|
||||
|
||||
# load all sql files
|
||||
shopt -s nullglob
|
||||
for file in /tmp/src/init/*.sql; do
|
||||
psql -f "$file"
|
||||
done
|
||||
|
||||
pg_ctl stop
|
||||
|
||||
# dump the data into $PWD (in-image storage)
|
||||
tar caf data.tar.xz -C "$PGDATA" .
|
||||
rm -rf "$PGDATA"
|
||||
|
||||
# install pre-start hook
|
||||
cp -r /tmp/src/postgresql-pre-start .
|
||||
2
test/examples/s2i-dump-data/init/init.sql
Normal file
2
test/examples/s2i-dump-data/init/init.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
CREATE TABLE test (sth TEXT);
|
||||
INSERT INTO test VALUES ('hello world');
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
if test ! -f "$PGDATA/postgresql.conf"; then
|
||||
tar xf "$APP_DATA"/src/data.tar.xz -C "$PGDATA"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue