diff --git a/.dockerignore b/.dockerignore index 3132f2e9..1d26042a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,4 @@ *~ .build_* +data +pgdata \ No newline at end of file diff --git a/.gitignore b/.gitignore index b7614a3b..8c9f37e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *~ /.build_* */.build_* + +data diff --git a/.gitpod.yaml b/.gitpod.yaml index b3eb5ef0..96e75e55 100644 --- a/.gitpod.yaml +++ b/.gitpod.yaml @@ -3,7 +3,7 @@ image: tasks: - init: echo "Building the Docker image..." - command: docker build -t merged_image . + command: PG_VERSION=15 docker build -t merged_image . - init: echo "Running the Docker container..." command: docker run --name merged_container -d merged_image diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..63a3e4fd --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,10 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) +# and commit this file to your remote git repository to share the goodness with others. + +# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart + +tasks: + - init: make + + diff --git a/Dockerfile b/Dockerfile index be953bbe..78d8c632 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,10 @@ ARG PG_VERSION ARG PREV_IMAGE ARG TS_VERSION -ARG PG_MAJOR=15 -ARG GO_VERSION=1.18.7 -ARG OSS_ONLY - ############################ # Build tools binaries in separate image ############################ +ARG GO_VERSION=1.18.7 FROM golang:${GO_VERSION}-alpine AS tools ENV TOOLS_VERSION 0.8.1 @@ -19,7 +16,10 @@ RUN apk update && apk add --no-cache git gcc musl-dev \ ############################ # Grab old versions from previous version ############################ +ARG PG_VERSION +ARG PREV_IMAGE FROM ${PREV_IMAGE} AS oldversions +# Remove update files, mock files, and all but the last 5 .so/.sql files RUN rm -f $(pg_config --sharedir)/extension/timescaledb*mock*.sql \ && 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 \ && 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 \ ############################ # Now build image and copy in tools ############################ -FROM postgres:${PG_MAJOR}-alpine +ARG PG_VERSION +FROM postgres:${PG_VERSION}-alpine +ARG OSS_ONLY LABEL maintainer="Timescale https://www.timescale.com" @@ -37,6 +39,7 @@ COPY --from=tools /go/bin/* /usr/local/bin/ COPY --from=oldversions /usr/local/lib/postgresql/timescaledb-*.so /usr/local/lib/postgresql/ COPY --from=oldversions /usr/local/share/postgresql/extension/timescaledb--*.sql /usr/local/share/postgresql/extension/ +ARG TS_VERSION RUN set -ex \ && apk add libssl1.1 \ && apk add --no-cache --virtual .fetch-deps \ @@ -67,4 +70,26 @@ RUN set -ex \ \ && if [ "${OSS_ONLY}" != "" ]; then rm -f $(pg_config --pkglibdir)/timescaledb-tsl-*.so; fi \ && apk del .fetch-deps .build-deps \ - && rm + && rm -rf /build \ + && sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample + +# Adding PG Vector + +RUN cd /tmp +RUN apk add --no-cache --virtual .build-deps \ + coreutils \ + dpkg-dev dpkg \ + gcc \ + git \ + krb5-dev \ + libc-dev \ + llvm15 \ + clang \ + make \ + cmake \ + util-linux-dev \ + && git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git \ + && cd /pgvector \ + && ls \ + && make \ + && make install diff --git a/Makefile b/Makefile index d42643e3..b3f17beb 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ NAME=timescaledb # Default is to timescaledev to avoid unexpected push to the main repo # Set ORG to timescale in the caller ORG=timescaledev -PG_VER=pg12 +PG_VER=pg15 PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) TS_VERSION=main 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 = !!') diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..c249bd07 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3.6' +services: + timescaledb: + container_name: timescaledb + image: timescaledev/timescaledb:main-pg15 + restart: always + ports: + - "5432:5432" + volumes: + - ./pgdata:/var/lib/postgresql/data + environment: + POSTGRES_USER: timescaledb + POSTGRES_PASSWORD: postgrespassword + + graphql-engine: + image: hasura/graphql-engine:latest + ports: + - "8080:8080" + volumes: + - ./data/migrations:/hasura-migrations + - ./data/metadata:/hasura-metadata + depends_on: + - "timescaledb" + restart: always + environment: + HASURA_GRAPHQL_DATABASE_URL: postgres://timescaledb:postgrespassword@timescaledb:5432/postgres?sslmode=disable + ## enable the console served by server + HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console + ## enable debugging mode. It is recommended to disable this in production + HASURA_GRAPHQL_DEV_MODE: "true" + HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup,http-log,webhook-log,websocket-log,query-log + ## uncomment next line to set an admin secret + # HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey + HASURA_GRAPHQL_MIGRATIONS_DISABLE_TRANSACTION: "true" + HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets \ No newline at end of file