I'm trying to achieve that this instance be available only from tailscale network, but I'm receiving "tailscaled got signal terminated; shutting down" after it started, a machine on a few seconds appears on my tailscale dashboard as connected and then gone after a few seconds.
the last docker file:
ARG PG_VERSION=15.3
ARG PG_MAJOR_VERSION=15
ARG VERSION=custom
# Stage 1: Building Go binaries
FROM golang:1.20 AS builder
WORKDIR /go/src/github.com/fly-apps/fly-postgres
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/event_handler ./cmd/event_handler
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/failover_validation ./cmd/failover_validation
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/pg_unregister ./cmd/pg_unregister
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/start_monitor ./cmd/monitor
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/start_admin_server ./cmd/admin_server
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/start ./cmd/start
COPY ./bin/* /fly/bin/
# Stage 2: Tailscale
FROM alpine:latest as tailscale
RUN apk update && apk add ca-certificates iptables ip6tables bash bind-tools jq && rm -rf /var/cache/apk/*
WORKDIR /app
ARG TAILSCALE_VERSION=1.54.1
ENV TSFILE=tailscale_${TAILSCALE_VERSION}_amd64.tgz
RUN wget https://pkgs.tailscale.com/stable/${TSFILE} && tar xzf ${TSFILE} --strip-components=1
COPY tailscale/wrapper.sh ./wrapper.sh
# Stage 3: Postgres Exporter
FROM wrouesnel/postgres_exporter:latest AS postgres_exporter
# Final Stage
FROM postgres:${PG_VERSION}
ENV PGDATA=/data/postgresql
ARG VERSION
ARG PG_MAJOR_VERSION
ARG POSTGIS_MAJOR=3
ARG HAPROXY_VERSION=2.8
LABEL fly.app_role=postgres_cluster
LABEL fly.version=${VERSION}
LABEL fly.pg-version=${PG_VERSION}
LABEL fly.pg-manager=repmgr
# Install dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates iproute2 iptables postgresql-$PG_MAJOR_VERSION-repmgr curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud cron \
&& apt autoremove -y
# PostGIS
RUN apt-get update && apt-get install --no-install-recommends -y \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts
# Haproxy
RUN curl https://haproxy.debian.net/bernat.debian.org.gpg \
| gpg --dearmor > /usr/share/keyrings/haproxy.debian.net.gpg
RUN echo deb "[signed-by=/usr/share/keyrings/haproxy.debian.net.gpg]" \
http://haproxy.debian.net bookworm-backports-${HAPROXY_VERSION} main \
> /etc/apt/sources.list.d/haproxy.list
RUN apt-get update && apt-get install --no-install-recommends -y \
haproxy=$HAPROXY_VERSION.\* \
&& apt autoremove -y
# Copy binaries and scripts
COPY --from=builder /fly/bin/* /usr/local/bin
COPY --from=postgres_exporter /postgres_exporter /usr/local/bin/
ADD /config/* /fly/
RUN mkdir -p /run/haproxy/
RUN usermod -d /data postgres
# Tailscale setup
COPY --from=tailscale /app/wrapper.sh /tailscale/wrapper.sh
COPY --from=tailscale /app/tailscaled /tailscale/tailscaled
COPY --from=tailscale /app/tailscale /tailscale/tailscale
RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale \
&& chmod +x /tailscale/* \
&& update-alternatives --set iptables /usr/sbin/iptables-legacy
RUN echo "listen_addresses = '*'" >> /var/lib/postgresql/data/postgresql.conf
EXPOSE 5432
CMD [ "/tailscale/wrapper.sh", "start"]
Hey,
I'm trying to achieve that this instance be available only from tailscale network, but I'm receiving "tailscaled got signal terminated; shutting down" after it started, a machine on a few seconds appears on my tailscale dashboard as connected and then gone after a few seconds.
the last docker file: