Skip to content

Commit 2aca775

Browse files
committed
chore(postgresql): add extension pgvector
1 parent 6a8d01b commit 2aca775

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

stacks/postgresql/build.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
. /usr/bin/stack-utils
55
POSTGIS_VERSION=$(curl -Ls https://github.com/postgis/postgis/tags|grep /postgis/postgis/releases/tag/ | sed -E 's/.*\/postgis\/postgis\/releases\/tag\/([0-9\.]{1,}(-rc.[0-9]{1,})?)".*/\1/g' | head -1)
66
TIMESCALE_VERSION=$(curl -Ls https://github.com/timescale/timescaledb/releases|grep /timescale/timescaledb/releases/tag/ | sed -E 's/.*\/timescale\/timescaledb\/releases\/tag\/([0-9\.]{1,})".*/\1/g' | head -1)
7+
PGVECTOR_VERSION=$(curl -Ls https://github.com/pgvector/pgvector/tags | grep '/pgvector/pgvector/archive/refs/tags/' | sed -E 's|.*/tags/v([0-9]+\.[0-9]+\.[0-9]+).*|\1|' | sort -Vr | head -1)
78
# Implement build function
89
function build() {
910
# Generate binary
@@ -74,6 +75,7 @@ function build() {
7475
make install-world
7576

7677
# postgis
78+
echo "-----------------start buid postgis-------------"
7779
curl -sSL "https://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz" | tar -xz && \
7880
cd postgis-"${POSTGIS_VERSION}" && \
7981
./configure \
@@ -85,7 +87,8 @@ function build() {
8587
cd - && \
8688
rm -rf postgis-"${POSTGIS_VERSION}"
8789

88-
# timescaledb
90+
# # timescaledb
91+
echo "-----------------start buid timescaledb-------------"
8992
curl -sSL "https://github.com/timescale/timescaledb/archive/refs/tags/${TIMESCALE_VERSION}.tar.gz" | tar -xz &&
9093
cd timescaledb-"${TIMESCALE_VERSION}" && \
9194
cmake -DPG_CONFIG=/opt/drycc/postgresql/"${PG_MAJOR}"/bin/pg_config && \
@@ -94,13 +97,25 @@ function build() {
9497
cd - && \
9598
rm -rf timescaledb-"${TIMESCALE_VERSION}"
9699

100+
# pgvector
101+
echo "-----------------start buid vector-------------"
102+
export PG_CONFIG=/opt/drycc/postgresql/"${PG_MAJOR}"/bin/pg_config
103+
curl -sSL https://codeload.github.com/pgvector/pgvector/tar.gz/refs/tags/v${PGVECTOR_VERSION} | tar -xz &&
104+
cd pgvector-${PGVECTOR_VERSION}/
105+
make && \
106+
make install && \
107+
cd -
108+
rm -rf pgvector-${PGVECTOR_VERSION}/
109+
97110
cat << EOF > "${PROFILE_DIR}/${STACK_NAME}.sh"
98111
export PATH="/opt/drycc/postgresql/$PG_MAJOR/bin:\$PATH"
99112
export LD_LIBRARY_PATH="/opt/drycc/postgresql/$PG_MAJOR/lib:\$LD_LIBRARY_PATH"
113+
export PG_CONFIG=/opt/drycc/postgresql/"${PG_MAJOR}"/bin/pg_config
100114
EOF
101115
cp -rf /opt/drycc/postgresql/* "${DATA_DIR}"
102116
cd /workspace && rm -rf "postgresql-${PG_VER}"
103117
}
104118

119+
105120
# call build stack
106121
build-stack "${1}"

0 commit comments

Comments
 (0)