Skip to content

Commit 9741028

Browse files
committed
Merge branch 'master' into dan-org-nav
2 parents 2418465 + 49babb6 commit 9741028

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2190
-1311
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ jobs:
1010
working-directory: pgml-extension
1111
steps:
1212
- uses: actions/checkout@v4
13-
with:
14-
submodules: 'recursive'
1513
- name: Fetch master
1614
run: |
1715
git fetch origin master --depth 1
@@ -45,27 +43,27 @@ jobs:
4543
~/.cargo
4644
pgml-extension/target
4745
~/.pgrx
48-
key: ${{ runner.os }}-rust-1.74-${{ hashFiles('pgml-extension/Cargo.lock') }}-bust2
46+
key: ${{ runner.os }}-rust-1.74-${{ hashFiles('pgml-extension/Cargo.lock') }}-bust3
4947
- name: Install pgrx
5048
if: steps.pgml_extension_changed.outputs.PGML_EXTENSION_CHANGED_FILES != '0'
5149
run: |
5250
curl https://sh.rustup.rs -sSf | sh -s -- -y
5351
source ~/.cargo/env
54-
cargo install cargo-pgrx --version "0.11.2" --locked
52+
cargo install cargo-pgrx --version "0.12.9" --locked
5553
5654
if [[ ! -d ~/.pgrx ]]; then
5755
cargo pgrx init
58-
echo "shared_preload_libraries = 'pgml'" >> ~/.pgrx/data-16/postgresql.conf
56+
echo "shared_preload_libraries = 'pgml'" >> ~/.pgrx/data-17/postgresql.conf
5957
fi
6058
- name: Update extension test
6159
if: steps.pgml_extension_changed.outputs.PGML_EXTENSION_CHANGED_FILES != '0'
6260
run: |
6361
git checkout origin/master
6462
echo "\q" | cargo pgrx run
65-
psql -p 28816 -h localhost -d pgml -P pager -c "DROP EXTENSION IF EXISTS pgml CASCADE; DROP SCHEMA IF EXISTS pgml CASCADE; CREATE EXTENSION pgml;"
63+
psql -p 28817 -h localhost -d pgml -P pager -c "DROP EXTENSION IF EXISTS pgml CASCADE; DROP SCHEMA IF EXISTS pgml CASCADE; CREATE EXTENSION pgml;"
6664
git checkout $GITHUB_SHA
6765
echo "\q" | cargo pgrx run
68-
psql -p 28816 -h localhost -d pgml -P pager -c "ALTER EXTENSION pgml UPDATE;"
66+
psql -p 28817 -h localhost -d pgml -P pager -c "ALTER EXTENSION pgml UPDATE;"
6967
- name: Unit tests
7068
if: steps.pgml_extension_changed.outputs.PGML_EXTENSION_CHANGED_FILES != '0'
7169
run: |
@@ -74,4 +72,4 @@ jobs:
7472
if: steps.pgml_extension_changed.outputs.PGML_EXTENSION_CHANGED_FILES != '0'
7573
run: |
7674
echo "\q" | cargo pgrx run
77-
psql -p 28816 -h 127.0.0.1 -d pgml -P pager -f tests/test.sql
75+
psql -p 28817 -h 127.0.0.1 -d pgml -P pager -f tests/test.sql

