Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
tlocke committed Sep 29, 2024
1 parent 288f67f commit 4bbd879
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/postgres_server/init_scripts/pg8000-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cat > /var/lib/postgresql/data/pg_hba.conf <<EOF
host pg8000_md5 all 0.0.0.0/0 md5
host pg8000_gss all 0.0.0.0/0 gss
host pg8000_password all 0.0.0.0/0 password
host pg8000_scram_sha_256 all 0.0.0.0/0 scram-sha-256
host all all 0.0.0.0/0 trust
EOF

# Create a user and database with the same name as the "outside" user,
#in order for code in readme.md tests to work

createuser "${OUTSIDE_USER}"
createdb "${OUTSIDE_USER}"
8 changes: 8 additions & 0 deletions test/postgres_server/init_scripts/pg8000-init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ALTER SYSTEM SET ssl = on;
ALTER SYSTEM SET ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem';
ALTER SYSTEM SET ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key';
ALTER SYSTEM SET password_encryption = 'scram-sha-256';
ALTER SYSTEM SET log_statement = 'all';
CREATE EXTENSION hstore;

CREATE DATABASE pg8000_gss;
16 changes: 16 additions & 0 deletions test/postgres_server/run_test_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# This script will fire up a local postgresql test server using podman

base_path=$(dirname "$0")

podman run \
--interactive \
--tty \
--rm \
--publish 127.0.0.1:5432:5432 \
--env POSTGRES_PASSWORD=pw \
--env OUTSIDE_USER="$USER" \
--mount type=bind,source="$base_path/init-scripts",target=/docker-entrypoint-initdb.d \
--name pg8000-test-server \
docker.io/library/postgres:latest "$@"

0 comments on commit 4bbd879

Please sign in to comment.