Skip to content

Is it possible to switch timescaledb extension license with images of v5 ? #2692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gjeusel opened this issue Sep 13, 2021 · 20 comments
Closed

Comments

@gjeusel
Copy link

gjeusel commented Sep 13, 2021

Trying to modify it using patroni:

  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:
          shared_preload_libraries: timescaledb
          timescaledb.license: timescale  # instead of apache by default in crunchy

Result in:

postgres@localhost:tutorial> create extension timescaledb cascade;
could not access file "$libdir/timescaledb-tsl-2.4.0": No such file or directory

And indeed, this file does not exists at:

bash-4.4$ ls /usr/pgsql-13/lib/ | grep -i timescale
timescaledb-2.4.0.so
timescaledb.so

Would it be possible to build the docker images with this additional file ?
Even though I understand the reasons for the license to be kept as "apache" by default.

@gjeusel
Copy link
Author

gjeusel commented Sep 13, 2021

Sorry, maybe it would be more appropriate to open this issue at https://github.com/CrunchyData/crunchy-containers ?

@gjeusel
Copy link
Author

gjeusel commented Sep 13, 2021

A sample of customized dockerfile to get latest timescaledb is actually found in another unrelated issue.

Still, the question remains, would it be possible to add the tsl file in the official image ? 🙏

@ludzzz
Copy link

ludzzz commented Sep 14, 2021

Hi,
I bumped into this issue as well.
at first, I tried to use timescaledb function.
But got this error:

 ERROR: function "time_bucket_gapfill" is not supported under the current "apache" license
  Hint: Upgrade your license to 'timescale' to use this free community feature.

To fix that I found that we can do (what @gjeusel was doing in config):

ALTER SYSTEM SET timescaledb.license = 'timescale';
-- reload setting changes
SELECT pg_reload_conf();

And got the error:

 ERROR: could not access file "$libdir/timescaledb-tsl-2.4.0": No such file or directory

Same as @gjeusel Would it be possible to add that lib?

@ludzzz
Copy link

ludzzz commented Oct 28, 2021

Hi guys,

No update on this issue?
@gjeusel did you find a workaround?

@johanjk
Copy link

johanjk commented Nov 1, 2021

@ludzzz The workaround refered to by gjeusel works.

Here is a complete working example:

Dockerfile:

ARG VERSION
FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis-ha:${VERSION}

USER root

RUN curl -sSL -o /etc/yum.repos.d/timescale_timescaledb.repo "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8" && \
    yum --disablerepo=crunchypg13 update -y && \
    yum --disablerepo=crunchypg13 install -y timescaledb-2-postgresql-13 && \
    yum clean all
USER 26
# magical user used here: https://github.com/CrunchyData/crunchy-containers/blob/master/build/postgres-gis/Dockerfile

Build and push your dockerfile to a repository.

Operator yaml:

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
  name: example-cluster
spec:
  image: {{ .Values.image }}
  imagePullSecrets:
   - name: dockersecret
  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:
          shared_preload_libraries: timescaledb
          timescaledb.license: timescale  

imagePullSecrets is only required If you are using a private repository for your image.

@yash-kalwani
Copy link

@johanjk i tried using your dockerfile but it fails with the following logs

ERROR: MODE environment variable is not set, aborting.

any idea what might be going wrong

@johanjk
Copy link

johanjk commented Jan 14, 2022

I assume the log is an output from when you ran the container standalone using docker run, not through the crd of the operator?
In that case, see https://crunchydata.github.io/crunchy-containers/stable/container-specifications/crunchy-postgres/#running-modes to set the mode env var.

@rylyk
Copy link

rylyk commented Jan 31, 2022

Hello, is this something that progress might be made on? I am attempting to build a custom image as mentioned in this thread however I am hitting:

#5 1.922 CentOS Linux 8 - AppStream 146 B/s | 38 B 00:00 #5 1.933 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

I assume this is related to centos8 being EOL?

@yash-kalwani were you able to build the image successfully?

@rylyk
Copy link

rylyk commented Feb 1, 2022

For anyone coming across the issue I was facing, adding --disablerepo=crunchypg13,appstream,baseos to the yum commands allowed me to download the timescaldb version as described above. It's not ideal but is a workaround

@benjamin-bergia
Copy link

I am hitting the license issue too. The compression is not available with the Apache version. Honestly, without compression TS is pretty much unusable in production.

@rylyk
Copy link

rylyk commented Feb 21, 2022

@benjamin-bergia, I was able to get past this by building my own image. I have the following DOCKERFILE:

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0
USER  root
RUN  curl  -sSL  -o  /etc/yum.repos.d/timescale_timescaledb.repo  "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8"  &&  \
yum  --disablerepo=crunchypg13,appstream,baseos  update  -y  &&  \
yum  --disablerepo=crunchypg13,appstream,baseos  install  -y  timescaledb-2-postgresql-13  &&  \
yum  clean  all

USER  26

@benjamin-bergia
Copy link

benjamin-bergia commented Feb 21, 2022

Thanks a lot @kbmanseau !

I still to have some issues afterward:

 ALTER SYSTEM SET timescaledb.license = 'timescale';
