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

Proposed by Athos Ribeiro
Status: Merged
Merge reported by: Athos Ribeiro
Merged at revision: 33c5ebfdc3379d3b415d0fcac51b304f2e668ab4
Proposed branch: ~athos-ribeiro/ubuntu-docker-images/+git/postgresql:13-21.10-wip
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:13-21.04
Diff against target: 171 lines (+120/-5)
4 files modified
Dockerfile (+1/-1)
HACKING.md (+2/-2)
README.md (+114/-0)
data/postgres.yaml (+3/-2)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior Approve
Bryce Harrington Pending
Canonical Server Pending
Review via email: mp+408369@code.launchpad.net

Description of the change

This proposal is for the creation of the new impish branch for postgres.

Note that this MP was filed for 13-21.04 for review purposes only. After approval, a new 13-21.10 branch will be created.

This deprecates https://code.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/+merge/403515

Note that this build is blocked on https://bugs.launchpad.net/bugs/1943049

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

Thanks, Athos.

The docs will need to be fixed/regenerated because 21.10 is not an LTS release (I left a comment below).

Otherwise, the MP LGTM and I'm approving it, even though I haven't been able to build & test the image due to the base image bug.

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

Thanks, Sergio!

I fixed the issue and pushed the new branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Dockerfile b/Dockerfile
2index 1e624d0..fb7457b 100644
3--- a/Dockerfile
4+++ b/Dockerfile
5@@ -1,5 +1,5 @@
6 # vim:set ft=dockerfile:
7-FROM ubuntu:hirsute
8+FROM ubuntu:impish
9
10 ENV TZ UTC
11 ENV DEBIAN_FRONTEND noninteractive
12diff --git a/HACKING.md b/HACKING.md
13index ba09252..0de5bbc 100644
14--- a/HACKING.md
15+++ b/HACKING.md
16@@ -1,7 +1,7 @@
17 # Contributing
18
19 In Ubuntu, Postgres is available as a `.deb` package. For this reason,
20-this image was built by installing the Postgres Ubuntu 20.04 LTS package
21+this image was built by installing the Postgres Ubuntu 21.10 package
22 inside a docker container.
23
24 In order to contribute to the Postgres OCI image, do the following:
25@@ -50,6 +50,6 @@ The repository containing the templates is located at:
26 https://code.launchpad.net/~canonical-server/ubuntu-docker-images/+git/templates
27
28 The specific data for this image's template can be found inside the
29-`data/` directory.
30+`data/` directory, in the image's own repository.
31
32
33diff --git a/README.md b/README.md
34new file mode 100644
35index 0000000..a75f9ed
36--- /dev/null
37+++ b/README.md
38@@ -0,0 +1,114 @@
39+# Postgres | Ubuntu
40+
41+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`.
42+
43+
44+## About Postgres
45+
46+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/).
47+
48+
49+## Tags and Architectures
50+![LTS](https://assets.ubuntu.com/v1/0a5ff561-LTS%402x.png?h=17)
51+Up to 5 years free security maintenance `from lts/postgres`.
52+
53+![ESM](https://assets.ubuntu.com/v1/572f3fbd-ESM%402x.png?h=17)
54+Up to 10 years customer security maintenance `from store/canonical/postgres`.
55+
56+_Tags in italics are not available in ubuntu/postgres but are shown here for completeness._
57+
58+| Channel Tag | | | Currently | Architectures |
59+|---|---|---|---|---|
60+| **`13.4-21.10_beta`**    | | | Postgres 13.4 on Ubuntu 21.10 | `amd64`, `arm64`, `ppc64el`, `s390x` |
61+| _`track_risk`_ |
62+
63+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`.
64+
65+
66+## Usage
67+
68+Launch this image locally:
69+
70+```sh
71+docker run -d --name postgres-container -e TZ=UTC -p 30432:5432 -e POSTGRES_PASSWORD=My:s3Cr3t/ ubuntu/postgres:13.4-21.10_beta
72+```
73+Access your PostgreSQL server at `localhost:30432`.
74+
75+#### Parameters
76+
77+| Parameter | Description |
78+|---|---|
79+| `-e TZ=UTC` | Timezone. |
80+| `-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**. |
81+| `-e POSTGRES_USER=john` | Create a new user with superuser privileges. This is used in conjunction with `POSTGRES_PASSWORD`. |
82+| `-e POSTGRES_DB=db_test` | Set the name of the default database. |
83+| `-e POSTGRES_INITDB_ARGS="--data-checksums"` | Pass arguments to the `postgres initdb` call. |
84+| `-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`). |
85+| `-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`. |
86+| `-e PGDATA=/path/to/location` | Set the location of the database files. The default is `/var/lib/postgresql/data`. |
87+| `-p 30432:5432` | Expose Postgres on `localhost:30432`. |
88+| `-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)). |
89+| `-v /path/to/persisted/data:/var/lib/postgresql/data` | Persist data instead of initializing a new database every time you launch a new container. |
90+
91+#### Initialization Scripts
92+
93+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:
94+
95+* Run any `*.sql` files in alphabetically order. It will be executed with `POSTGRES_USER`.
96+* Run any executable `*.sh` scripts in alphabetically order.
97+* Source any non-executable `*.sh` scripts in alphabetically order.
98+
99+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.
100+
101+
102+#### Testing/Debugging
103+
104+To debug the container:
105+
106+```sh
107+docker logs -f postgres-container
108+```
109+
110+To get an interactive shell:
111+
112+```sh
113+docker exec -it postgres-container /bin/bash
114+```
115+
116+This image also includes the `psql` client for interactive container use:
117+
118+```sh
119+$ docker network create postgres-network
120+$ docker network connect postgres-network postgres-container
121+$ docker run -it --rm --network postgres-network ubuntu/postgres:13.4-21.10_beta psql -h postgres-container -U postgres
122+```
123+The password will be asked and you can enter `My:s3Cr3t/`. Now, you are logged in and can enjoy your new instance.
124+
125+## Deploy with Kubernetes
126+
127+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`.
128+
129+Download
130+[postgresql.conf](https://git.launchpad.net/~canonical-server/ubuntu-docker-images/+git/postgresql/plain/examples/config/postgresql.conf) and
131+[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.10_beta`), then:
132+
133+```sh
134+kubectl create configmap postgres-config --from-file=main-config=postgresql.conf
135+kubectl apply -f postgres-deployment.yml
136+```
137+
138+You will now be able to connect to the Postgres server on `localhost:30306`.
139+
140+## Bugs and feature requests
141+
142+If you find a bug in our image or want to request a specific feature, please file a bug here:
143+
144+[https://bugs.launchpad.net/ubuntu-docker-images/+filebug](https://bugs.launchpad.net/ubuntu-docker-images/+filebug)
145+
146+Please title the bug "`postgres: <issue summary>`". Make sure to include the digest of the image you are using, from:
147+
148+```sh
149+docker images --no-trunc --quiet ubuntu/postgres:<tag>
150+```
151+
152+
153diff --git a/data/postgres.yaml b/data/postgres.yaml
154index a772c6b..3e859f9 100644
155--- a/data/postgres.yaml
156+++ b/data/postgres.yaml
157@@ -3,11 +3,12 @@ main: true
158 repo: postgres
159 description: >
160 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/).
161-version: "12.4"
162-base: Ubuntu 20.04 LTS
163+version: "13.4"
164+base: Ubuntu 21.10
165 architectures:
166 - amd64
167 - arm64
168+ - ppc64el
169 - s390x
170 docker:
171 parameters:

Subscribers

People subscribed via source and target branches