Coder Social home page Coder Social logo

docker-postgres-plv8's Introduction

postgres-plv8

Docker images for running plv8 1.4, 1.5 and 2.x on Postgres 9.4, 9.5, 9.6, 10, 11 and 12. Based on the official Postgres image.

clkao/postgres-plv8 clkao/postgres-plv8 clkao/postgres-plv8 clkao/postgres-plv8

Tags

Usage

How to use this image

This image behaves exactly like the official Postgres image with the only difference being the inclusion of the plv8 extension.

$ docker run -d --name postgres clkao/postgres-plv8
$ docker exec -it postgres bash -c "psql -U postgres -c \"CREATE EXTENSION plv8; SELECT extversion FROM pg_extension WHERE extname = 'plv8';\""

You should see the version of the plv8 extension installed.

You can optionally create a service using docker-compose:

postgres:
  image: clkao/postgres-plv8

Image variants

The clkao/postgres-plv8 image comes in multiple flavors:

clkao/postgres-plv8:latest

Points to the latest release available of Postgres stable with compatible plv8 installed. Occasionally pre-release versions will be included.

clkao/postgres-plv8:<majorPostgresVersion>-<plv8Version>

Points to the latest release available of Postgres <majorPostgresVersion> with the latest release available of plv8 <plv8Version> installed.

Supported Docker versions

This image is officially supported on Docker version 19.03, with support for older versions provided on a best-effort basis.

License

MIT

docker-postgres-plv8's People

Contributors

clkao avatar deinspanjer avatar ruimarinho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-postgres-plv8's Issues

IP address for Postgress

I've been trying connect to Postgres with PGAdmin using your Docker-Compose but won't connect to an IP address or Localhost. When I type in the command "docker ps", there's no address. When I inspect the config file (docker inspect name | grep "IPAdress") there's no address there.... in case there's something besides localhost or 127.0.0.1.

9.6-1.5 tag not available on docker hub

I get the following output when I try to pull 9.6-1.5:

Pulling db (clkao/postgres-plv8:9.6-1.5)...
Pulling repository docker.io/clkao/postgres-plv8
ERROR: Tag 9.6-1.5 not found in repository docker.io/clkao/postgres-plv8

Thanks for maintaining this, much appreciated!

Unable to build 9.6-1.5 dockerfile

I am trying to make a build that uses Postgres version 9.6.3 and plv8 version 1.5.3 based on the 9.6-1.5 Dockerfile (on Docker Hub the Docker image has Postgres 9.6.2). However, I wasn't able to rebuild the image locally. The error when running docker build --no-cache . is:

[0:00:00] Cloning into '/tmp/build/plv8-1.5.3/build/v8/build/_gclient_gyp_AEDxVp'...
[0:00:00] Receiving objects:   0% (1/17946)   
[0:00:00] Receiving objects:  10% (1795/17946)   
[0:00:01] remote: Total 17946 (delta 12666), reused 17946 (delta 12666)        
[0:00:01] Receiving objects: 100% (17946/17946), 3.94 MiB | 7.84 MiB/s   
[0:00:01] Resolving deltas:   0% (0/12666)   
[0:00:01] Resolving deltas:  11% (1433/12666)   
[0:00:02] Resolving deltas: 100% (12666/12666)   
[0:00:02] Checking connectivity... done.
[0:00:02] Checked out d174d75bf69c682cb62af9187879e01513b35e52 to a detached HEAD. Before making any commits
in this repo, you should use 'git checkout <branch>' to switch to
an existing branch or use 'git checkout origin -b <branch>' to
create a new branch for your work.
[0:00:02]
----------------------------------------
Traceback (most recent call last):
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 2618, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 2604, in main
    return dispatcher.execute(OptionParser(), argv)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/subcommand.py", line 252, in execute
    return command(parser, args[1:])
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 2359, in CMDsync
    ret = client.RunOnDeps('update', args)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 1458, in RunOnDeps
    work_queue.flush(revision_overrides, command, args, options=self._options)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_utils.py", line 1055, in run
    self.item.run(*self.args, **self.kwargs)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 891, in run
    self.ParseDepsFile()
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient.py", line 690, in ParseDepsFile
    gclient_eval.Exec(deps_content, global_scope, local_scope, filepath)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 209, in Exec
    _visit_in_module(stmt)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 193, in _visit_in_module
    value = _gclient_eval(node.value, global_scope, filename=filename)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 173, in _gclient_eval
    return _convert(node_or_string)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 146, in _convert
    for k, v in zip(node.keys, node.values))
  File "/usr/lib/python2.7/collections.py", line 52, in __init__
    self.__update(*args, **kwds)
  File "/usr/lib/python2.7/_abcoll.py", line 566, in update
    for key, value in other:
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 146, in <genexpr>
    for k, v in zip(node.keys, node.values))
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 146, in _convert
    for k, v in zip(node.keys, node.values))
  File "/usr/lib/python2.7/collections.py", line 52, in __init__
    self.__update(*args, **kwds)
  File "/usr/lib/python2.7/_abcoll.py", line 566, in update
    for key, value in other:
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 146, in <genexpr>
    for k, v in zip(node.keys, node.values))
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 165, in _convert
    return _convert(node.left) + _convert(node.right)
  File "/tmp/build/plv8-1.5.3/build/depot_tools/gclient_eval.py", line 167, in _convert
    return _convert(node.left) % _convert(node.right)
