forked from Deuxfleurs/infrastructure
Merge branch 'master' of git.deuxfleurs.fr:Deuxfleurs/infrastructure
This commit is contained in:
commit
eb3f64df41
3 changed files with 12 additions and 43 deletions
|
@ -94,7 +94,7 @@ services:
|
||||||
build:
|
build:
|
||||||
args:
|
args:
|
||||||
# https://github.com/sorintlab/stolon/releases
|
# https://github.com/sorintlab/stolon/releases
|
||||||
STOLON_VERSION: v0.16.0
|
STOLON_VERSION: 2d0b8e516a4eaec01f3a9509cdc50a1d4ce8709c
|
||||||
# https://packages.debian.org/fr/stretch/postgresql-all
|
# https://packages.debian.org/fr/stretch/postgresql-all
|
||||||
PG_VERSION: 9.6+181+deb9u3
|
PG_VERSION: 9.6+181+deb9u3
|
||||||
context: ./postgres/build/postgres
|
context: ./postgres/build/postgres
|
||||||
|
|
|
@ -1,25 +1,16 @@
|
||||||
FROM amd64/debian:stretch
|
FROM golang:1.13-buster AS builder
|
||||||
|
|
||||||
ARG STOLON_VERSION
|
ARG STOLON_VERSION
|
||||||
|
WORKDIR /stolon
|
||||||
|
RUN git clone https://github.com/sorintlab/stolon .
|
||||||
|
RUN git pull && git checkout ${STOLON_VERSION}
|
||||||
|
RUN go mod download
|
||||||
|
RUN make && chmod +x /stolon/bin/*
|
||||||
|
|
||||||
|
FROM amd64/debian:stretch
|
||||||
ARG PG_VERSION
|
ARG PG_VERSION
|
||||||
|
RUN apt-get update && \
|
||||||
RUN echo "deb http://deb.debian.org/debian stretch-backports main contrib non-free # available after stretch release" > /etc/apt/sources.list.d/stretch-backports.list && \
|
apt-get install -y postgresql-all=${PG_VERSION}
|
||||||
apt-get update && \
|
COPY --from=builder /stolon/bin /usr/local/bin
|
||||||
apt-get -qq -y full-upgrade && \
|
|
||||||
apt-get install -y \
|
|
||||||
postgresql-all=${PG_VERSION} \
|
|
||||||
golang-1.11 \
|
|
||||||
git && \
|
|
||||||
export GOPATH=/usr/local/go && \
|
|
||||||
mkdir -p /usr/local/go/src/github.com/sorintlab && \
|
|
||||||
cd /usr/local/go/src/github.com/sorintlab && \
|
|
||||||
git clone --depth 1 --branch ${STOLON_VERSION} https://github.com/sorintlab/stolon && \
|
|
||||||
ln -s /usr/lib/go-1.11/bin/go /usr/bin/go && \
|
|
||||||
ln -s /usr/lib/go-1.11/bin/gofmt /usr/bin/gofmt && \
|
|
||||||
cd ./stolon && \
|
|
||||||
./build && \
|
|
||||||
mv /usr/local/go/src/github.com/sorintlab/stolon/bin/* /usr/local/bin/ && \
|
|
||||||
rm -rf /usr/local/go
|
|
||||||
|
|
||||||
USER postgres
|
USER postgres
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -f /local/pg_hba.conf ]; then
|
|
||||||
echo "Copying Nomad configuration..."
|
|
||||||
cp /local/pg_hba.conf /etc/postgresql/9.6/main/
|
|
||||||
echo "Done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$(ls -A /var/lib/postgresql/9.6/main)" ]; then
|
|
||||||
echo "Copying base"
|
|
||||||
cp -r /var/lib/postgresql/9.6/base/* /var/lib/postgresql/9.6/main
|
|
||||||
echo "Done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod -R 700 /var/lib/postgresql/9.6/main
|
|
||||||
chown -R postgres /var/lib/postgresql/9.6/main
|
|
||||||
|
|
||||||
echo "Starting postgres..."
|
|
||||||
. /usr/share/postgresql-common/init.d-functions
|
|
||||||
start 9.6
|
|
||||||
tail -f /var/log/postgresql/postgresql-9.6-main.log
|
|
Loading…
Reference in a new issue