Skip to content
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

[WIP] Add timescaledb extension #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG PG_VERSION=14.1
ARG VERSION=custom
ARG TIMESCALEDB_VERSION=2.5.1

FROM golang:1.16 as flyutil
ARG VERSION
Expand All @@ -22,6 +23,17 @@ FROM flyio/stolon:b6b9aaf as stolon

FROM wrouesnel/postgres_exporter:latest AS postgres_exporter

FROM postgres:${PG_VERSION} AS timescaledb-ext
ARG TIMESCALEDB_VERSION
WORKDIR /home
RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates git make cmake gcc libkrb5-dev postgresql-server-dev-${PG_MAJOR} && \
git clone -b $TIMESCALEDB_VERSION https://github.com/timescale/timescaledb.git && \
cd timescaledb && \
./bootstrap && \
cd build && make && \
make install

FROM postgres:${PG_VERSION}
ARG VERSION
ARG POSTGIS_MAJOR=3
Expand All @@ -38,6 +50,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \

COPY --from=stolon /go/src/app/bin/* /usr/local/bin/
COPY --from=postgres_exporter /postgres_exporter /usr/local/bin/
COPY --from=timescaledb-ext /usr/share/postgresql/${PG_MAJOR}/extension/timescaledb* /usr/share/postgresql/${PG_MAJOR}/extension/
COPY --from=timescaledb-ext /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb* /usr/lib/postgresql/${PG_MAJOR}/lib/

ADD /scripts/* /fly/
ADD /config/* /fly/
Expand Down
6 changes: 4 additions & 2 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
app = "postgres-ha-example"
# fly.toml file generated for gather-dispatcher-db on 2022-02-10T16:52:53+07:00

app = "gather-dispatcher-db"

kill_signal = "SIGTERM"
kill_timeout = 300
Expand Down Expand Up @@ -35,7 +37,7 @@ services = []

[env]
BACKEND_STORE = "consul"
PRIMARY_REGION = "ord"
PRIMARY_REGION = "sin"

[experimental]
allowed_public_ports = []
Expand Down
1 change: 1 addition & 0 deletions pkg/flypg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func InitConfig(filename string) (*Config, error) {
"max_worker_processes": "8",
"max_parallel_workers": "8",
"max_parallel_workers_per_gather": "2",
"shared_preload_libraries": "timescaledb",
},
}

Expand Down