Skip to content

Commit

Permalink
Docker: Set pg17 as default, update documentation accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
ImreSamu authored and akorotkov committed Oct 29, 2024
1 parent f0438a1 commit 0ea9343
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM alpine:${ALPINE_VERSION}
ARG ALPINE_VERSION

# Set PG_MAJOR = [ 17 16 ]
ARG PG_MAJOR=16
ARG PG_MAJOR=17
ENV PG_MAJOR=${PG_MAJOR}

# set compiler: [ clang gcc ]
Expand Down Expand Up @@ -140,7 +140,7 @@ RUN set -eux; \
cd /usr/src/postgresql; \
\
POSTGRESQL_VERSION=$(grep "PACKAGE_VERSION=" ./configure | cut -d"'" -f2) ; \
echo "POSTGRESQL_VERSION=$POSTGRESQL_VERSION" ; \
echo "POSTGRESQL_VERSION=$POSTGRESQL_VERSION" ; \
\
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM ubuntu:${UBUNTU_VERSION}
ARG UBUNTU_VERSION

# Set PG_MAJOR = [ 17 16 ]
ARG PG_MAJOR=16
ARG PG_MAJOR=17
ENV PG_MAJOR=${PG_MAJOR}

# set compiler: [ clang gcc ]
Expand Down
8 changes: 4 additions & 4 deletions ci/docker_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -Eeo pipefail

# Default values
BASE_MATRIX="ubuntu:24.04"
PG_MAJOR="16"
PG_MAJOR="17"
COMPILER="clang"
DEBUG="false"
DRY_RUN="false"
Expand All @@ -18,8 +18,8 @@ base_lists[all-debian]="ubuntu:devel ubuntu:24.10 ubuntu:24.04 ubuntu:22.04 ubun
base_lists[all]="${base_lists[all-alpine]} ${base_lists[all-debian]}"

# Valid Alpine, Ubuntu, PG and Compiler versions
VALID_ALPINE_VERSIONS="edge 3.20 3.19 3.18 3.17 3.16 3.15 3.14"
VALID_UBUNTU_VERSIONS="devel 24.10 24.04 22.04 20.04 oracular noble jammy focal"
VALID_ALPINE_VERSIONS="edge 3.20 3.19 3.18 3.17 3.16 3.15 3.14 latest"
VALID_UBUNTU_VERSIONS="devel 24.10 24.04 22.04 20.04 oracular noble jammy focal latest rolling"
VALID_PG_MAJOR_VERSIONS="17 16"
VALID_COMPILERS="clang gcc"

