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

Subscribers

People subscribed via source and target branches