diff --git a/_build_cfg.yml b/_build_cfg.yml index 42db41855baa..659d29793674 100644 --- a/_build_cfg.yml +++ b/_build_cfg.yml @@ -143,6 +143,8 @@ Topics: File: overview - Name: MySQL File: mysql + - Name: PostgreSQL + File: postgresql - Name: MongoDB File: mongodb diff --git a/openshift_images/postgresql.adoc b/openshift_images/postgresql.adoc new file mode 100644 index 000000000000..4bd64a6633a2 --- /dev/null +++ b/openshift_images/postgresql.adoc @@ -0,0 +1,91 @@ += PostgreSQL +{product-author} +{product-version} +:data-uri: +:icons: +:experimental: +:toc: macro +:toc-title: + +toc::[] + +== Overview +The OpenShift PostgreSQL database image https://github.com/openshift/postgresql[repository] contains the sources and Dockerfiles for building PostgreSQL database images. The resulting images can be run by Docker. + +== Versions +Currently supported versions of PostgreSQL: + +* https://github.com/openshift/postgresql/tree/master/9.2[9.2] + +== Base Images + +* RHEL-7 +* CentOS-7 + +[NOTE] +==== +RHEL-7 image is not available at https://registry.hub.docker.com/[Docker Hub]. In order to perform build action on a RHEL-7 based PostgreSQL image, you need to run the build on properly subscribed RHEL-7 machine. +==== + +== Installation +To build PostgreSQL image, choose between the CentOS7 or RHEL7 base image: + +=== RHEL-7 base image + +---- +$ git clone https://github.com/openshift/postgresql.git +$ cd postgresql +$ make build TARGET=rhel7 VERSION=5.5 +---- + +=== CentOS-7 base image + +---- +$ git clone https://github.com/openshift/postgresql.git +$ cd postgresql +$ make build VERSION=5.5 +---- + +[NOTE] +==== +By omitting the `VERSION` parameter, the build action will be performed on all the supported versions of PostgreSQL. Since we are now supporting only version `9.2`, you can omit this parameter. +==== + +== Usage +To create a container running PostgreSQL, you need to run following commands. + +=== RHEL-7 image + +---- +$ docker run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 openshift/postgresql-92-rhel7 +---- + +=== CentOS-7 image + +---- +$ docker run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 openshift/postgresql-92-centos7 +---- + +This will create a container named `postgresql_database`, with credentials `user:pass` and database `db`. To access and test if the application is running, run: +---- +$ psql postgresql://user:pass@127.0.0.1:5432/db <<< "SELECT 1;" +---- + +To properly stop the container: +---- +$ docker stop postgresql_database +---- + +== Environment variables + +* *POSTGRESQL_USER* - This variable specifies username for database user that will be created for your application to use. + +* *POSTGRESQL_PASSWORD* - Password for the *POSTGRESQL_USER*. + +* *POSTGRESQL_DATABASE* - Name of the database that will be created. *POSTGRESQL_USER* will have full rights to the database. + +* *POSTGRESQL_ADMIN_PASSWORD* - Password for the postgres user. This variable is optional. If not set, remote login to the postgres account will not be possible. Local connections from inside the container are always allowed without a password. + +== Volumes + +* */var/lib/pgsql/data* - This is the database cluster directory where PostgreSQL stores database files.