Expand Down Expand Up @@ -72,7 +72,7 @@ and you can check the build logs with:
Examples:
./ci/docker_matrix.sh --base all-dev --pg-major all --compiler clang
./ci/docker_matrix.sh --base alpine:3.20 --pg-major 16 --compiler gcc --debug true
./ci/docker_matrix.sh --base alpine:3.20 --pg-major 17 --compiler gcc --debug true
./ci/docker_matrix.sh --base ubuntu:oracular --pg-major 16 --compiler all --debug false
Default behavior:
Expand Down
5 changes: 3 additions & 2 deletions ci/local_docker_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ pg_major_list=( 16 17)
compiler_list=( clang gcc )
base_list=(
# alpine versions
alpine:3.20
alpine:3.19
alpine:3.18
alpine:3.17
alpine:3.16
alpine:3.15
alpine:3.14
alpine:3.13

# ubuntu versions
ubuntu:23.10
ubuntu:24.10
ubuntu:24.04
ubuntu:22.04
ubuntu:20.04

Expand Down
78 changes: 34 additions & 44 deletions doc/docker_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,43 @@ Before you begin, make sure you have Docker installed on your local machine. If
Open a terminal and navigate to the OrioleDB project directory, if you are not already in it:
* `cd path/to/orioledb`

Build (Alpine) PostgreSQL 16 + OrioleDB extension:
Build (Alpine) PostgreSQL 17 + OrioleDB extension:

* `docker build -t orioletest:16 --pull --network=host --progress=plain --build-arg PG_MAJOR="16" .`
```bash
docker build -t orioletest:17 --pull --network=host --progress=plain --build-arg PG_MAJOR="17" .
```

Create a simple password for testing:
```
```bash
# echo -n OrioleDB | sha1sum
8f50c87b77ab9621c9ac8bb396d0630f306adcb0 -
```

Start server:

```
docker run --name orioletest16 \
-v orioletest16data:/var/lib/postgresql/data \
```bash
docker run --name orioletest17 \
-v orioletest17data:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=8f50c87b77ab9621c9ac8bb396d0630f306adcb0 \
-d orioletest:16
-d orioletest:17
```

Connect to the server via psql:

```
docker exec -ti orioletest16 psql -U postgres
```bash
docker exec -ti orioletest17 psql -U postgres
```

You should expect a similar psql message:
```
psql (16.4 OrioleDB public beta 5 PGTAG=patches16_31 alpine:3.20+clang build:2024-10-25T05:38:48+00:00 16.4)
```bash
psql (17.0 OrioleDB public beta 5 PGTAG=patches17_3 alpine:3.20+clang build:2024-10-25T19:54:25+00:00 17.0)
Type "help" for help.
postgres=#
```

Enable orioledb extension:

```
```sql
create extension if not exists orioledb;
```

Expand Down Expand Up @@ -143,49 +145,39 @@ postgres=# \dx+ orioledb
function pg_stopevents()
function s3_get(text)
function s3_put(text,text)
type orioledb_index
type orioledb_index[]
type orioledb_index_descr
type orioledb_index_descr[]
type orioledb_table
type orioledb_table[]
type orioledb_table_descr
type orioledb_table_descr[]
view orioledb_index
view orioledb_index_descr
view orioledb_table
view orioledb_table_descr
(43 rows)
(51 rows)
```

Quit from the database: `\q`


Stop the server:

* `docker stop orioletest16`
* `docker stop orioletest17`

Remove container:

* `docker container rm orioletest16`
* `docker container rm orioletest17`

Remove docker image:

* `docker rmi orioletest:16`
* `docker rmi orioletest:17`

Remove the data volume:

* `docker volume rm orioletest16data`

## Building Docker Images

To build a Docker image, use one of the following commands:

#### To build PostgreSQL 17 + OrieleDB extension (alpine)
```bash
docker build --pull --network=host --progress=plain \
--build-arg PG_MAJOR="17" \
-t orioletest:17 .
```

#### To build PostgreSQL 16 + OrieleDB extension (alpine)
```bash
docker build --pull --network=host --progress=plain \
--build-arg PG_MAJOR="16" \
-t orioletest:16 .
```
* `docker volume rm orioletest17data`

## Supported environment variables:

Expand All @@ -206,14 +198,14 @@ Read more: https://github.com/docker-library/docs/blob/master/postgres/README.m
Please check the Dockerfiles for the full list of build args!
- Alpine Linux: `./Dockerfile`
- supported [ `edge 3.20 3.19 3.18 3.17 3.16 3.15 3.14` ]
- example: `--build-arg ALPINE_VERSION="3.20"`
- example: `--build-arg ALPINE_VERSION="3.20" -f Dockerfile `
- Ubuntu Linux: `./Dockerfile.ubuntu`
- supported [ `devel 24.10 24.04 22.04 20.04 oracular noble jammy focal` ]
- example: `--build-arg UBUNTU_VERSION="24.04"`
- example: `--build-arg UBUNTU_VERSION="24.04" -f Dockerfile.ubuntu `

Other important build args:
* `--build-arg PG_MAJOR="16"`
* Choose the main version of PostgreSQL. Default is `16`.
* `--build-arg PG_MAJOR="17"`
* Choose the main version of PostgreSQL. Default is `17`.
* You can choose from `16`, `17`.
* `--build-arg BUILD_CC_COMPILER="gcc"`
* Choose the C compiler. Default is `clang`.
Expand All @@ -222,7 +214,7 @@ Other important build args:
For example, to build an image using Alpine version `3.20`, the `gcc` compiler and PostgreSQL version `16`, use the following command:

```bash
docker build --network=host --progress=plain \
docker build --pull --network=host --progress=plain \
--build-arg ALPINE_VERSION="3.20" \
--build-arg BUILD_CC_COMPILER="gcc" \
--build-arg PG_MAJOR="16" \
Expand All @@ -233,12 +225,12 @@ docker build --network=host --progress=plain \
To build an image using Ubuntu version `devel`, the `clang` compiler and PostgreSQL version `17`, use the following command:

```bash
docker build --network=host --progress=plain \
docker build --pull --network=host --progress=plain \
--build-arg UBUNTU_VERSION="devel" \
--build-arg BUILD_CC_COMPILER="clang" \
--build-arg PG_MAJOR="17" \
-f Dockerfile.ubuntu \
-t orioletest:17-clang-ubuntudevel .
-t orioletest:17-clang-ubuntu-devel .
```
The "devel" version is the latest development Ubuntu version, so it might not be stable.

Expand Down Expand Up @@ -317,5 +309,3 @@ PATH=/opt/homebrew/bin:/opt/homebrew/opt/gnu-getopt/bin:$PATH
* Windows: If you encounter any problems, please use Windows Subsystem for Linux (WSL2).

* Extending the current OrioleDB Docker images is not easy; you can't use Ubuntu PostgreSQL packages (like: `postgresql-16-mobilitydb`) - you need to build from source.

* Some secu
4 changes: 2 additions & 2 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ git clone "$OFFIMG_REPO_URL" "$OFFIMG_LOCAL_CLONE"
"${OFFIMG_LOCAL_CLONE}/test/run.sh" \
-c "${OFFIMG_LOCAL_CLONE}/test/config.sh" \
-c "test/orioledb-config.sh" \
"orioletest:16-gcc-ubuntu-22.04"
"orioletest:17-gcc-ubuntu-22.04"
```

If the test is ok, you can see:

```bash
testing orioletest:16-gcc-ubuntu-22.04
testing orioletest:17-gcc-ubuntu-22.04
'utc' [1/6]...passed
'no-hard-coded-passwords' [2/6]...passed
'override-cmd' [3/6]...passed
Expand Down

0 comments on commit 0ea9343

Please sign in to comment.