From ae7dddcf249669a02bfca0a26953ec2599020036 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Wed, 29 Oct 2025 09:11:24 +0100 Subject: [PATCH] Added pgs.in. --- .../firstboot/scripts/01_setupnetworking.sh | 99 +++++++++++++++++++ .../c3d/firstboot/scripts/02_settimezone.sh | 21 ++++ .../firstboot/scripts/10_setuppostgresql.sh | 67 +++++++++++++ .../c3d/firstboot/scripts/90_setupservices.sh | 12 +++ sources/pgs.in/c3d/mode.txt | 7 ++ sources/pgs.in/c3d/owner.txt | 1 + .../etc/ssh/authorized-principals.postgres | 3 + .../etc/ssh/authorized-principals.root | 3 + .../install-data/etc/ssh/ssh_host_ed25519_key | 7 ++ .../etc/ssh/ssh_host_ed25519_key-cert.pub | 1 + .../etc/ssh/ssh_host_ed25519_key.pub | 1 + .../etc/ssh/sshd_config.d/99-host-cert.conf | 1 + .../ssh/sshd_config.d/99-principals-file.conf | 1 + .../etc/ssh/sshd_config.d/99-user-CA.conf | 1 + .../install-data/etc/ssh/trusted-user-ca.keys | 1 + .../usr/local/bin/archive_command.sh | 36 +++++++ .../usr/local/bin/backup_postgresql.sh | 52 ++++++++++ .../usr/local/bin/restore_command.sh | 35 +++++++ .../postinstall/scripts/10_setupservices.sh | 6 ++ .../postinstall/scripts/20_setupcrontab.sh | 4 + sources/pgs.in/config | 28 ++++++ sources/pgs.in/envvars | 10 ++ sources/start-order.txt | 16 +-- 23 files changed, 406 insertions(+), 7 deletions(-) create mode 100755 sources/pgs.in/c3d/firstboot/scripts/01_setupnetworking.sh create mode 100755 sources/pgs.in/c3d/firstboot/scripts/02_settimezone.sh create mode 100755 sources/pgs.in/c3d/firstboot/scripts/10_setuppostgresql.sh create mode 100755 sources/pgs.in/c3d/firstboot/scripts/90_setupservices.sh create mode 100644 sources/pgs.in/c3d/mode.txt create mode 100644 sources/pgs.in/c3d/owner.txt create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.postgres create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.root create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key-cert.pub create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key.pub create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-host-cert.conf create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-principals-file.conf create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-user-CA.conf create mode 100644 sources/pgs.in/c3d/postinstall/install-data/etc/ssh/trusted-user-ca.keys create mode 100644 sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/archive_command.sh create mode 100644 sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/backup_postgresql.sh create mode 100644 sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/restore_command.sh create mode 100755 sources/pgs.in/c3d/postinstall/scripts/10_setupservices.sh create mode 100755 sources/pgs.in/c3d/postinstall/scripts/20_setupcrontab.sh create mode 100644 sources/pgs.in/config create mode 100644 sources/pgs.in/envvars diff --git a/sources/pgs.in/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/pgs.in/c3d/firstboot/scripts/01_setupnetworking.sh new file mode 100755 index 0000000..85075cf --- /dev/null +++ b/sources/pgs.in/c3d/firstboot/scripts/01_setupnetworking.sh @@ -0,0 +1,99 @@ +#!/bin/sh + + +export PAGER= + + +sleep 1 +systemctl --quiet is-active NetworkManager.service +NM_RC=$? +CYCLES_WAITED=0 +while [ $NM_RC -ne 0 ] +do + if [ $CYCLES_WAITED -ge 10 ] + then + exit 1 + fi + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for NetworkManager" + fi + echo -n . + sleep 1 + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) + systemctl --quiet is-active NetworkManager.service + NM_RC=$? +done +[ $CYCLES_WAITED -gt 0 ] && echo + +# wait for the two network connections to come up +# the two connections being the loopback and eth0 +CONNECTION_DEVICES_UP=$(nmcli --terse connection show --active | wc -l) +CYCLES_WAITED=0 +while [ $CONNECTION_DEVICES_UP -lt 2 ] +do + if [ $CYCLES_WAITED -ge 10 ] + then + echo + nmcli connection show + exit 1 + fi + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for the network connection" + fi + echo -n . + sleep 1 + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) + CONNECTION_DEVICES_UP=$(nmcli --terse connection show --active \ + | wc -l) +done +[ $CYCLES_WAITED -gt 0 ] && echo + +CONNECTIONS=$(nmcli --terse connection show \ + | grep ':802-3-ethernet:' | wc -l) +if [ $CONNECTIONS -ne 1 ] +then + echo "There are $CONNECTIONS ethernet connections (instead of 1):" + nmcli connection show +fi + +CONNECTION_DEVICE="eth0" +CONNECTION_ID="internal" + +nmcli --terse connection show \ + | grep ':802-3-ethernet:' \ + | while read CONNECTION_LINE +do + CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':') + nmcli connection delete uuid "$CONNECTION_UUID" +done + +nmcli connection add \ + connection.autoconnect yes \ + connection.id $CONNECTION_ID \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ + ipv4.addresses "10.228.109.153/16" \ + ipv4.dns "10.228.109.159, 10.228.92.159" \ + ipv4.dns-search "in.useribm.hu" \ + ipv4.gateway "10.228.109.254" \ + ipv4.method "manual" \ + ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d99/64" \ + ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \ + ipv6.dns-search "in.useribm.hu" \ + ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \ + ipv6.method "manual" \ + save yes + +cat </etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf +[device] +match-device=interface-name:$CONNECTION_DEVICE +allowed-connections=id:$CONNECTION_ID +keep-configuration=no +EOF + +nmcli connection show + +hostnamectl hostname pgs.in.useribm.hu +hostnamectl diff --git a/sources/pgs.in/c3d/firstboot/scripts/02_settimezone.sh b/sources/pgs.in/c3d/firstboot/scripts/02_settimezone.sh new file mode 100755 index 0000000..20b2a71 --- /dev/null +++ b/sources/pgs.in/c3d/firstboot/scripts/02_settimezone.sh @@ -0,0 +1,21 @@ +#!/bin/sh + + +sleep 1 +systemctl --quiet is-active dbus.service +DBUS_RC=$? +WAITED=0 +while [ $DBUS_RC -ne 0 ] +do + if [ $WAITED -eq 0 ] + then + echo -n "Waiting for dbus.service" + fi + echo -n . + sleep 1 + WAITED=1 + systemctl --quiet is-active dbus.service + DBUS_RC=$? +done +[ $WAITED -ne 0 ] && echo +timedatectl set-timezone Europe/Budapest diff --git a/sources/pgs.in/c3d/firstboot/scripts/10_setuppostgresql.sh b/sources/pgs.in/c3d/firstboot/scripts/10_setuppostgresql.sh new file mode 100755 index 0000000..4a080df --- /dev/null +++ b/sources/pgs.in/c3d/firstboot/scripts/10_setuppostgresql.sh @@ -0,0 +1,67 @@ +#!/bin/sh + + +POSTGRESQL_PATH=/data/postgresql +DUMP_PATH=$POSTGRESQL_PATH/dumps +WAL_ARCHIVE_PATH=$POSTGRESQL_PATH/wal-archive + + +if [ ! -d $POSTGRESQL_PATH ] +then + mkdir $POSTGRESQL_PATH +fi +chown postgres:postgres $POSTGRESQL_PATH +if [ ! -d $DUMP_PATH ] +then + mkdir $DUMP_PATH +fi +chown postgres:postgres $DUMP_PATH +if [ ! -d $WAL_ARCHIVE_PATH ] +then + mkdir $WAL_ARCHIVE_PATH +fi + +# create the main database cluster +MAIN_DBC_NAME=main-dbc +MAIN_DBC_PATH=$POSTGRESQL_PATH/$MAIN_DBC_NAME +MAIN_DBC_DUMP_PATH=$DUMP_PATH/$MAIN_DBC_NAME +MAIN_DBC_WAL_ARCHIVE_PATH=$WAL_ARCHIVE_PATH/$MAIN_DBC_NAME + +if [ ! -d $MAIN_DBC_DUMP_PATH ] +then + mkdir $MAIN_DBC_DUMP_PATH +fi +chown postgres:postgres $MAIN_DBC_DUMP_PATH +if [ ! -d $MAIN_DBC_WAL_ARCHIVE_PATH ] +then + mkdir $MAIN_DBC_WAL_ARCHIVE_PATH +fi +chown postgres:postgres $MAIN_DBC_WAL_ARCHIVE_PATH + +postgresql-new-systemd-unit \ + --unit postgresql@main \ + --datadir $MAIN_DBC_PATH + +if [ ! -d $MAIN_DBC_PATH ] +then + postgresql-setup \ + --initdb \ + --port=5432 \ + --unit=postgresql@main +fi + +# create the test & devel database cluster +TD_DBC_NAME=td-dbc +TD_DBC_PATH=$POSTGRESQL_PATH/$TD_DBC_NAME + +postgresql-new-systemd-unit \ + --unit postgresql@td \ + --datadir $TD_DBC_PATH + +if [ ! -d $TD_DBC_PATH ] +then + postgresql-setup \ + --initdb \ + --port=54321 \ + --unit=postgresql@td +fi diff --git a/sources/pgs.in/c3d/firstboot/scripts/90_setupservices.sh b/sources/pgs.in/c3d/firstboot/scripts/90_setupservices.sh new file mode 100755 index 0000000..4830d4e --- /dev/null +++ b/sources/pgs.in/c3d/firstboot/scripts/90_setupservices.sh @@ -0,0 +1,12 @@ +#!/bin/sh + + +systemctl enable postgresql@main.service +systemctl start postgresql@main.service +systemctl enable postgresql@td.service +systemctl start postgresql@td.service +systemctl enable NetworkManager-wait-online.service +systemctl start NetworkManager-wait-online.service + +systemctl enable logrotate.timer +systemctl start logrotate.timer diff --git a/sources/pgs.in/c3d/mode.txt b/sources/pgs.in/c3d/mode.txt new file mode 100644 index 0000000..507117b --- /dev/null +++ b/sources/pgs.in/c3d/mode.txt @@ -0,0 +1,7 @@ +# mode file (relative to /c3d) +755 firstboot/scripts/*.sh +600 postinstall/install-data/etc/ssh/ssh_host_*_key +644 postinstall/install-data/etc/ssh/ssh_host_*_key.pub +600 postinstall/install-data/etc/ssh/sshd_config.d/*.conf +755 postinstall/install-data/usr/local/bin/*.sh +755 postinstall/scripts/*.sh diff --git a/sources/pgs.in/c3d/owner.txt b/sources/pgs.in/c3d/owner.txt new file mode 100644 index 0000000..49158bf --- /dev/null +++ b/sources/pgs.in/c3d/owner.txt @@ -0,0 +1 @@ +# owner file (relative to /c3d) diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.postgres b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.postgres new file mode 100644 index 0000000..4919229 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.postgres @@ -0,0 +1,3 @@ +mszabo +scripts +zfelleg diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.root b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.root new file mode 100644 index 0000000..4919229 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/authorized-principals.root @@ -0,0 +1,3 @@ +mszabo +scripts +zfelleg diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key new file mode 100644 index 0000000..0695eae --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACAetByRKBVJsbs9pLpL2wWQf3j1XPw3ApZ1lJhYXkE7MQAAAIj2Unip9lJ4 +qQAAAAtzc2gtZWQyNTUxOQAAACAetByRKBVJsbs9pLpL2wWQf3j1XPw3ApZ1lJhYXkE7MQ +AAAEDMaDC7S5XnxSgkUe7au4hkFcyb//HYG3lzXFw1+Uz1ER60HJEoFUmxuz2kukvbBZB/ +ePVc/DcClnWUmFheQTsxAAAAAAECAwQF +-----END OPENSSH PRIVATE KEY----- diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key-cert.pub b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key-cert.pub new file mode 100644 index 0000000..47e67a2 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key-cert.pub @@ -0,0 +1 @@ +ssh-ed25519-cert-v01@openssh.com AAAAIHNzaC1lZDI1NTE5LWNlcnQtdjAxQG9wZW5zc2guY29tAAAAINF/tKvdmYHq6OMGh3S1vzmu5DaXHe7Tntd4i9Evk1oXAAAAIB60HJEoFUmxuz2kukvbBZB/ePVc/DcClnWUmFheQTsxAAAAAAAAAAAAAAACAAAAEXBncy5pbi51c2VyaWJtLmh1AAAAAAAAAAAAAAAA//////////8AAAAAAAAAAAAAAAAAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIEXYIIzrUSx8/BQ6/ttkSr5oEyB5F5Yg4bp1DOkqDON9AAAAUwAAAAtzc2gtZWQyNTUxOQAAAECaRgvkNcRXtYeM7ugx1jO6P9LsuvheeBueJ/KJMz/SYb+ZOaZjFz/O7WT8aO2B9G/7o+KIjElxl3bQORMOcakH ssh_host_ed25519_key.pub diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key.pub b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key.pub new file mode 100644 index 0000000..9dfc5d6 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/ssh_host_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB60HJEoFUmxuz2kukvbBZB/ePVc/DcClnWUmFheQTsx diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-host-cert.conf b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-host-cert.conf new file mode 100644 index 0000000..173b545 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-host-cert.conf @@ -0,0 +1 @@ +HostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pub diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-principals-file.conf b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-principals-file.conf new file mode 100644 index 0000000..f9b4b3e --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-principals-file.conf @@ -0,0 +1 @@ +AuthorizedPrincipalsFile /etc/ssh/authorized-principals.%u diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-user-CA.conf b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-user-CA.conf new file mode 100644 index 0000000..115882b --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/sshd_config.d/99-user-CA.conf @@ -0,0 +1 @@ +TrustedUserCAKeys /etc/ssh/trusted-user-ca.keys diff --git a/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/trusted-user-ca.keys b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/trusted-user-ca.keys new file mode 100644 index 0000000..84d19e3 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/etc/ssh/trusted-user-ca.keys @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICcf/XXU8dNVtbveGmwbdnRJfYIItzxKmgRkzlp0k6r5 user-CA diff --git a/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/archive_command.sh b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/archive_command.sh new file mode 100644 index 0000000..79ec5b8 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/archive_command.sh @@ -0,0 +1,36 @@ +#!/bin/sh + + +# Any %p in the string is replaced by the path name of the file to +# archive, and any %f is replaced by only the file name. (The path +# name is relative to the working directory of the server, i.e., the +# cluster's data directory.) Use %% to embed an actual % character in +# the command. It is important for the command to return a zero exit +# status only if it succeeds. + + +FQ_WAL_FILE=$1 +WAL_FILE=$2 +POSTGRESQL_PATH=/data/postgresql +WAL_ARCHIVE_PATH=$POSTGRESQL_PATH/wal-archive +MAIN_DBC_NAME=main-dbc +MAIN_DBC_PATH=$POSTGRESQL_PATH/$MAIN_DBC_NAME +MAIN_DBC_WAL_ARCHIVE_PATH=$WAL_ARCHIVE_PATH/$MAIN_DBC_NAME + + +if [ -f $MAIN_DBC_WAL_ARCHIVE_PATH/${WAL_FILE}.gz ] +then + ARCHIVED_CHECKSUM=$(md5sum $MAIN_DBC_WAL_ARCHIVE_PATH/${WAL_FILE}.gz \ + | cut -f 1 -d ' ') + CURRENT_CHECKSUM=$(gzip --to-stdout $MAIN_DBC_PATH/$FQ_WAL_FILE \ + | md5sum | cut -f 1 -d ' ') + if [ "$ARCHIVED_CHECKSUM" == "$CURRENT_CHECKSUM" ] + then + exit 0 + else + exit 1 + fi +else + cp --archive $MAIN_DBC_PATH/$FQ_WAL_FILE $MAIN_DBC_WAL_ARCHIVE_PATH + gzip $MAIN_DBC_WAL_ARCHIVE_PATH/$WAL_FILE +fi diff --git a/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/backup_postgresql.sh b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/backup_postgresql.sh new file mode 100644 index 0000000..88fe675 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/backup_postgresql.sh @@ -0,0 +1,52 @@ +#!/bin/sh + + +CURRENT_DATE=$(date +%Y%m%d) +POSTGRESQL_PATH=/data/postgresql +DUMP_PATH=$POSTGRESQL_PATH/dumps +WAL_ARCHIVE_PATH=$POSTGRESQL_PATH/wal-archive +MAIN_DBC_NAME=main-dbc +MAIN_DBC_DUMP_PATH=$DUMP_PATH/$MAIN_DBC_NAME +MAIN_DBC_WAL_ARCHIVE_PATH=$WAL_ARCHIVE_PATH/$MAIN_DBC_NAME +MAIN_DBC_DUMP_FILE=$MAIN_DBC_DUMP_PATH/dumpall.$CURRENT_DATE + + +pg_dumpall --clean --if-exists --file=$MAIN_DBC_DUMP_FILE +gzip $MAIN_DBC_DUMP_FILE + +# non-start-or-middle-of-months +NONSOMOMS=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --invert-match \ + --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) +while [ $NONSOMOMS -gt 5 ] +do + FIRST_NONSOMOM=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --invert-match \ + --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) + rm --force --recursive $FIRST_NONSOMOM + NONSOMOMS=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --invert-match \ + --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) +done + +# start-or-middle-of-months +SOMOMS=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) +while [ $SOMOMS -gt 5 ] +do + FIRST_SOMOM=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) + rm --force --recursive $FIRST_SOMOM + SOMOMS=$(ls $MAIN_DBC_DUMP_PATH/dumpall.* \ + | grep --regexp='01.gz$' \ + --regexp='15.gz$' | wc -l) +done + +# WAL +OLDEST_DUMP_FILE=$(ls -t $MAIN_DBC_DUMP_PATH/dumpall.* | head -n 1) +find $MAIN_DBC_WAL_ARCHIVE_PATH ! -newer $OLDEST_DUMP_FILE | xargs rm --force diff --git a/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/restore_command.sh b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/restore_command.sh new file mode 100644 index 0000000..7e389c9 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/install-data/usr/local/bin/restore_command.sh @@ -0,0 +1,35 @@ +#!/bin/sh + + +# Any %f in the string is replaced by the name of the file to retrieve +# from the archive, and any %p is replaced by the copy destination path +# name on the server. (The path name is relative to the current working +# directory, i.e., the cluster's data directory.) Any %r is replaced by +# the name of the file containing the last valid restart point. That is +# the earliest file that must be kept to allow a restore to be +# restartable, so this information can be used to truncate the archive +# to just the minimum required to support restarting from the current +# restore. %r is typically only used by warm-standby configurations. +# Write %% to embed an actual % character. +# It is important for the command to return a zero exit status only if +# it succeeds. The command will be asked for file names that are not +# present in the archive; it must return nonzero when so asked. + + +FQ_WAL_FILE=$1 +WAL_FILE=$2 +POSTGRESQL_PATH=/data/postgresql +WAL_ARCHIVE_PATH=$POSTGRESQL_PATH/wal-archive +MAIN_DBC_NAME=main-dbc +MAIN_DBC_PATH=$POSTGRESQL_PATH/$MAIN_DBC_NAME +MAIN_DBC_WAL_ARCHIVE_PATH=$WAL_ARCHIVE_PATH/$MAIN_DBC_NAME + + +if [ -f $MAIN_DBC_WAL_ARCHIVE_PATH/${WAL_FILE}.gz ] +then + cp --archive $MAIN_DBC_WAL_ARCHIVE_PATH/${WAL_FILE}.gz \ + $MAIN_DBC_PATH/${FQ_WAL_FILE}.gz + gunzip $MAIN_DBC_PATH/${FQ_WAL_FILE}.gz +else + exit 1 +fi diff --git a/sources/pgs.in/c3d/postinstall/scripts/10_setupservices.sh b/sources/pgs.in/c3d/postinstall/scripts/10_setupservices.sh new file mode 100755 index 0000000..15d7944 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/scripts/10_setupservices.sh @@ -0,0 +1,6 @@ +#!/bin/sh + + +systemctl disable NetworkManager-wait-online.service + +systemctl disable logrotate.timer diff --git a/sources/pgs.in/c3d/postinstall/scripts/20_setupcrontab.sh b/sources/pgs.in/c3d/postinstall/scripts/20_setupcrontab.sh new file mode 100755 index 0000000..033b8b4 --- /dev/null +++ b/sources/pgs.in/c3d/postinstall/scripts/20_setupcrontab.sh @@ -0,0 +1,4 @@ +#!/bin/sh + + +echo '10 2 * * * postgresql /usr/local/bin/backup_postgresql.sh' >>/etc/crontab diff --git a/sources/pgs.in/config b/sources/pgs.in/config new file mode 100644 index 0000000..ebf62aa --- /dev/null +++ b/sources/pgs.in/config @@ -0,0 +1,28 @@ +lxc.include = /usr/share/lxc/config/common.conf + +lxc.uts.name = pgs.in.useribm.hu +lxc.rootfs.path = __CONTAINER_PATH__/rootfs +lxc.mount.auto = proc sys +lxc.mount.entry = __CONTAINER_FILESYSTEMS_PATH__ data none bind,create=dir 0 0 + +lxc.net.0.type = veth +lxc.net.0.flags = up +lxc.net.0.link = brci-dev +lxc.net.0.hwaddr = 02:0c:18:03:6d:99 + +lxc.autodev = 1 + +lxc.cgroup2.devices.allow = a +lxc.cgroup2.memory.high = 12G +lxc.cgroup2.memory.max = 16G + +lxc.group = in + +lxc.idmap = u 0 100000 100000 +lxc.idmap = g 0 100000 100000 + +lxc.signal.halt = SIGRTMIN+4 + +lxc.start.auto = 1 +lxc.start.order = __CONTAINER_START_ORDER__ +lxc.start.delay = 5 diff --git a/sources/pgs.in/envvars b/sources/pgs.in/envvars new file mode 100644 index 0000000..c545490 --- /dev/null +++ b/sources/pgs.in/envvars @@ -0,0 +1,10 @@ +DISTRIBUTION=Fedora +DISTRIBUTION_VERSION=42 +SPEC_PACKAGES="cronie \ + glibc-all-langpacks \ + glibc-langpack-en \ + glibc-langpack-hu \ + glibc-locale-source \ + postgresql-server \ + openssh-clients \ + openssh-server" diff --git a/sources/start-order.txt b/sources/start-order.txt index d5d005f..56478bf 100644 --- a/sources/start-order.txt +++ b/sources/start-order.txt @@ -6,8 +6,9 @@ group 2: pns.pm 12 group 3: - ws.pm 21 - xfr.pm 22 + mx.pm 21 + ws.pm 22 + xfr.pm 23 group 4: ifg.in 31 @@ -24,11 +25,12 @@ group 5: group 6: db2.in 51 fds.in 52 - pki.in 53 - slycpx.in 54 - slycrm.in 55 - sns.in 56 - wiki.in 57 + pgs.in 53 + pki.in 54 + slycpx.in 55 + slycrm.in 56 + sns.in 57 + wiki.in 58 group 7: git.pm 61 -- 2.54.0