ERROR:  could not access file "$libdir/timescaledb-tsl-2.5.0": No such file or directory
promscale=# CREATE EXTENSION promscale;
ERROR:  could not access file "$libdir/timescaledb-tsl-2.5.0": No such file or directory
promscale=# CREATE EXTENSION timescaledb;
ERROR:  extension "timescaledb" has already been loaded with another version
DETAIL:  The loaded version is "2.5.0".
HINT:  Start a new session and execute CREATE EXTENSION as the first command. Make sure to pass the "-X" flag to psql.
promscale=# 

I modified the dockerfile slightly to add the promscale extension:

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0
USER  root
RUN  curl  -sSL  -o  /etc/yum.repos.d/timescale_timescaledb.repo  "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8"  &&  \
yum  --disablerepo=crunchypg13,appstream,baseos update -y &&  \
yum  --disablerepo=crunchypg13,appstream,baseos install -y timescaledb-2-postgresql-13  &&  \
curl -sSL -O https://github.com/timescale/promscale_extension/releases/download/0.3.0/promscale_extension-0.3.0.pg13.x86_64.rpm && \
yum --disablerepo=crunchypg13,appstream,baseos localinstall -y promscale_extension-0.3.0.pg13.x86_64.rpm && \
rm promscale_extension-0.3.0.pg13.x86_64.rpm && \
yum clean all
USER 26

and here is my cluster config:

  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:
          shared_preload_libraries: timescaledb,promscale
          timescaledb.license: timescale

@benjamin-bergia
Copy link

Got it to work!

The version of the packages to install has to be 2.5.0: timescaledb-2-postgresql-13-2.5.0 timescaledb-2-loader-postgresql-13-2.5.0. I tried with 2.5.2 and it doesn't work. By default, when not specifying the version, it defaults to 2.6.0.

New Dockerfile:

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0

USER  root

RUN  curl  -sSL  -o  /etc/yum.repos.d/timescale_timescaledb.repo  "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8"  &&  \
yum  --disablerepo=crunchypg13,appstream,baseos update -y &&  \
yum  --disablerepo=crunchypg13,appstream,baseos install -y timescaledb-2-postgresql-13-2.5.0 timescaledb-2-loader-postgresql-13-2.5.0 &&  \
curl -sSL -O https://github.com/timescale/promscale_extension/releases/download/0.3.0/promscale_extension-0.3.0.pg13.x86_64.rpm && \
yum --disablerepo=crunchypg13,appstream,baseos localinstall -y promscale_extension-0.3.0.pg13.x86_64.rpm && \
rm promscale_extension-0.3.0.pg13.x86_64.rpm && \
yum clean all

USER 26

Thanks again everyone

@mariusstaicu
Copy link

Any idea how to install the tsl extension in a ubi8 container ?

@johanjk
Copy link

johanjk commented Aug 1, 2022

@mariusstaicu the following works for me (note it resembles previously posted dockerfiles in this thread very closely)

ARG VERSION
FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:${VERSION}

USER root

RUN curl -sSL -o /etc/yum.repos.d/timescale_timescaledb.repo "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8" && \
    microdnf --disablerepo=crunchypg14 update -y && \
    microdnf --disablerepo=crunchypg14 install -y timescaledb-2-postgresql-14 && \
    microdnf --disablerepo=crunchypg14 install -y timescaledb-toolkit-postgresql-14 && \
    microdnf clean all
USER 26
# magical user used here: https://github.com/CrunchyData/crunchy-containers/blob/master/build/postgres-gis/Dockerfile

working with -build-arg VERSION=ubi8-14.4-3.2-0

@mariusstaicu
Copy link

thanks @johanjk, meanwhile I managed to do it also using microdnf in a similar fashion

@dberardo-com
Copy link

i confirm this is working also with version ubi8-14.5-1

however, this will not work if the cluster already exists, it needs to be run on bootstrap, before running CREATE EXTENSION ... timescaledb ...

@prlaurence
Copy link
Contributor

Closing this thread out. As noted in the thread, we include the TimescaleDB Apache 2 Edition in our container images. The TimescaleDB Community Edition is subject to the Timescale License Agreement and as a result not something that Crunchy Data packages or distributes. There are some comments in this thread regarding approaches to modifying the container images to add the TimescaleDB Community Edition extension. Crunchy Data has not validated these approaches.

@David-Angel
Copy link

David-Angel commented Aug 21, 2023

FROM registry.developers.crunchydata.com/crunchydata/crunchy-postgres:${CRUNCHY_POSTGRES_VERSION}

USER root


RUN curl -sSL -o /etc/yum.repos.d/timescale_timescaledb.repo "https://packagecloud.io/install/repositories/timescale/timescaledb/config_file.repo?os=el&dist=8" && \
    microdnf update -y && \
    microdnf install -y timescaledb-2-loader-postgresql-14-2.11.0 && \
    microdnf install -y timescaledb-2-postgresql-14-2.11.0 && \
    microdnf install -y timescaledb-toolkit-postgresql-14-1.16.0 && \
    microdnf clean all

USER 26

Here is a version that works and uses a specific version of timescale.
If you don't do this you get a new version every time you build and that can cause minor product upgrades to be incompatible.

@jaitaiwan
Copy link

I found the answer to the original question that was posted here - this should probably be closed and locked. Long-story short licencing issues means roll your own containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests