diff --git a/Cargo.lock b/Cargo.lock index b880326..a923510 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1580,7 +1580,7 @@ dependencies = [ [[package]] name = "pg_tier" -version = "0.0.2" +version = "0.0.3" dependencies = [ "aws-config", "aws-sdk-s3", diff --git a/Cargo.toml b/Cargo.toml index 59ea170..583d7e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pg_tier" -version = "0.0.2" +version = "0.0.3" edition = "2021" [lib] diff --git a/Trunk.toml b/Trunk.toml index aedc12d..c68a58b 100644 --- a/Trunk.toml +++ b/Trunk.toml @@ -6,7 +6,7 @@ description = "Open source s3 tiering extension for Postgres." homepage = "https://github.com/tembo-io/pg_tier" documentation = "https://github.com/tembo-io/pg_tier" categories = ["analytics", "connectors"] -version = "0.0.2" +version = "0.0.3" [build] postgres_version = "15" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9037201 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.2' + +services: + postgres: + restart: always + image: quay.io/tembo/tier-pg:latest + ports: + - 5432:5432 + environment: + - POSTGRES_PASSWORD=postgres diff --git a/images/tier-pg/Dockerfile b/images/tier-pg/Dockerfile new file mode 100644 index 0000000..dcb8422 --- /dev/null +++ b/images/tier-pg/Dockerfile @@ -0,0 +1,96 @@ +FROM postgres:15.4-bookworm as builder + +ARG PGTIER_VER=0.0.3 +ARG PGRX_VER=0.11.3 + +RUN apt-get update \ + && apt-get install -y \ + ca-certificates \ + clang \ + curl \ + gcc \ + git \ + libssl-dev \ + make \ + pkg-config \ + postgresql-server-dev-15 \ + automake \ + bison \ + build-essential \ + ccache \ + cmake \ + flex \ + g++ \ + libboost-all-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libprotobuf-dev \ + libprotoc-dev \ + libreadline-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxml2-utils \ + libxslt-dev \ + protobuf-compiler \ + xsltproc \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Clone and build AWS SDK for C++ +RUN git clone https://github.com/aws/aws-sdk-cpp.git && \ + cd aws-sdk-cpp && \ + git checkout 1.9.263 && \ + git submodule update --init --recursive && \ + mkdir build && cd build && \ + cmake -DBUILD_ONLY="s3;core;config;sts;cognito-identity;transfer;identity-management" -DAUTORUN_UNIT_TESTS=OFF -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations .. && \ + make -j$(nproc) && \ + make install && \ + cd ../../ && rm -rf aws-sdk-cpp + +# Clone and build Apache Arrow +RUN git clone https://github.com/apache/arrow.git && \ + cd arrow && \ + git checkout apache-arrow-7.0.1 && \ + cd cpp && \ + mkdir build && cd build && \ + cmake -DARROW_PARQUET=ON -DARROW_S3=ON -DARROW_WITH_SNAPPY=ON .. && \ + make -j$(nproc) && \ + make install && \ + cd ../../ && rm -rf arrow + +# Clone and build parquet_s3_fdw +RUN git clone https://github.com/pgspider/parquet_s3_fdw.git && \ + cd parquet_s3_fdw && \ + git checkout v1.1.0 \ + make install PG_CONFIG=$(which pg_config) + +WORKDIR /pg_tier + +# Install Rust dependencies +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN $HOME/.cargo/bin/rustup default stable + +# install pgrx +RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version=$PGRX_VER --locked + +# init pgrx with postgres +RUN $HOME/.cargo/bin/cargo pgrx init --pg15 $(which pg_config) + +# install pg_tier +RUN git clone https://github.com/tembo-io/pg_tier.git && \ + cd pg_tier && git fetch origin v$PGTIER_VER && \ + git checkout v$PGTIER_VER && \ + $HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config) && \ + cd .. && rm -rf pg_tier + +FROM postgres:15.4-bookworm + +COPY --from=builder /usr/share/postgresql/15/extension /usr/share/postgresql/15/extension +COPY --from=builder /usr/lib/postgresql/15/lib /usr/lib/postgresql/15/lib + +RUN apt-get update \ + && apt-get install -y ca-certificates + +USER postgres +CMD ["postgres"]