Compare commits
No commits in common. "bfae98946a3d03c14278c3d62523033a77cc5d1d" and "f34b13b347f03ecb29f0dc7318ddb4f879881b87" have entirely different histories.
bfae98946a
...
f34b13b347
|
@ -1,19 +1,17 @@
|
||||||
---
|
---
|
||||||
version: '3.9'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
mail:
|
mail:
|
||||||
image: mailserver/docker-mailserver:12.1.0
|
image: mailserver/docker-mailserver:11.3.1
|
||||||
hostname: ${HOSTNAME}
|
hostname: ${HOSTNAME}
|
||||||
domainname: ${DOMAINNAME}
|
domainname: ${DOMAINNAME}
|
||||||
container_name: ${CONTAINER_NAME}
|
container_name: ${CONTAINER_NAME}
|
||||||
restart: unless-stopped
|
restart: always
|
||||||
stop_grace_period: 2m30s # Avoid data loss
|
|
||||||
ports:
|
ports:
|
||||||
- "25:25"
|
- "25:25"
|
||||||
- "143:143"
|
- "143:143"
|
||||||
- "587:587"
|
- "587:587"
|
||||||
- "993:993"
|
- "993:993"
|
||||||
# - "127.0.0.1:1134:1134" # Only useful once we enable RSPAMD
|
|
||||||
volumes:
|
volumes:
|
||||||
- maildata:/var/mail
|
- maildata:/var/mail
|
||||||
- mailstate:/var/mail-state
|
- mailstate:/var/mail-state
|
||||||
|
@ -28,15 +26,10 @@ services:
|
||||||
- SYS_PTRACE
|
- SYS_PTRACE
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
logging:
|
|
||||||
driver: "json-file"
|
|
||||||
options:
|
|
||||||
max-size: "10m"
|
|
||||||
max-file: "3"
|
|
||||||
|
|
||||||
roundcubedb:
|
roundcubedb:
|
||||||
image: postgres:9.6-alpine
|
image: postgres:9.6-alpine
|
||||||
restart: unless-stopped
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
- env-roundcube
|
- env-roundcube
|
||||||
|
@ -44,15 +37,10 @@ services:
|
||||||
- rb_db:/var/lib/postgresql/data/
|
- rb_db:/var/lib/postgresql/data/
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
logging:
|
|
||||||
driver: "json-file"
|
|
||||||
options:
|
|
||||||
max-size: "5m"
|
|
||||||
max-file: "3"
|
|
||||||
|
|
||||||
roundcube:
|
roundcube:
|
||||||
image: roundcube/roundcubemail:1.6.x-apache
|
image: roundcube/roundcubemail:1.6.x-apache
|
||||||
restart: unless-stopped
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- mail
|
- mail
|
||||||
- roundcubedb
|
- roundcubedb
|
||||||
|
@ -64,11 +52,6 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
- internal
|
- internal
|
||||||
logging:
|
|
||||||
driver: "json-file"
|
|
||||||
options:
|
|
||||||
max-size: "10m"
|
|
||||||
max-file: "3"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
maildata:
|
maildata:
|
||||||
|
|
|
@ -12,7 +12,7 @@ DESIRED_CONFIG_PATH=
|
||||||
DIR=$(pwd)
|
DIR=$(pwd)
|
||||||
DMS_CONFIG='/tmp/docker-mailserver'
|
DMS_CONFIG='/tmp/docker-mailserver'
|
||||||
IMAGE_NAME=
|
IMAGE_NAME=
|
||||||
DEFAULT_IMAGE_NAME='ghcr.io/docker-mailserver/docker-mailserver:latest'
|
DEFAULT_IMAGE_NAME='docker.io/mailserver/docker-mailserver:latest'
|
||||||
INFO=
|
INFO=
|
||||||
PODMAN_ROOTLESS=false
|
PODMAN_ROOTLESS=false
|
||||||
USE_SELINUX=
|
USE_SELINUX=
|
||||||
|
@ -71,9 +71,11 @@ function _show_local_usage
|
||||||
|
|
||||||
function _get_absolute_script_directory
|
function _get_absolute_script_directory
|
||||||
{
|
{
|
||||||
if dirname "$(readlink -f "${0}")" &>/dev/null; then
|
if dirname "$(readlink -f "${0}")" &>/dev/null
|
||||||
|
then
|
||||||
DIR=$(dirname "$(readlink -f "${0}")")
|
DIR=$(dirname "$(readlink -f "${0}")")
|
||||||
elif realpath -e -L "${0}" &>/dev/null; then
|
elif realpath -e -L "${0}" &>/dev/null
|
||||||
|
then
|
||||||
DIR=$(realpath -e -L "${0}")
|
DIR=$(realpath -e -L "${0}")
|
||||||
DIR="${DIR%/setup.sh}"
|
DIR="${DIR%/setup.sh}"
|
||||||
fi
|
fi
|
||||||
|
@ -81,7 +83,8 @@ function _get_absolute_script_directory
|
||||||
|
|
||||||
function _set_default_config_path
|
function _set_default_config_path
|
||||||
{
|
{
|
||||||
if [[ -d "${DIR}/config" ]]; then
|
if [[ -d "${DIR}/config" ]]
|
||||||
|
then
|
||||||
# legacy path (pre v10.2.0)
|
# legacy path (pre v10.2.0)
|
||||||
DEFAULT_CONFIG_PATH="${DIR}/config"
|
DEFAULT_CONFIG_PATH="${DIR}/config"
|
||||||
else
|
else
|
||||||
|
@ -91,19 +94,23 @@ function _set_default_config_path
|
||||||
|
|
||||||
function _handle_config_path
|
function _handle_config_path
|
||||||
{
|
{
|
||||||
if [[ -z ${DESIRED_CONFIG_PATH} ]]; then
|
if [[ -z ${DESIRED_CONFIG_PATH} ]]
|
||||||
|
then
|
||||||
# no desired config path
|
# no desired config path
|
||||||
if [[ -n ${CONTAINER_NAME} ]]; then
|
if [[ -n ${CONTAINER_NAME} ]]
|
||||||
|
then
|
||||||
VOLUME=$(${CRI} inspect "${CONTAINER_NAME}" \
|
VOLUME=$(${CRI} inspect "${CONTAINER_NAME}" \
|
||||||
--format="{{range .Mounts}}{{ println .Source .Destination}}{{end}}" | \
|
--format="{{range .Mounts}}{{ println .Source .Destination}}{{end}}" | \
|
||||||
grep "${DMS_CONFIG}$" 2>/dev/null || :)
|
grep "${DMS_CONFIG}$" 2>/dev/null || :)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${VOLUME} ]]; then
|
if [[ -n ${VOLUME} ]]
|
||||||
|
then
|
||||||
CONFIG_PATH=$(echo "${VOLUME}" | awk '{print $1}')
|
CONFIG_PATH=$(echo "${VOLUME}" | awk '{print $1}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${CONFIG_PATH} ]]; then
|
if [[ -z ${CONFIG_PATH} ]]
|
||||||
|
then
|
||||||
CONFIG_PATH=${DEFAULT_CONFIG_PATH}
|
CONFIG_PATH=${DEFAULT_CONFIG_PATH}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -114,7 +121,8 @@ function _handle_config_path
|
||||||
function _run_in_new_container
|
function _run_in_new_container
|
||||||
{
|
{
|
||||||
# start temporary container with specified image
|
# start temporary container with specified image
|
||||||
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null; then
|
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null
|
||||||
|
then
|
||||||
echo "Image '${IMAGE_NAME}' not found. Pulling ..."
|
echo "Image '${IMAGE_NAME}' not found. Pulling ..."
|
||||||
${CRI} pull "${IMAGE_NAME}"
|
${CRI} pull "${IMAGE_NAME}"
|
||||||
fi
|
fi
|
||||||
|
@ -143,7 +151,8 @@ function _main
|
||||||
( * ) DESIRED_CONFIG_PATH="${DIR}/${OPTARG}" ;;
|
( * ) DESIRED_CONFIG_PATH="${DIR}/${OPTARG}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ ! -d ${DESIRED_CONFIG_PATH} ]]; then
|
if [[ ! -d ${DESIRED_CONFIG_PATH} ]]
|
||||||
|
then
|
||||||
echo "Specified directory '${DESIRED_CONFIG_PATH}' doesn't exist" >&2
|
echo "Specified directory '${DESIRED_CONFIG_PATH}' doesn't exist" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -160,11 +169,14 @@ function _main
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
if command -v docker &>/dev/null; then
|
if command -v docker &>/dev/null
|
||||||
|
then
|
||||||
CRI=docker
|
CRI=docker
|
||||||
elif command -v podman &>/dev/null; then
|
elif command -v podman &>/dev/null
|
||||||
|
then
|
||||||
CRI=podman
|
CRI=podman
|
||||||
if ! ${PODMAN_ROOTLESS} && [[ ${EUID} -ne 0 ]]; then
|
if ! ${PODMAN_ROOTLESS} && [[ ${EUID} -ne 0 ]]
|
||||||
|
then
|
||||||
read -r -p "You are running Podman in rootless mode. Continue? [Y/n] "
|
read -r -p "You are running Podman in rootless mode. Continue? [Y/n] "
|
||||||
[[ -n ${REPLY} ]] && [[ ${REPLY} =~ (n|N) ]] && exit 0
|
[[ -n ${REPLY} ]] && [[ ${REPLY} =~ (n|N) ]] && exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -178,11 +190,13 @@ function _main
|
||||||
|
|
||||||
[[ -z ${CONTAINER_NAME} ]] && CONTAINER_NAME=${INFO#*;}
|
[[ -z ${CONTAINER_NAME} ]] && CONTAINER_NAME=${INFO#*;}
|
||||||
[[ -z ${IMAGE_NAME} ]] && IMAGE_NAME=${INFO%;*}
|
[[ -z ${IMAGE_NAME} ]] && IMAGE_NAME=${INFO%;*}
|
||||||
if [[ -z ${IMAGE_NAME} ]]; then
|
if [[ -z ${IMAGE_NAME} ]]
|
||||||
|
then
|
||||||
IMAGE_NAME=${NAME:-${DEFAULT_IMAGE_NAME}}
|
IMAGE_NAME=${NAME:-${DEFAULT_IMAGE_NAME}}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -t 0; then
|
if test -t 0
|
||||||
|
then
|
||||||
USE_TTY="-it"
|
USE_TTY="-it"
|
||||||
else
|
else
|
||||||
# GitHub Actions will fail (or really anything else
|
# GitHub Actions will fail (or really anything else
|
||||||
|
@ -193,7 +207,8 @@ function _main
|
||||||
|
|
||||||
_handle_config_path
|
_handle_config_path
|
||||||
|
|
||||||
if [[ -n ${CONTAINER_NAME} ]]; then
|
if [[ -n ${CONTAINER_NAME} ]]
|
||||||
|
then
|
||||||
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" setup "${@}"
|
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" setup "${@}"
|
||||||
else
|
else
|
||||||
_run_in_new_container setup "${@}"
|
_run_in_new_container setup "${@}"
|
||||||
|
|
Loading…
Reference in New Issue