Compare commits
69 commits
6efbd28477
...
antifascis
Author | SHA1 | Date | |
---|---|---|---|
|
aa87543511 | ||
|
0e8b6ac71a | ||
|
fc1a12e592 | ||
|
000ac53f39 | ||
|
53c901224d | ||
|
41354bbc95 | ||
|
c0e6b8150b | ||
|
f7da597784 | ||
|
cf4da1b233 | ||
|
b99a8111d8 | ||
|
aa086a76af | ||
|
2a72840be0 | ||
|
397dff920a | ||
|
91fb3a3c8b | ||
|
e66b364db7 | ||
|
b921379aa0 | ||
|
8dd7d4605a | ||
|
d11e588f03 | ||
|
768bd2acd4 | ||
|
5085c7e8df | ||
|
1233c89aff | ||
|
b05361ae18 | ||
|
2e1d831b82 | ||
|
e79a054aa4 | ||
|
d8924318e4 | ||
|
3dde92d4de | ||
|
3e098e8c24 | ||
|
582b83d3fa | ||
|
5d35cad642 | ||
|
05838f7c90 | ||
|
fedf64f2b9 | ||
|
aebf2bcae3 | ||
|
95ecdbd47f | ||
|
24c31e7eb8 | ||
|
da19bd76f8 | ||
|
1ad3693d73 | ||
|
82e28910a9 | ||
|
1068b67884 | ||
|
434501ef54 | ||
|
9ee7d3659b | ||
|
d72d52401e | ||
|
886b03bfc6 | ||
|
dcf07f90e7 | ||
|
4aa380ee62 | ||
|
9591fdd419 | ||
|
c4d0c8ac35 | ||
|
b0dadddbb0 | ||
|
c1e94bd27f | ||
|
4b19f48126 | ||
|
2bc47841ff | ||
|
1c8763b81c | ||
|
0b354f4fea | ||
|
9c4de359fb | ||
|
c90ba65374 | ||
|
4ac1583bcb | ||
|
deaa49652f | ||
|
e565c1380a | ||
|
65304feb56 | ||
|
a299ab663f | ||
|
60df28bb2e | ||
|
a08a7292fd | ||
|
d81e3064d7 | ||
|
79b2e15559 | ||
|
9a9ee411da | ||
|
2d01fb2d12 | ||
|
95a7bb6915 | ||
|
8c7863746f | ||
|
3dfc34388c | ||
|
c06dc5a527 |
7 changed files with 101 additions and 55 deletions
11
.gitlab-ci.yml
Normal file
11
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
image:
|
||||||
|
name: gcr.io/kaniko-project/executor:debug
|
||||||
|
entrypoint: [""]
|
||||||
|
script:
|
||||||
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||||
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE:latest
|
38
.woodpecker.yml
Normal file
38
.woodpecker.yml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
steps:
|
||||||
|
publish:
|
||||||
|
image: "docker.io/woodpeckerci/plugin-docker-buildx"
|
||||||
|
settings:
|
||||||
|
registry: "https://gitea.nulo.in"
|
||||||
|
username: "sutty"
|
||||||
|
repo: "gitea.nulo.in/sutty/postgresql"
|
||||||
|
tags:
|
||||||
|
- "${ALPINE_VERSION}-${PG_VERSION}"
|
||||||
|
build_args:
|
||||||
|
- "ALPINE_VERSION=${ALPINE_VERSION}"
|
||||||
|
- "PG_VERSION=${PG_VERSION}"
|
||||||
|
- "PG_VERSION_APPENDED=${PG_VERSION_APPENDED}"
|
||||||
|
- "PG_VERSION_FULL=${PG_VERSION_FULL}"
|
||||||
|
- "BASE_IMAGE=gitea.nulo.in/sutty/monit"
|
||||||
|
password:
|
||||||
|
from_secret: "DOCKER_PASSWORD"
|
||||||
|
when:
|
||||||
|
branch: "antifascista"
|
||||||
|
event: "push"
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- ALPINE_VERSION: "3.20.3"
|
||||||
|
PG_VERSION: "16"
|
||||||
|
PG_VERSION_APPENDED: "16"
|
||||||
|
PG_VERSION_FULL: "16.3"
|
||||||
|
- ALPINE_VERSION: "3.20.3"
|
||||||
|
PG_VERSION: "15"
|
||||||
|
PG_VERSION_APPENDED: "15"
|
||||||
|
PG_VERSION_FULL: "15.7"
|
||||||
|
- ALPINE_VERSION: "3.20.3"
|
||||||
|
PG_VERSION: "14"
|
||||||
|
PG_VERSION_APPENDED: "14"
|
||||||
|
PG_VERSION_FULL: "14.12"
|
||||||
|
- ALPINE_VERSION: "3.19.4"
|
||||||
|
PG_VERSION: "13"
|
||||||
|
PG_VERSION_APPENDED: "13"
|
||||||
|
PG_VERSION_FULL: "13.16"
|
31
Dockerfile
31
Dockerfile
|
@ -1,21 +1,24 @@
|
||||||
FROM sutty/monit:latest
|
ARG ALPINE_VERSION=3.18.3
|
||||||
MAINTAINER "f <f@sutty.nl>"
|
ARG BASE_IMAGE=gitea.nulo.in/sutty/monit
|
||||||
|
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
||||||
|
LABEL org.opencontainers.image.authors="f@sutty.nl"
|
||||||
|
ARG PG_VERSION=13
|
||||||
|
ARG PG_VERSION_APPENDED
|
||||||
|
ARG PG_VERSION_FULL
|
||||||
|
|
||||||
ENV PGBASE /var/lib/postgresql
|
ENV PGVER=$PG_VERSION
|
||||||
ENV PGDATA $PGBASE/13/data
|
ENV PGBASE=/var/lib/postgresql
|
||||||
ENV LANG en_US.utf8
|
ENV PGDATA=${PGBASE}/${PGVER}/data
|
||||||
ENV PGUSER sutty
|
ENV PAGER="less -niSFX"
|
||||||
ENV PGDB sutty
|
|
||||||
ENV PGVER 13
|
|
||||||
ENV PGCLIENT sutty
|
|
||||||
ENV PAGER "less -niSFX"
|
|
||||||
|
|
||||||
RUN apk add --no-cache postgresql postgresql-contrib daemonize less
|
# Starting from Alpine 3.15 there are several PostgreSQL versions
|
||||||
|
# supported.
|
||||||
|
RUN apk add --no-cache postgresql${PG_VERSION_APPENDED}~${PG_VERSION_FULL} postgresql${PG_VERSION_APPENDED}-contrib daemonize less
|
||||||
|
RUN install -dm 750 -o postgres -g postgres /etc/postgres.d
|
||||||
|
|
||||||
COPY ./postgresql.sh /usr/local/bin/postgresql
|
|
||||||
COPY ./monit.conf /etc/monit.d/postgresql.conf
|
COPY ./monit.conf /etc/monit.d/postgresql.conf
|
||||||
|
COPY ./postgresqld.sh /usr/local/bin/postgresqld
|
||||||
RUN chmod 750 /usr/local/bin/postgresql
|
COPY ./postgresql.conf /etc/postgres.d/postgresql.conf
|
||||||
|
|
||||||
EXPOSE 5432
|
EXPOSE 5432
|
||||||
VOLUME $PGBASE
|
VOLUME $PGBASE
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
check process postgresql with pidfile /tmp/postgresql.pid
|
check process postgresql with pidfile /run/postgresql/pid
|
||||||
start program = "/usr/local/bin/postgresql start"
|
start program = "/usr/local/bin/postgresqld start"
|
||||||
stop program = "/usr/local/bin/postgresql stop"
|
stop program = "/usr/local/bin/postgresqld stop"
|
||||||
if failed port 5432 protocol pgsql for 3 times within 5 cycles then restart
|
if failed port 5432 protocol pgsql username postgres for 3 times within 5 cycles then restart
|
||||||
|
|
8
postgresql.conf
Normal file
8
postgresql.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
listen_addresses = '*'
|
||||||
|
external_pid_file = '/run/postgresql/pid'
|
||||||
|
log_destination = 'syslog'
|
||||||
|
log_checkpoints = on
|
||||||
|
log_connections = on
|
||||||
|
log_disconnections = on
|
||||||
|
log_hostname = on
|
||||||
|
wal_level = logical
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
stop)
|
|
||||||
/bin/su postgres -c "pg_ctl stop -D ${PGDATA}" ;;
|
|
||||||
reload)
|
|
||||||
/bin/su postgres -c "pg_ctl reload -D ${PGDATA}" ;;
|
|
||||||
*)
|
|
||||||
pid=/tmp/postgresql.pid
|
|
||||||
user=postgres
|
|
||||||
log=${PGDATA}/postgresql.log
|
|
||||||
|
|
||||||
install -dm 2750 -o postgres -g postgres /run/postgresql
|
|
||||||
chown -R postgres:postgres ${PGBASE}
|
|
||||||
|
|
||||||
if test ! -f ${PGDATA}/PG_VERSION ; then
|
|
||||||
su - postgres -c "/usr/bin/initdb --locale ${LANG} -E UTF8 -D ${PGDATA}"
|
|
||||||
su - postgres -c "/usr/bin/pg_ctl start --pgdata ${PGDATA}"
|
|
||||||
su - postgres -c "/usr/bin/createuser --login ${PGUSER}"
|
|
||||||
su - postgres -c "/usr/bin/createdb --owner ${PGUSER} ${PGDB}"
|
|
||||||
su - postgres -c "/usr/bin/pg_ctl stop --pgdata ${PGDATA}"
|
|
||||||
|
|
||||||
echo "host ${PGDB} ${PGUSER} ${PGCLIENT} trust" >> ${PGDATA}/pg_hba.conf
|
|
||||||
echo "host ${PGDB}_test ${PGUSER} ${PGCLIENT} trust" >> ${PGDATA}/pg_hba.conf
|
|
||||||
|
|
||||||
echo "listen_addresses = '*'" >> ${PGDATA}/postgresql.conf
|
|
||||||
echo "external_pid_file = '${pid}'" >> ${PGDATA}/postgresql.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f ${pid}
|
|
||||||
daemonize -u ${user} -c ${PGDATA} -o ${log} -a -e ${log} \
|
|
||||||
/usr/bin/postgres
|
|
||||||
|
|
||||||
su - postgres -c "echo 'create extension if not exists pgcrypto;' | psql -U postgres"
|
|
||||||
;;
|
|
||||||
esac
|
|
23
postgresqld.sh
Executable file
23
postgresqld.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
user=postgres
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
stop)
|
||||||
|
su ${user} -c "pg_ctl stop -D ${PGDATA}" ;;
|
||||||
|
reload)
|
||||||
|
su ${user} -c "pg_ctl reload -D ${PGDATA}" ;;
|
||||||
|
*)
|
||||||
|
install -dm 2750 -o ${user} -g ${user} /run/postgresql
|
||||||
|
chown -R ${user}:${user} ${PGBASE}
|
||||||
|
|
||||||
|
if test ! -f ${PGDATA}/PG_VERSION ; then
|
||||||
|
su ${user} -c "/usr/bin/initdb -D ${PGDATA}"
|
||||||
|
|
||||||
|
echo "include_dir = '/etc/postgres.d'" >> ${PGDATA}/postgresql.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
daemonize -u ${user} -c ${PGDATA} /usr/bin/postgres
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in a new issue