• pgspider pg_cron 以及cstore fdw docker 镜像


    citus 开源的好几个pg fdw 都是很不错的扩展,以下是关于cstore 以及pg_cron 的扩展的docker 镜像

    pg_cron dokerfile

    同样是基于pgspider 的base 镜像

    FROM dalongrong/pgspider:base as build
    WORKDIR /app
    RUN apt-get update && apt-get install -y openssl 
    RUN git clone https://github.com/citusdata/pg_cron.git /app/postgresql-11.6/contrib/pg_cron
    RUN cd /app/postgresql-11.6/contrib/pg_cron && make && make install
    FROM debian:stretch-slim
    ENV GOSU_VERSION 1.11
    RUN apt-get update && apt-get install -y wget openssl libreadline-dev
    # explicitly set user/group IDs
    RUN set -eux; 
     groupadd -r postgres --gid=999; 
    # https://salsa.debian.org/postgresql/postgresql-common/blob/997d842ee744687d99a2b2d95c1083a2615c79e8/debian/postgresql-common.postinst#L32-35
     useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; 
    # also create the postgres user's home directory with appropriate permissions
    # see https://github.com/docker-library/postgres/issues/274
     mkdir -p /var/lib/postgresql; 
     chown -R postgres:postgres /var/lib/postgresql
    RUN wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" 
       && chmod +x /usr/local/bin/gosu 
       && gosu nobody true
    # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
    RUN set -eux; 
       if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then 
       # if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
       grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; 
       sed -ri '//usr/share/locale/d' /etc/dpkg/dpkg.cfg.d/docker; 
       ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; 
       fi; 
       apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; 
       localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
    ENV LANG en_US.utf8
    # install "nss_wrapper" in case we need to fake "/etc/passwd" and "/etc/group" (especially for OpenShift)
    # https://github.com/docker-library/postgres/issues/359
    # https://cwrap.org/nss_wrapper.html
    RUN set -eux; 
       apt-get update; 
       apt-get install -y --no-install-recommends libnss-wrapper; 
       rm -rf /var/lib/apt/lists/*
    COPY --from=build /usr/local/pgspider /usr/local/pgspider
    RUN sed -ri "s!^#?(listen_addresses)s*=s*S+.*!1 = '*'!" /usr/local/pgspider/share/postgresql/postgresql.conf.sample; 
       grep -F "listen_addresses = '*'" /usr/local/pgspider/share/postgresql/postgresql.conf.sample
    RUN echo "shared_preload_libraries = 'pg_cron'" >> /usr/local/pgspider/share/postgresql/postgresql.conf.sample 
      && echo "cron.database_name = 'postgres'" >> /usr/local/pgspider/share/postgresql/postgresql.conf.sample
    RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
    ENV PATH $PATH:/usr/local/pgspider/bin
    ENV PGDATA /var/lib/postgresql/data
    RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
    VOLUME /var/lib/postgresql/data
    COPY docker-entrypoint.sh /usr/local/bin/
    RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
    ENTRYPOINT ["docker-entrypoint.sh"]
    EXPOSE 5432
    CMD ["postgres"]
     
     

    cstore fdw 镜像

    同样是基于pgspider 的base 镜像

    FROM dalongrong/pgspider:base as build
    WORKDIR /app
    RUN apt-get update && apt-get install -y openssl protobuf-c-compiler libprotobuf-c-dev
    RUN git clone https://github.com/citusdata/cstore_fdw.git /app/postgresql-11.6/contrib/cstore_fdw
    RUN cd /app/postgresql-11.6/contrib/cstore_fdw && make && make install
    FROM debian:stretch-slim
    ENV GOSU_VERSION 1.11
    RUN apt-get update && apt-get install -y wget openssl libprotobuf-c-dev libreadline-dev
    # explicitly set user/group IDs
    RUN set -eux; 
     groupadd -r postgres --gid=999; 
    # https://salsa.debian.org/postgresql/postgresql-common/blob/997d842ee744687d99a2b2d95c1083a2615c79e8/debian/postgresql-common.postinst#L32-35
     useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; 
    # also create the postgres user's home directory with appropriate permissions
    # see https://github.com/docker-library/postgres/issues/274
     mkdir -p /var/lib/postgresql; 
     chown -R postgres:postgres /var/lib/postgresql
    RUN wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" 
       && chmod +x /usr/local/bin/gosu 
       && gosu nobody true
    # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
    RUN set -eux; 
       if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then 
       # if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
       grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; 
       sed -ri '//usr/share/locale/d' /etc/dpkg/dpkg.cfg.d/docker; 
       ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; 
       fi; 
       apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; 
       localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
    ENV LANG en_US.utf8
    # install "nss_wrapper" in case we need to fake "/etc/passwd" and "/etc/group" (especially for OpenShift)
    # https://github.com/docker-library/postgres/issues/359
    # https://cwrap.org/nss_wrapper.html
    RUN set -eux; 
       apt-get update; 
       apt-get install -y --no-install-recommends libnss-wrapper; 
       rm -rf /var/lib/apt/lists/*
    COPY --from=build /usr/local/pgspider /usr/local/pgspider
    RUN sed -ri "s!^#?(listen_addresses)s*=s*S+.*!1 = '*'!" /usr/local/pgspider/share/postgresql/postgresql.conf.sample; 
       grep -F "listen_addresses = '*'" /usr/local/pgspider/share/postgresql/postgresql.conf.sample
    RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
    ENV PATH $PATH:/usr/local/pgspider/bin
    ENV PGDATA /var/lib/postgresql/data
    RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
    VOLUME /var/lib/postgresql/data
    COPY docker-entrypoint.sh /usr/local/bin/
    RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
    ENTRYPOINT ["docker-entrypoint.sh"]
    EXPOSE 5432
    CMD ["postgres"]
     

    说明

    以上都是很那不错的扩展,具体使用可以参考官方文档

    参考资料

    https://github.com/citusdata/cstore_fdw
    https://github.com/citusdata/pg_cron
    https://github.com/rongfengliang/pgspider-docker

  • 相关阅读:
    笔记(二) C#sql语句
    [叩响C#之门]写给初学者:多线程系列(七)——互锁(Interlocked类)
    C# Async与Await的使用
    C#线程锁使用全功略
    一个C#的加锁解锁示例
    【分析】浅谈C#中Control的Invoke与BeginInvoke在主副线程中的执行顺序和区别(SamWang)
    Control.BeginInvoke()和delegate的BeginInvoke()的区别
    crm04 action操作 和 多级过滤
    VIM和sed 替换字符串方法
    解决Centos关闭You have new mail in /var/spool/mail/root提示(转)
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/12354193.html
Copyright © 2020-2023  润新知