Compare commits
No commits in common. "antifascista" and "6efbd28477d56061a1e560ece10f33100717e51e" have entirely different histories.
antifascis
...
6efbd28477
7 changed files with 55 additions and 101 deletions
|
@ -1,11 +0,0 @@
|
||||||
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
|
|
|
@ -1,38 +0,0 @@
|
||||||
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,24 +1,21 @@
|
||||||
ARG ALPINE_VERSION=3.18.3
|
FROM sutty/monit:latest
|
||||||
ARG BASE_IMAGE=gitea.nulo.in/sutty/monit
|
MAINTAINER "f <f@sutty.nl>"
|
||||||
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 PGVER=$PG_VERSION
|
ENV PGBASE /var/lib/postgresql
|
||||||
ENV PGBASE=/var/lib/postgresql
|
ENV PGDATA $PGBASE/13/data
|
||||||
ENV PGDATA=${PGBASE}/${PGVER}/data
|
ENV LANG en_US.utf8
|
||||||
ENV PAGER="less -niSFX"
|
ENV PGUSER sutty
|
||||||
|
ENV PGDB sutty
|
||||||
|
ENV PGVER 13
|
||||||
|
ENV PGCLIENT sutty
|
||||||
|
ENV PAGER "less -niSFX"
|
||||||
|
|
||||||
# Starting from Alpine 3.15 there are several PostgreSQL versions
|
RUN apk add --no-cache postgresql postgresql-contrib daemonize less
|
||||||
# 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
|
|
||||||
COPY ./postgresql.conf /etc/postgres.d/postgresql.conf
|
RUN chmod 750 /usr/local/bin/postgresql
|
||||||
|
|
||||||
EXPOSE 5432
|
EXPOSE 5432
|
||||||
VOLUME $PGBASE
|
VOLUME $PGBASE
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
check process postgresql with pidfile /run/postgresql/pid
|
check process postgresql with pidfile /tmp/postgresql.pid
|
||||||
start program = "/usr/local/bin/postgresqld start"
|
start program = "/usr/local/bin/postgresql start"
|
||||||
stop program = "/usr/local/bin/postgresqld stop"
|
stop program = "/usr/local/bin/postgresql stop"
|
||||||
if failed port 5432 protocol pgsql username postgres for 3 times within 5 cycles then restart
|
if failed port 5432 protocol pgsql for 3 times within 5 cycles then restart
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
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
|
|
37
postgresql.sh
Normal file
37
postgresql.sh
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/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
|
|
@ -1,23 +0,0 @@
|
||||||
#!/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