TypeError: not all arguments converted during string formatting
make[1]: *** [build/v8-git-mirror-4.3.66] Error 1
Makefile.v8:31: recipe for target 'build/v8-git-mirror-4.3.66' failed
make[1]: Leaving directory '/tmp/build/plv8-1.5.3'
Makefile:145: recipe for target 'static' failed
make: *** [static] Error 2

The full output of the docker build command is available here: https://gist.github.com/zgrannan/7d3eb260ff6e186059e30560ab30cb3a

I'm not sure immediately what the cause of this error is. I might take a look into fixing it later but if someone has a chance to take a look at it that would be great! And thanks @clkao for making this Dockerfile.

Adding tagged releases to Docker Hub

@clkao I think it's important to start tagging releases on github and auto building tags on Docker Hub so that users can pull the tagged release docker pull postgres-plv8:1.5.2 instead of latest.

WDYT?

Support for plv8 1.5.x

plv8 1.5.x requires a newer version of V8 (4.3.66) which hasn't been made compatible with the libv8-dev Debian package yet. The last version available is 3.14.5, launched more than 3 years ago. Statically linking V8 by compiling with make static might be the only option going forward, but it requires about 3gb to build. The image would have to be slimmed down after compiling.

Potential diff:

diff --git c/9.5-1.5/Dockerfile i/9.5-1.5/Dockerfile
new file mode 100644
index 0000000..2632a2b
--- /dev/null
+++ i/9.5-1.5/Dockerfile
@@ -0,0 +1,12 @@
+FROM postgres:9.5
+MAINTAINER Chia-liang Kao <[email protected]>
+
+RUN apt-get update \
+       && apt-get install -y build-essential libv8-dev git-core postgresql-server-dev-$PG_MAJOR \
+       && rm -rf /var/lib/apt/lists/*
+
+ENV PLV8_BRANCH master
+
+RUN cd /tmp && git clone -b $PLV8_BRANCH https://github.com/plv8/plv8.git \
+  && cd /tmp/plv8 \
+  && make static install
diff --git c/9.5-1.5/README i/9.5-1.5/README
new file mode 100644
index 0000000..34fa3ab
--- /dev/null
+++ i/9.5-1.5/README
@@ -0,0 +1,19 @@
+# postgres-plv8
+
+Docker image for running plv8 1.5.x on Postgres 9.5.
+
+Based on the [official Postgres image](http://registry.hub.docker.com/_/postgres/).
+
+## Usage
+
+Start a postgres server container with persistent storage and give it a name:
+
+```bash
+$ docker run -d -v /tmp/data:/var/lib/postgresql/data --name some-postgres clkao/postgres-plv8:9.5
+```
+
+Start client container that links to the server container above as the "postgres" alias:
+
+```
+$ docker run --link some-postgres:postgres --rm -ti clkao/postgres-plv8:9.5 bash -c 'psql -U postgres -h $POSTGRES_PORT_5432_TCP_ADDR'
+```

Failed to create ICU collator, are ICU data files missing?

Packaging graphql into postgres and then using the printSchema function will trigger the ICU support. The following error will kill a backend:

# Fatal error in , line 0
# Failed to create ICU collator, are ICU data files missing?
#

==== C stack trace ===============================

    /usr/lib/postgresql/9.6/lib/plv8.so(v8::base::debug::StackTrace::StackTrace()+0xe) [0x7f1d3b15793e]
    /usr/lib/postgresql/9.6/lib/plv8.so(V8_Fatal+0xe0) [0x7f1d3b156350]
    /usr/lib/postgresql/9.6/lib/plv8.so(+0xc1dab2) [0x7f1d3b142ab2]
    /usr/lib/postgresql/9.6/lib/plv8.so(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x14a) [0x7f1d3b07787a]
    [0x1328cc0060c7]

I edited the docker file to add libicu-dev to the buildDependencies. I originally thought the library might need to be linked in statically. This didn't solve the problem. Does the static version of ICU not link in it's data statically ? Anyhow.

I added another layer to get the data files in:

RUN apt-get update \ && apt-get install -y libicu52 libicu-dev

With the hopes that this would solve the problem -- the ICU data object is available in the container under:

root@2ee21715730b:/# find / | grep libicudata
/usr/lib/x86_64-linux-gnu/libicudata.so.52.1
/usr/lib/x86_64-linux-gnu/libicudata.a
/usr/lib/x86_64-linux-gnu/libicudata.so
/usr/lib/x86_64-linux-gnu/libicudata.so.52

Updated to [email protected] and Postgres 14

Hi,

I've managed to be able to build the latest versions of plv8 and psql with the following Dockerfile, hope that helps:

FROM postgres:14rc1

ENV PLV8_VERSION=3.0.0 \
    PLV8_SHASUM="de030f5d6b0439710efa05f4c35ffb8ef36ae754fa0e3c46d334352cf1507661"

RUN buildDependencies=" \
      build-essential \
      ca-certificates \
      curl \
      git-core \
      python \
      gpp \
      cpp \
      pkg-config \
      apt-transport-https \
      cmake \
      libc++-dev \
      wget \
      ninja-build \
      libtinfo5 \
      libglib2.0-dev \
      libc++abi-dev \
      postgresql-server-dev-$PG_MAJOR \
    " \
    runtimeDependencies=" \
      libc++1 \
    " \
  && apt-get update \
  && apt-get install -y --no-install-recommends ${buildDependencies} ${runtimeDependencies} \
  && mkdir -p /tmp/build \
  && curl -o /tmp/build/v$PLV8_VERSION.tar.gz -SL "https://github.com/plv8/plv8/archive/v${PLV8_VERSION}.tar.gz" \
  && cd /tmp/build \
  && echo $PLV8_SHASUM v$PLV8_VERSION.tar.gz | sha256sum -c \
  && tar -xzf /tmp/build/v$PLV8_VERSION.tar.gz -C /tmp/build/ \
  && cd /tmp/build/plv8-$PLV8_VERSION \
  && make \
  && make install \
  && strip /usr/lib/postgresql/${PG_MAJOR}/lib/plv8-${PLV8_VERSION}.so \
  && rm -rf /root/.vpython_cipd_cache /root/.vpython-root \
  && apt-get clean \
  && apt-get remove -y ${buildDependencies} \
  && apt-get autoremove -y \
  && rm -rf /tmp/build /var/lib/apt/lists/*

Update plv8 version

Hi,

Thanks for you Docker file

I use you latest image and run into this issue of plv8 :
plv8/plv8#370

You image is based on version 2.3.13 and the bug is fixed in 2.3.14.

Can you publish a new version with latest plv8 version ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.