.github/workflows/ubuntu-packages-and-docker-image.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
packageVersion:
7-
default: "2.9.3"
7+
default: "2.10.0"
88
jobs:
99
#
1010
# PostgresML extension.
@@ -72,11 +72,13 @@ jobs:
7272
libpq-dev \
7373
libclang-dev \
7474
wget \
75+
postgresql-17 \
7576
postgresql-16 \
7677
postgresql-15 \
7778
postgresql-14 \
7879
postgresql-13 \
7980
postgresql-12 \
81+
postgresql-server-dev-17 \
8082
postgresql-server-dev-16 \
8183
postgresql-server-dev-15 \
8284
postgresql-server-dev-14 \
@@ -98,13 +100,13 @@ jobs:
98100
with:
99101
working-directory: pgml-extension
100102
command: install
101-
args: cargo-pgrx --version "0.11.2" --locked
103+
args: cargo-pgrx --version "0.12.9" --locked
102104
- name: pgrx init
103105
uses: postgresml/gh-actions-cargo@master
104106
with:
105107
working-directory: pgml-extension
106108
command: pgrx
107-
args: init --pg12=/usr/lib/postgresql/12/bin/pg_config --pg13=/usr/lib/postgresql/13/bin/pg_config --pg14=/usr/lib/postgresql/14/bin/pg_config --pg15=/usr/lib/postgresql/15/bin/pg_config --pg16=/usr/lib/postgresql/16/bin/pg_config
109+
args: init --pg12=/usr/lib/postgresql/12/bin/pg_config --pg13=/usr/lib/postgresql/13/bin/pg_config --pg14=/usr/lib/postgresql/14/bin/pg_config --pg15=/usr/lib/postgresql/15/bin/pg_config --pg16=/usr/lib/postgresql/16/bin/pg_config --pg17=/usr/lib/postgresql/17/bin/pg_config
108110
- name: Build Postgres 12
109111
uses: postgresml/gh-actions-cargo@master
110112
with:
@@ -135,6 +137,12 @@ jobs:
135137
working-directory: pgml-extension
136138
command: pgrx
137139
args: package --pg-config /usr/lib/postgresql/16/bin/pg_config
140+
- name: Build Postgres 17
141+
uses: postgresml/gh-actions-cargo@master
142+
with:
143+
working-directory: pgml-extension
144+
command: pgrx
145+
args: package --pg-config /usr/lib/postgresql/17/bin/pg_config
138146
- name: Build debs
139147
env:
140148
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ docker run \
8282
-v postgresml_data:/var/lib/postgresql \
8383
-p 5433:5432 \
8484
-p 8000:8000 \
85-
ghcr.io/postgresml/postgresml:2.7.12 \
85+
ghcr.io/postgresml/postgresml:2.10.0 \
8686
sudo -u postgresml psql -d postgresml
8787
```
8888

docker/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
1+
FROM nvidia/cuda:12.6.3-devel-ubuntu24.04
22
ENV PATH="/usr/local/cuda/bin:${PATH}"
33
RUN apt update && \
44
apt install -y \
@@ -15,8 +15,8 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | te
1515

1616
ENV TZ=UTC
1717
ENV DEBIAN_FRONTEND=noninteractive
18-
RUN apt update -y && apt install git postgresml-15 postgresml-dashboard -y
19-
RUN git clone --branch v0.5.0 https://github.com/pgvector/pgvector && \
18+
RUN apt update -y && apt install git postgresml-17 postgresml-dashboard -y
19+
RUN git clone --branch v0.8.0 https://github.com/pgvector/pgvector && \
2020
cd pgvector && \
2121
echo "trusted = true" >> vector.control && \
2222
make && \
@@ -25,7 +25,7 @@ echo "trusted = true" >> vector.control && \
2525
COPY entrypoint.sh /app/entrypoint.sh
2626
COPY dashboard.sh /app/dashboard.sh
2727

28-
COPY --chown=postgres:postgres local_dev.conf /etc/postgresql/15/main/conf.d/01-local_dev.conf
29-
COPY --chown=postgres:postgres pg_hba.conf /etc/postgresql/15/main/pg_hba.conf
28+
COPY --chown=postgres:postgres local_dev.conf /etc/postgresql/17/main/conf.d/01-local_dev.conf
29+
COPY --chown=postgres:postgres pg_hba.conf /etc/postgresql/17/main/pg_hba.conf
3030

3131
ENTRYPOINT ["bash", "/app/entrypoint.sh"]

docker/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ sudo -u postgres psql -c "CREATE ROLE postgresml PASSWORD 'postgresml' SUPERUSER
1313
sudo -u postgres createdb postgresml --owner postgresml 2> /dev/null 1>&2
1414
sudo -u postgres psql -c 'ALTER ROLE postgresml SET search_path TO public,pgml' 2> /dev/null 1>&2
1515

16+
# Create the vector extension
17+
sudo -u postgres psql -c 'CREATE EXTENSION vector' 2> /dev/null 1>&2
18+
1619
echo "Starting dashboard"
1720
PGPASSWORD=postgresml psql -c 'CREATE EXTENSION IF NOT EXISTS pgml' \
1821
-d postgresml \

packages/postgresml-dashboard/build.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#!/bin/bash
22
set -e
33

4+
# Parse arguments
5+
PACKAGE_VERSION=${1:-"2.10.0"}
6+
UBUNTU_VERSION=${2:-"22.04"}
7+
8+
if [[ -z "$PACKAGE_VERSION" ]]; then
9+
echo "postgresml dashboard build script"
10+
echo "Usage: $0 <package version> [ubuntu version]"
11+
echo "Example: $0 2.10.0 22.04"
12+
exit 1
13+
fi
14+
15+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
416
dir="/tmp/postgresml-dashboard"
517
deb_dir="$dir/deb-build"
618
source_dir="$dir/source"
7-
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8-
export PACKAGE_VERSION=${1:-"2.7.12"}
19+
20+
export PACKAGE_VERSION
21+
export UBUNTU_VERSION
922
export GITHUB_STARS=$(curl -s "https://api.github.com/repos/postgresml/postgresml" | grep stargazers_count | cut -d : -f 2 | tr -d " " | tr -d ",")
1023
if [[ $(arch) == "x86_64" ]]; then
1124
export ARCH=amd64
@@ -27,7 +40,7 @@ rm "$deb_dir/release.sh"
2740
cp -R static "$deb_dir/usr/share/pgml-dashboard/dashboard-static" && \
2841
cp -R ../pgml-cms "$deb_dir/usr/share/pgml-cms" )
2942

30-
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst) > "$deb_dir/DEBIAN/control"
43+
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PACKAGE_VERSION} ${UBUNTU_VERSION} ${ARCH}') > "$deb_dir/DEBIAN/control"
3144
(cat ${SCRIPT_DIR}/etc/systemd/system/pgml-dashboard.service | envsubst) > "$deb_dir/etc/systemd/system/pgml-dashboard.service"
3245

3346
chmod 755 ${deb_dir}/DEBIAN/post*
@@ -36,6 +49,6 @@ chmod 755 ${deb_dir}/DEBIAN/pre*
3649
dpkg-deb \
3750
--root-owner-group \
3851
--build "$deb_dir" \
39-
postgresml-dashboard-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb
52+
"postgresml-dashboard-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-${ARCH}.deb"
4053

4154
rm -rf "$dir"

packages/postgresml-dashboard/release.sh

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,60 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
package_version="$1"
66

77
if [[ -z "$package_version" ]]; then
8-
echo "Usage: $0 <package version, e.g. 2.7.12>"
8+
echo "postgresml dashboard package build and release script"
9+
echo "Usage: $0 <package version, e.g. 2.10.0>"
910
exit 1
1011
fi
1112

12-
if [[ $(arch) == "x86_64" ]]; then
13-
export ARCH=amd64
14-
else
15-
export ARCH=arm64
16-
fi
13+
# Active LTS Ubuntu versions and their codenames
14+
declare -A ubuntu_versions=(
15+
["20.04"]="focal"
16+
["22.04"]="jammy"
17+
["24.04"]="noble"
18+
)
19+
20+
# Supported architectures
21+
declare -a architectures=("amd64" "arm64")
1722

23+
# Install deb-s3 if not present
1824
if ! which deb-s3; then
1925
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
2026
sudo gem install deb-s3-0.11.4.gem
2127
deb-s3
2228
fi
2329

2430
function package_name() {
25-
echo "postgresml-dashboard-${package_version}-ubuntu22.04-${ARCH}.deb"
31+
local ubuntu_version=$1
32+
local arch=$2
33+
echo "postgresml-dashboard-${package_version}-ubuntu${ubuntu_version}-${arch}.deb"
2634
}
2735

28-
bash ${SCRIPT_DIR}/build.sh "$package_version"
36+
# Loop through Ubuntu versions
37+
for ubuntu_version in "${!ubuntu_versions[@]}"; do
38+
codename=${ubuntu_versions[$ubuntu_version]}
39+
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
2940

30-
if [[ ! -f $(package_name) ]]; then
31-
echo "File $(package_name) doesn't exist"
32-
exit 1
33-
fi
41+
# Loop through architectures
42+
for arch in "${architectures[@]}"; do
43+
echo "Building for architecture: ${arch}"
44+
export ARCH=${arch}
45+
46+
# Build the dashboard package
47+
bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version"
48+
49+
if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then
50+
echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist"
51+
exit 1
52+
fi
53+
54+
# Upload to S3
55+
deb-s3 upload \
56+
--lock \
57+
--bucket apt.postgresml.org \
58+
$(package_name ${ubuntu_version} ${arch}) \
59+
--codename ${codename}
3460

35-
deb-s3 upload \
36-
--lock \
37-
--bucket apt.postgresml.org \
38-
$(package_name) \
39-
--codename $(lsb_release -cs)
61+
# Clean up the package file
62+
rm $(package_name ${ubuntu_version} ${arch})
63+
done
64+
done

packages/postgresml-python/DEBIAN/postinst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/bin/bash
2-
#
3-
#
4-
#
52
set -e
63

74
# Setup virtualenv

packages/postgresml-python/build.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,52 @@
11
#!/bin/bash
2-
#
3-
#
4-
#
52
set -e
3+
64
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
75
deb_dir="/tmp/postgresml-python/deb-build"
8-
major=${1:-"14"}
96

10-
export PACKAGE_VERSION=${1:-"2.7.12"}
11-
export PYTHON_VERSION=${2:-"3.10"}
7+
# Parse arguments with defaults
8+
export PACKAGE_VERSION=${1:-"2.10.0"}
9+
export UBUNTU_VERSION=${2:-"22.04"}
10+
export PYTHON_VERSION=${3:-"3.10"}
1211

12+
# Handle architecture
1313
if [[ $(arch) == "x86_64" ]]; then
1414
export ARCH=amd64
1515
else
1616
export ARCH=arm64
1717
fi
1818

19+
# Map Ubuntu versions to Python versions if needed
20+
# For example: Ubuntu 20.04 uses Python 3.8 by default
21+
declare -A ubuntu_python_versions=(
22+
["20.04"]="3.8"
23+
["22.04"]="3.10"
24+
["24.04"]="3.11"
25+
)
26+
27+
if [[ -z "$3" ]]; then
28+
PYTHON_VERSION=${ubuntu_python_versions[$UBUNTU_VERSION]:-"3.10"}
29+
fi
30+
1931
rm -rf "$deb_dir"
2032
mkdir -p "$deb_dir"
2133

2234
cp -R ${SCRIPT_DIR}/* "$deb_dir"
2335
rm "$deb_dir/build.sh"
2436
rm "$deb_dir/release.sh"
2537

26-
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst) > "$deb_dir/DEBIAN/control"
27-
(cat ${SCRIPT_DIR}/DEBIAN/postinst | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/postinst"
28-
(cat ${SCRIPT_DIR}/DEBIAN/prerm | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/prerm"
29-
(cat ${SCRIPT_DIR}/DEBIAN/postrm | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/postrm"
38+
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PACKAGE_VERSION} ${UBUNTU_VERSION} ${ARCH} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/control"
39+
(cat ${SCRIPT_DIR}/DEBIAN/postinst | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postinst"
40+
(cat ${SCRIPT_DIR}/DEBIAN/prerm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/prerm"
41+
(cat ${SCRIPT_DIR}/DEBIAN/postrm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postrm"
3042

3143
if [[ "$ARCH" == "amd64" ]]; then
3244
cp ${SCRIPT_DIR}/../../pgml-extension/requirements.linux.txt "$deb_dir/etc/postgresml-python/requirements.txt"
3345
else
3446
cp ${SCRIPT_DIR}/../../pgml-extension/requirements.macos.txt "$deb_dir/etc/postgresml-python/requirements.txt"
3547
fi
3648

37-
virtualenv --python="python$PYTHON_VERSION" "$deb_dir/var/lib/postgresml-python/pgml-venv"
49+
virtualenv --python="python${PYTHON_VERSION}" "$deb_dir/var/lib/postgresml-python/pgml-venv"
3850
source "$deb_dir/var/lib/postgresml-python/pgml-venv/bin/activate"
3951

4052
python -m pip install -r "${deb_dir}/etc/postgresml-python/requirements.txt"
@@ -48,6 +60,6 @@ dpkg-deb \
4860
--root-owner-group \
4961
-z1 \
5062
--build "$deb_dir" \
51-
postgresml-python-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb
63+
"postgresml-python-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-${ARCH}.deb"
5264

5365
rm -rf "$deb_dir"

0 commit comments

Comments
 (0)