Merge ~athos-ribeiro/ubuntu-docker-images/+git/postgresql:13-21.04-fix-docs into ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:13-21.04

Proposed by Athos Ribeiro
Status: Merged
Merged at revision: 4d523a2dae331cdb45a3f22c163960f7cf1b065d
Proposed branch: ~athos-ribeiro/ubuntu-docker-images/+git/postgresql:13-21.04-fix-docs
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:13-21.04
Diff against target: 156 lines (+118/-4)
3 files modified
HACKING.md (+2/-2)
README.md (+114/-0)
data/postgres.yaml (+2/-2)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior Approve
Bryce Harrington Pending
Canonical Server Pending
Review via email: mp+408368@code.launchpad.net

Description of the change

Fix documentation metadata on current hirsute image.

After https://code.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/+merge/403515 was filed, we realized we were using the wrong branch for this OCI. When pointing to the correct branch, we added a regression in the docs, which were outdated in the new build branch.

This updates the documentation in such branch.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Athos.

21.04 is not an LTS release, so the docs will need to be fixed/regenerated (I'm leaving a comment below).

Other than that, this MP LGTM. Feel free to merge it once the LTS nit has been fixed.

review: Approve
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks, Sergio.

I fixed the issue and merged the MP!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/HACKING.md b/HACKING.md
2index ba09252..ce674bb 100644
3--- a/HACKING.md
4+++ b/HACKING.md
5@@ -1,7 +1,7 @@
6 # Contributing
7
8 In Ubuntu, Postgres is available as a `.deb` package. For this reason,
9-this image was built by installing the Postgres Ubuntu 20.04 LTS package
10+this image was built by installing the Postgres Ubuntu 21.04 package
11 inside a docker container.
12
13 In order to contribute to the Postgres OCI image, do the following:
14@@ -50,6 +50,6 @@ The repository containing the templates is located at:
15 https://code.launchpad.net/~canonical-server/ubuntu-docker-images/+git/templates
16
17 The specific data for this image's template can be found inside the
18-`data/` directory.
19+`data/` directory, in the image's own repository.
20
21
22diff --git a/README.md b/README.md
23new file mode 100644
24index 0000000..ffaf5cb
25--- /dev/null
26+++ b/README.md
27@@ -0,0 +1,114 @@
28+# Postgres | Ubuntu
29+
30+Current Postgres Docker Image from Ubuntu. Receives security updates and rolls to newer Postgres or Ubuntu LTS. This repository is exempted from per-user rate limits. For [LTS Docker Image](https://ubuntu.com/security/docker-images) versions of this image, see `lts/postgres`.
31+
32+
33+## About Postgres
34+
35+PostgreSQL is a powerful, open source object-relational database system. It is fully ACID compliant, has full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It includes most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation. Read more on the [PostgreSQL website](https://www.postgresql.org/docs/).
36+
37+
38+## Tags and Architectures
39+![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)
40+Up to 5 years free security maintenance `from lts/postgres`.
41+
42+![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)
43+Up to 10 years customer security maintenance `from store/canonical/postgres`.
44+
45+_Tags in italics are not available in ubuntu/postgres but are shown here for completeness._
46+
47+| Channel Tag | | | Currently | Architectures |
48+|---|---|---|---|---|
49+| **`13.4-21.04_beta`**    | | | Postgres 13.4 on Ubuntu 21.04 | `amd64`, `arm64`, `s390x` |
50+| _`track_risk`_ |
51+
52+Channel tag shows the most stable channel for that track ordered `stable`, `candidate`, `beta`, `edge`. More risky channels are always implicitly available. So if `beta` is listed, you can also pull `edge`. If `candidate` is listed, you can pull `beta` and `edge`. When `stable` is listed, all four are available. Images are guaranteed to progress through the sequence `edge`, `beta`, `candidate` before `stable`.
53+
54+
55+## Usage
56+
57+Launch this image locally:
58+
59+```sh
60+docker run -d --name postgres-container -e TZ=UTC -p 30432:5432 -e POSTGRES_PASSWORD=My:s3Cr3t/ ubuntu/postgres:13.4-21.04_beta
61+```
62+Access your PostgreSQL server at `localhost:30432`.
63+
64+#### Parameters
65+
66+| Parameter | Description |
67+|---|---|
68+| `-e TZ=UTC` | Timezone. |
69+| `-e POSTGRES_PASSWORD=secret` | Set the password for the superuser which is `postgres` by default. Bear in mind that to connect to the database in the same host the password is not needed but to access it via an external host (for instance another container) the password is needed. This option is **mandatory** and **must not be empty**. |
70+| `-e POSTGRES_USER=john` | Create a new user with superuser privileges. This is used in conjunction with `POSTGRES_PASSWORD`. |
71+| `-e POSTGRES_DB=db_test` | Set the name of the default database. |
72+| `-e POSTGRES_INITDB_ARGS="--data-checksums"` | Pass arguments to the `postgres initdb` call. |
73+| `-e POSTGRES_INITDB_WALDIR=/path/to/location` | Set the location of the Postgres transaction log. By default it is stored in a subdirectory of the main Postgres data folder (`PGDATA`). |
74+| `-e POSTGRES_HOST_AUTH_METHOD=trust` | Set the `auth-method` for `host` connections for `all` databases, `all` users, and `all` addresses. The following will be added to the `pg_hba.conf` if this option is passed: `host all all all $POSTGRES_HOST_AUTH_METHOD`. |
75+| `-e PGDATA=/path/to/location` | Set the location of the database files. The default is `/var/lib/postgresql/data`. |
76+| `-p 30432:5432` | Expose Postgres on `localhost:30432`. |
77+| `-v /path/to/postgresql.conf:/etc/postgresql/postgresql.conf` | Local [configuration file](https://www.postgresql.org/docs/12/index.html) `postgresql.conf` (try [this example](https://git.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/plain/examples/config/postgresql.conf)). |
78+| `-v /path/to/persisted/data:/var/lib/postgresql/data` | Persist data instead of initializing a new database every time you launch a new container. |
79+
80+#### Initialization Scripts
81+
82+One can also add initialization scripts to their containers. This includes `*.sql`, `.sql.gz`, and `*.sh` scripts, and you just need to put them inside the `/docker-entrypoint-initdb.d` directory inside the container. After Postgres initialization is done and the default database and user are created, the scripts are executed in the following order:
83+
84+* Run any `*.sql` files in alphabetically order. It will be executed with `POSTGRES_USER`.
85+* Run any executable `*.sh` scripts in alphabetically order.
86+* Source any non-executable `*.sh` scripts in alphabetically order.
87+
88+All of this is done before the Postgres service is started. Keep in mind if your `PGDATA` directory is not empty (contains pre-existing database) they will be left untouched.
89+
90+
91+#### Testing/Debugging
92+
93+To debug the container:
94+
95+```sh
96+docker logs -f postgres-container
97+```
98+
99+To get an interactive shell:
100+
101+```sh
102+docker exec -it postgres-container /bin/bash
103+```
104+
105+This image also includes the `psql` client for interactive container use:
106+
107+```sh
108+$ docker network create postgres-network
109+$ docker network connect postgres-network postgres-container
110+$ docker run -it --rm --network postgres-network ubuntu/postgres:13.4-21.04_beta psql -h postgres-container -U postgres
111+```
112+The password will be asked and you can enter `My:s3Cr3t/`. Now, you are logged in and can enjoy your new instance.
113+
114+## Deploy with Kubernetes
115+
116+Works with any Kubernetes; if you don't have one, we recommend you [install MicroK8s](https://microk8s.io/) and `microk8s.enable dns storage` then `snap alias microk8s.kubectl kubectl`.
117+
118+Download
119+[postgresql.conf](https://git.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/plain/examples/config/postgresql.conf) and
120+[postgres-deployment.yml](https://git.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/plain/examples/postgres-deployment.yml) and set `containers.postgres.image` in `postgres-deployment.yml` to your chosen channel tag (e.g. `ubuntu/postgres:13.4-21.04_beta`), then:
121+
122+```sh
123+kubectl create configmap postgres-config --from-file=main-config=postgresql.conf
124+kubectl apply -f postgres-deployment.yml
125+```
126+
127+You will now be able to connect to the Postgres server on `localhost:30306`.
128+
129+## Bugs and feature requests
130+
131+If you find a bug in our image or want to request a specific feature, please file a bug here:
132+
133+[https://bugs.launchpad.net/ubuntu-docker-images/+filebug](https://bugs.launchpad.net/ubuntu-docker-images/+filebug)
134+
135+Please title the bug "`postgres: <issue summary>`". Make sure to include the digest of the image you are using, from:
136+
137+```sh
138+docker images --no-trunc --quiet ubuntu/postgres:<tag>
139+```
140+
141+
142diff --git a/data/postgres.yaml b/data/postgres.yaml
143index a772c6b..fa84d0a 100644
144--- a/data/postgres.yaml
145+++ b/data/postgres.yaml
146@@ -3,8 +3,8 @@ main: true
147 repo: postgres
148 description: >
149 PostgreSQL is a powerful, open source object-relational database system. It is fully ACID compliant, has full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It includes most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation. Read more on the [PostgreSQL website](https://www.postgresql.org/docs/).
150-version: "12.4"
151-base: Ubuntu 20.04 LTS
152+version: "13.4"
153+base: Ubuntu 21.04
154 architectures:
155 - amd64
156 - arm64

Subscribers

People subscribed via source and target branches