Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _build_cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Topics:
File: overview
- Name: MySQL
File: mysql
- Name: PostgreSQL
File: postgresql
- Name: MongoDB
File: mongodb

Expand Down
91 changes: 91 additions & 0 deletions openshift_images/postgresql.adoc
Original file line number Diff line number Diff line change
@@ -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:[email protected]: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.