Skip to content

Commit fb6aa89

Browse files
committed
Fix: Add pgvector
1 parent e8b2fa4 commit fb6aa89

7 files changed

Lines changed: 82 additions & 8 deletions

File tree

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*~
22
.build_*
3+
data
4+
pgdata

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*~
22
/.build_*
33
*/.build_*
4+
5+
data

.gitpod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ image:
33

44
tasks:
55
- init: echo "Building the Docker image..."
6-
command: docker build -t merged_image .
6+
command: PG_VERSION=15 docker build -t merged_image .
77

88
- init: echo "Running the Docker container..."
99
command: docker run --name merged_container -d merged_image

.gitpod.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+
tasks:
8+
- init: make
9+
10+

Dockerfile

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
ARG PG_VERSION
22
ARG PREV_IMAGE
33
ARG TS_VERSION
4-
ARG PG_MAJOR=15
5-
ARG GO_VERSION=1.18.7
6-
ARG OSS_ONLY
7-
84
############################
95
# Build tools binaries in separate image
106
############################
7+
ARG GO_VERSION=1.18.7
118
FROM golang:${GO_VERSION}-alpine AS tools
129

1310
ENV TOOLS_VERSION 0.8.1
@@ -19,7 +16,10 @@ RUN apk update && apk add --no-cache git gcc musl-dev \
1916
############################
2017
# Grab old versions from previous version
2118
############################
19+
ARG PG_VERSION
20+
ARG PREV_IMAGE
2221
FROM ${PREV_IMAGE} AS oldversions
22+
# Remove update files, mock files, and all but the last 5 .so/.sql files
2323
RUN rm -f $(pg_config --sharedir)/extension/timescaledb*mock*.sql \
2424
&& if [ -f $(pg_config --pkglibdir)/timescaledb-tsl-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-tsl-1*.so | head -n -5); fi \
2525
&& if [ -f $(pg_config --pkglibdir)/timescaledb-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-*.so | head -n -5); fi \
@@ -28,7 +28,9 @@ RUN rm -f $(pg_config --sharedir)/extension/timescaledb*mock*.sql \
2828
############################
2929
# Now build image and copy in tools
3030
############################
31-
FROM postgres:${PG_MAJOR}-alpine
31+
ARG PG_VERSION
32+
FROM postgres:${PG_VERSION}-alpine
33+
ARG OSS_ONLY
3234

3335
LABEL maintainer="Timescale https://www.timescale.com"
3436

@@ -37,6 +39,7 @@ COPY --from=tools /go/bin/* /usr/local/bin/
3739
COPY --from=oldversions /usr/local/lib/postgresql/timescaledb-*.so /usr/local/lib/postgresql/
3840
COPY --from=oldversions /usr/local/share/postgresql/extension/timescaledb--*.sql /usr/local/share/postgresql/extension/
3941

42+
ARG TS_VERSION
4043
RUN set -ex \
4144
&& apk add libssl1.1 \
4245
&& apk add --no-cache --virtual .fetch-deps \
@@ -67,4 +70,26 @@ RUN set -ex \
6770
\
6871
&& if [ "${OSS_ONLY}" != "" ]; then rm -f $(pg_config --pkglibdir)/timescaledb-tsl-*.so; fi \
6972
&& apk del .fetch-deps .build-deps \
70-
&& rm
73+
&& rm -rf /build \
74+
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
75+
76+
# Adding PG Vector
77+
78+
RUN cd /tmp
79+
RUN apk add --no-cache --virtual .build-deps \
80+
coreutils \
81+
dpkg-dev dpkg \
82+
gcc \
83+
git \
84+
krb5-dev \
85+
libc-dev \
86+
llvm15 \
87+
clang \
88+
make \
89+
cmake \
90+
util-linux-dev \
91+
&& git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git \
92+
&& cd /pgvector \
93+
&& ls \
94+
&& make \
95+
&& make install

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME=timescaledb
22
# Default is to timescaledev to avoid unexpected push to the main repo
33
# Set ORG to timescale in the caller
44
ORG=timescaledev
5-
PG_VER=pg12
5+
PG_VER=pg15
66
PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-)
77
TS_VERSION=main
88
PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!')

docker-compose.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '3.6'
2+
services:
3+
timescaledb:
4+
container_name: timescaledb
5+
image: timescaledev/timescaledb:main-pg15
6+
restart: always
7+
ports:
8+
- "5432:5432"
9+
volumes:
10+
- ./pgdata:/var/lib/postgresql/data
11+
environment:
12+
POSTGRES_USER: timescaledb
13+
POSTGRES_PASSWORD: postgrespassword
14+
15+
graphql-engine:
16+
image: hasura/graphql-engine:latest
17+
ports:
18+
- "8080:8080"
19+
volumes:
20+
- ./data/migrations:/hasura-migrations
21+
- ./data/metadata:/hasura-metadata
22+
depends_on:
23+
- "timescaledb"
24+
restart: always
25+
environment:
26+
HASURA_GRAPHQL_DATABASE_URL: postgres://timescaledb:postgrespassword@timescaledb:5432/postgres?sslmode=disable
27+
## enable the console served by server
28+
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
29+
## enable debugging mode. It is recommended to disable this in production
30+
HASURA_GRAPHQL_DEV_MODE: "true"
31+
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup,http-log,webhook-log,websocket-log,query-log
32+
## uncomment next line to set an admin secret
33+
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
34+
HASURA_GRAPHQL_MIGRATIONS_DISABLE_TRANSACTION: "true"
35+
HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets

0 commit comments

Comments
 (0)