wk1: initial docker image setup
This commit is contained in:
commit
51738fcac7
33 changed files with 1833 additions and 0 deletions
23
target/scripts/build/packages.sh
Normal file
23
target/scripts/build/packages.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEBUG_PACKAGES=(procps)
|
||||
POSTFIX_PACKAGES=(postfix)
|
||||
DOVECOT_PACKAGES=(dovecot-core dovecot-imapd dovecot-ldap)
|
||||
RSPAMD_PACKAGES=(rspamd redis-server)
|
||||
FAIL2BAN_PACKAGES=(fail2ban)
|
||||
|
||||
PACKAGES=(
|
||||
tini
|
||||
supervisor
|
||||
${DEBUG_PACKAGES[@]}
|
||||
${POSTFIX_PACKAGES[@]}
|
||||
${DOVECOT_PACKAGES[@]}
|
||||
# ${RSPAMD_PACKAGES[@]}
|
||||
# ${FAIL2BAN_PACKAGES[@]}
|
||||
)
|
||||
|
||||
apt update
|
||||
apt install -y "${PACKAGES[@]}"
|
||||
apt clean
|
||||
|
||||
# TODO: post-installation goes here
|
||||
5
target/scripts/helpers/index.sh
Normal file
5
target/scripts/helpers/index.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_PATH="/usr/local/bin/helpers"
|
||||
|
||||
source "${SCRIPT_PATH}/log.sh"
|
||||
9
target/scripts/helpers/log.sh
Normal file
9
target/scripts/helpers/log.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
LOGFILE=/var/log/mail/mail.log
|
||||
mkdir -p $(dirname "$LOGFILE")
|
||||
touch "${LOGFILE}"
|
||||
|
||||
function log() {
|
||||
/usr/local/bin/log "$1" "$2" > $LOGFILE
|
||||
}
|
||||
26
target/scripts/start-services.sh
Normal file
26
target/scripts/start-services.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
source /usr/local/bin/helpers/index.sh
|
||||
|
||||
start_daemon () {
|
||||
service="$1"
|
||||
log "info" "Starting service $service..."
|
||||
result=$(supervisorctl start "${service}" 2>&1)
|
||||
|
||||
if [[ ${?} -ne 0 ]]; then
|
||||
log "error" "Failed to start $service"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# start daemons
|
||||
log "info" "Starting daemons..."
|
||||
start_daemon fail2ban-server
|
||||
start_daemon rspamd
|
||||
start_daemon rspamd-redis
|
||||
start_daemon dovecot
|
||||
start_daemon postfix
|
||||
|
||||
exec tail "${LOGFILE}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue