forked from sclorg/postgresql-container
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sclorg#394 from hhorak/example-extension
Add example how to enable extension
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM registry.redhat.io/rhel8/postgresql-12 | ||
|
||
ADD . $APP_ROOT/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Extending PostgreSQL image by enabling extension | ||
================================================ | ||
|
||
This is an example how to use the feature of extending the image (see more at https://github.com/sclorg/postgresql-container/tree/generated/12#extending-image) to enable extension `pg_stat_statements`. | ||
|
||
To use this in a Dockerfile, run: | ||
|
||
``` | ||
podman build . -t my_postgresql:12 | ||
``` | ||
|
||
Then, run the resulting image as usually: | ||
|
||
``` | ||
podman run -d -e POSTGRESQL_ADMIN_PASSWORD=password my_postgresql:12 | ||
``` | ||
|
||
And see the extension is enabled: | ||
``` | ||
podman exec -ti -l bash | ||
bash-4.4$ psql | ||
psql (12.1) | ||
Type "help" for help. | ||
postgres=# \dx | ||
List of installed extensions | ||
Name | Version | Schema | Description | ||
---------+---------+------------+------------------------------ | ||
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language | ||
(1 row) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shared_preload_libraries='pg_stat_statements' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
echo "CREATE EXTENSION pg_stat_statements;" | psql |