Skip to content

Commit 237a65d

Browse files
authored
chore(postgresql): add extention pg_repack (#2088)
1 parent f5581a8 commit 237a65d

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

stacks/postgresql/build.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
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)
77
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)
8+
PG_REPACK_VERSION=$(curl -Ls https://github.com/reorg/pg_repack/tags | grep '/pg_repack/archive/refs/tags/' | sed -E 's|.*/tags/ver_([0-9]+\.[0-9]+\.[0-9]+).*|\1|' | sort -Vr | head -1)
9+
810
# Implement build function
911
function build() {
1012
# Generate binary
@@ -41,7 +43,7 @@ function build() {
4143
libproj-dev \
4244
libprotobuf-c-dev \
4345
protobuf-c-compiler
44-
46+
echo "-----------------start buid postpostgres-------------"
4547
# postgresql
4648
curl -sSL "https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.gz" | tar -xz && \
4749
cd postgresql-"${PG_VER}" && \
@@ -73,7 +75,7 @@ function build() {
7375
# we can change from world to world-bin in newer releases
7476
make world && \
7577
make install-world
76-
78+
cd -
7779
# postgis
7880
echo "-----------------start buid postgis-------------"
7981
curl -sSL "https://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz" | tar -xz && \
@@ -101,11 +103,22 @@ function build() {
101103
echo "-----------------start buid vector-------------"
102104
export PG_CONFIG=/opt/drycc/postgresql/"${PG_MAJOR}"/bin/pg_config
103105
curl -sSL https://codeload.github.com/pgvector/pgvector/tar.gz/refs/tags/v${PGVECTOR_VERSION} | tar -xz &&
104-
cd pgvector-${PGVECTOR_VERSION}/
106+
cd pgvector-${PGVECTOR_VERSION} && \
105107
make && \
106108
make install && \
107-
cd -
108-
rm -rf pgvector-${PGVECTOR_VERSION}/
109+
cd - && \
110+
rm -rf pgvector-${PGVECTOR_VERSION}
111+
112+
113+
# pg_repack
114+
echo "-----------------start buid pg_repack-------------"
115+
export PG_CONFIG=/opt/drycc/postgresql/"${PG_MAJOR}"/bin/pg_config
116+
curl -sSL https://github.com/reorg/pg_repack/archive/refs/tags/ver_${PG_REPACK_VERSION}.tar.gz | tar -xz &&
117+
cd pg_repack-ver_${PG_REPACK_VERSION} && \
118+
make && \
119+
make install && \
120+
cd - && \
121+
rm -rf pg_repack-ver-${PG_REPACK_VERSION}
109122

110123
cat << EOF > "${PROFILE_DIR}/${STACK_NAME}.sh"
111124
export PATH="/opt/drycc/postgresql/$PG_MAJOR/bin:\$PATH"
@@ -116,6 +129,5 @@ EOF
116129
cd /workspace && rm -rf "postgresql-${PG_VER}"
117130
}
118131

119-
120132
# call build stack
121133
build-stack "${1}"

0 commit comments

Comments
 (0)