From 052407eb08aef6ab1f41c7a8491194d3080ec513 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:42:35 +0100 Subject: [PATCH 01/12] feat: set mysql hostname --- config/piler-default.yml | 2 +- config/piler-ssl.yml | 2 +- install-piler.sh | 14 ++++++++++++++ piler.conf.example | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config/piler-default.yml b/config/piler-default.yml index 5ba3420..90cc0f6 100644 --- a/config/piler-default.yml +++ b/config/piler-default.yml @@ -45,7 +45,7 @@ services: - MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_USER=${MYSQL_USER} - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_HOSTNAME=mysql + - MYSQL_HOSTNAME=${MYSQL_HOSTNAME} - PILER_HOSTNAME=${PILER_DOMAIN} - MEMCACHED_HOST=memcached - TZ=${TIME_ZONE} diff --git a/config/piler-ssl.yml b/config/piler-ssl.yml index 26fb30d..d0831b4 100644 --- a/config/piler-ssl.yml +++ b/config/piler-ssl.yml @@ -68,7 +68,7 @@ services: - MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_USER=${MYSQL_USER} - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_HOSTNAME=mysql + - MYSQL_HOSTNAME=${MYSQL_HOSTNAME} - PILER_HOSTNAME=${PILER_DOMAIN} - MEMCACHED_HOST=memcached - TZ=${TIME_ZONE} diff --git a/install-piler.sh b/install-piler.sh index 23f698d..aef2b88 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -148,6 +148,20 @@ if [ ! -f $installPth/.configDone ]; then timeZone="${timeZone////\\/}" sed -i 's/TIME_ZONE=.*/TIME_ZONE="'$timeZone'"/g' ./piler.conf + # MySql Hostname + read -ep "Please set your MySql Hostname (Enter for default: $MYSQL_HOSTNAME): " pilerDatabaseHostname + pilerDatabaseHostname=${pilerDatabaseHostname:=$MYSQL_HOSTNAME} + sed -i 's/MYSQL_HOSTNAME=.*/MYSQL_HOSTNAME="'$pilerDatabaseHostname'"/g' ./piler.conf + # Check if external database is used + if [[ ! "${pilerDatabaseHostname}" == "mysql" ]] + then + # User Info + printf "\n" + echo "You are using an external database." + echo "Be sure that the database exists and username/password are correct." + printf "\n" + fi + # MySql Database read -ep "Please set your MySql Database (Enter for default: $MYSQL_DATABASE): " pilerDataBase pilerDataBase=${pilerDataBase:=$MYSQL_DATABASE} diff --git a/piler.conf.example b/piler.conf.example index ae98437..870a8c1 100644 --- a/piler.conf.example +++ b/piler.conf.example @@ -30,6 +30,10 @@ SMARTHOST="127.0.0.1" MYSQL_DATABASE="piler" +# MySql Hostname + +MYSQL_DATABASE="mysql" + # MySql User MYSQL_USER="piler" From 06005603dd1949e45abdfcfaa92eefb871968055 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:56:46 +0100 Subject: [PATCH 02/12] fix: instruction --- install-piler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-piler.sh b/install-piler.sh index aef2b88..3da1ba1 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -149,7 +149,7 @@ if [ ! -f $installPth/.configDone ]; then sed -i 's/TIME_ZONE=.*/TIME_ZONE="'$timeZone'"/g' ./piler.conf # MySql Hostname - read -ep "Please set your MySql Hostname (Enter for default: $MYSQL_HOSTNAME): " pilerDatabaseHostname + read -ep "Please set your MySql Hostname (only if you use an external database) (Enter for default: $MYSQL_HOSTNAME): " pilerDatabaseHostname pilerDatabaseHostname=${pilerDatabaseHostname:=$MYSQL_HOSTNAME} sed -i 's/MYSQL_HOSTNAME=.*/MYSQL_HOSTNAME="'$pilerDatabaseHostname'"/g' ./piler.conf # Check if external database is used From bd8837ca281aae8abbea012a4acbad942dd93269 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:58:32 +0100 Subject: [PATCH 03/12] fix: variable name --- piler.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piler.conf.example b/piler.conf.example index 870a8c1..2091c45 100644 --- a/piler.conf.example +++ b/piler.conf.example @@ -32,7 +32,7 @@ MYSQL_DATABASE="piler" # MySql Hostname -MYSQL_DATABASE="mysql" +MYSQL_HOSTNAME="mysql" # MySql User From fbc037d49c2cd706ba02ee2aafdf5a4fc0dc03ce Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:28:57 +0100 Subject: [PATCH 04/12] perf: docker-compose files for custom mysql connection --- config/piler-default-no-mysql.yml | 60 ++++++++++++++++++++ config/piler-ssl-no-mysql.yml | 91 +++++++++++++++++++++++++++++++ install-piler.sh | 16 ++++-- update.sh | 18 ++++-- 4 files changed, 176 insertions(+), 9 deletions(-) create mode 100644 config/piler-default-no-mysql.yml create mode 100644 config/piler-ssl-no-mysql.yml diff --git a/config/piler-default-no-mysql.yml b/config/piler-default-no-mysql.yml new file mode 100644 index 0000000..f9a4126 --- /dev/null +++ b/config/piler-default-no-mysql.yml @@ -0,0 +1,60 @@ +version: "3" +services: + memcached: + image: memcached:latest + container_name: memcached_piler + restart: unless-stopped + cap_drop: + - ALL + command: -m 64 + + piler: + image: simatec/piler:${PILER_VERSION} + container_name: piler + restart: unless-stopped + hostname: ${PILER_DOMAIN} + init: true + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_HOSTNAME=${MYSQL_HOSTNAME} + - PILER_HOSTNAME=${PILER_DOMAIN} + - MEMCACHED_HOST=memcached + - TZ=${TIME_ZONE} + ports: + - "25:25" + - "80:80" + - "443:443" + volumes: + - piler_etc:/etc/piler + - piler_var_store:/var/piler/store + - piler_var_manticore:/var/piler/manticore + - piler_var_imap:/var/piler/imap + - piler_var_stat:/var/piler/stat + - piler_cron:/var/spool/cron/crontabs + - /etc/localtime:/etc/localtime:ro + healthcheck: + test: curl -s smtp://localhost/ + interval: "60s" + timeout: "3s" + start_period: "15s" + retries: 3 + deploy: + resources: + reservations: + memory: 512M + limits: + memory: 512M + + depends_on: + - "memcached" + - "mysql" + +volumes: + piler_etc: + piler_var_store: + piler_var_manticore: + piler_var_imap: + piler_var_stat: + piler_cron: diff --git a/config/piler-ssl-no-mysql.yml b/config/piler-ssl-no-mysql.yml new file mode 100644 index 0000000..3ffea10 --- /dev/null +++ b/config/piler-ssl-no-mysql.yml @@ -0,0 +1,91 @@ +version: "3" +services: + nginx-proxy: + image: jwilder/nginx-proxy + container_name: nginx-proxy + restart: always + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx-data/certs:/etc/nginx/certs + - ./nginx-data/vhost.d:/etc/nginx/vhost.d + - ./nginx-data/html:/usr/share/nginx/html + - /var/run/docker.sock:/tmp/docker.sock:ro + nginx-letsencrypt: + image: jrcs/letsencrypt-nginx-proxy-companion + container_name: nginx-letsencrypt + restart: always + volumes_from: + - nginx-proxy + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - DEFAULT_EMAIL=${LETSENCRYPT_EMAIL} + + memcached: + image: memcached:latest + container_name: memcached-piler + restart: unless-stopped + cap_drop: + - ALL + command: -m 64 + + piler: + image: simatec/piler:${PILER_VERSION} + container_name: piler + restart: unless-stopped + expose: + - "80" + hostname: ${PILER_DOMAIN} + init: true + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_HOSTNAME=${MYSQL_HOSTNAME} + - PILER_HOSTNAME=${PILER_DOMAIN} + - MEMCACHED_HOST=memcached + - TZ=${TIME_ZONE} + - VIRTUAL_HOST=${PILER_DOMAIN} + - LETSENCRYPT_HOST=${PILER_DOMAIN} + - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} + ports: + - "25:25" + volumes: + - piler_etc:/etc/piler + - piler_var_store:/var/piler/store + - piler_var_manticore:/var/piler/manticore + - piler_var_imap:/var/piler/imap + - piler_var_stat:/var/piler/stat + - piler_cron:/var/spool/cron/crontabs + - /etc/localtime:/etc/localtime:ro + healthcheck: + test: curl -s smtp://localhost/ + interval: "60s" + timeout: "3s" + start_period: "15s" + retries: 3 + deploy: + resources: + reservations: + memory: 512M + limits: + memory: 512M + + depends_on: + - "memcached" + - "mysql" + +networks: + default: + external: + name: nginx-proxy + +volumes: + piler_etc: + piler_var_store: + piler_var_manticore: + piler_var_imap: + piler_var_stat: + piler_cron: diff --git a/install-piler.sh b/install-piler.sh index 3da1ba1..38814b0 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -311,10 +311,18 @@ if [ -f $installPth/docker-compose.yml ]; then rm $installPth/docker-compose.yml fi -if [ "$USE_LETSENCRYPT" = "yes" ]; then - cp $configPth/piler-ssl.yml $installPth/docker-compose.yml -else - cp $configPth/piler-default.yml $installPth/docker-compose.yml +if [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-ssl.yml" "${installPth}/docker-compose.yml" +elif [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-ssl-no-mysql.yml" "${installPth}/docker-compose.yml" +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-default.yml" "${installPth}/docker-compose.yml" +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-default-no-mysql.yml" "${installPth}/docker-compose.yml" fi # old docker stop diff --git a/update.sh b/update.sh index d001669..15a5620 100644 --- a/update.sh +++ b/update.sh @@ -122,7 +122,7 @@ echo "${greenBold}${HLINE}${normal}" echo # Update Files -for ymlUpdate in piler-default.yml piler-ssl.yml; do +for ymlUpdate in piler-default.yml piler-default-no-mysql.yml piler-ssl.yml piler-ssl-no-mysql.yml; do echo echo "${purple}${HLINE}${HLINE_SMALL}" echo "${purple}****** Download Update $ymlUpdate ******" @@ -199,10 +199,18 @@ fi #echo "${greenBold}Piler-Build finish${normal}" # Copy docker-compose.yml -if [ "$USE_LETSENCRYPT" = "yes" ]; then - cp $configPth/piler-ssl.yml $installPth/docker-compose.yml -else - cp $configPth/piler-default.yml $installPth/docker-compose.yml +if [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-ssl.yml" "${installPth}/docker-compose.yml" +elif [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-ssl-no-mysql.yml" "${installPth}/docker-compose.yml" +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-default.yml" "${installPth}/docker-compose.yml" +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +then + cp "${configPth}/piler-default-no-mysql.yml" "${installPth}/docker-compose.yml" fi # start Update Container From ca17c80f732b312d35f2a81e69e7c2e6b14605be Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:31:10 +0100 Subject: [PATCH 05/12] fix: depends_on for no mysql --- config/piler-default-no-mysql.yml | 1 - config/piler-ssl-no-mysql.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/config/piler-default-no-mysql.yml b/config/piler-default-no-mysql.yml index f9a4126..f87825f 100644 --- a/config/piler-default-no-mysql.yml +++ b/config/piler-default-no-mysql.yml @@ -49,7 +49,6 @@ services: depends_on: - "memcached" - - "mysql" volumes: piler_etc: diff --git a/config/piler-ssl-no-mysql.yml b/config/piler-ssl-no-mysql.yml index 3ffea10..fd90d07 100644 --- a/config/piler-ssl-no-mysql.yml +++ b/config/piler-ssl-no-mysql.yml @@ -75,7 +75,6 @@ services: depends_on: - "memcached" - - "mysql" networks: default: From 2e7212ad4008bba9d790fcd08032f87c45eb798b Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:43:59 +0100 Subject: [PATCH 06/12] feat: set custom stmp/http/https ports --- config/piler-default-no-mysql.yml | 6 +++--- config/piler-default.yml | 6 +++--- config/piler-ssl-no-mysql.yml | 6 +++--- config/piler-ssl.yml | 6 +++--- install-piler.sh | 36 +++++++++++++++++++++++-------- piler.conf.example | 14 ++++++++++++ 6 files changed, 53 insertions(+), 21 deletions(-) diff --git a/config/piler-default-no-mysql.yml b/config/piler-default-no-mysql.yml index f87825f..28b8729 100644 --- a/config/piler-default-no-mysql.yml +++ b/config/piler-default-no-mysql.yml @@ -23,9 +23,9 @@ services: - MEMCACHED_HOST=memcached - TZ=${TIME_ZONE} ports: - - "25:25" - - "80:80" - - "443:443" + - "${SMTP_PORT}:25" + - "${HTTP_PORT}:80" + - "${HTTPS_PORT}:443" volumes: - piler_etc:/etc/piler - piler_var_store:/var/piler/store diff --git a/config/piler-default.yml b/config/piler-default.yml index 90cc0f6..ad107fd 100644 --- a/config/piler-default.yml +++ b/config/piler-default.yml @@ -50,9 +50,9 @@ services: - MEMCACHED_HOST=memcached - TZ=${TIME_ZONE} ports: - - "25:25" - - "80:80" - - "443:443" + - "${SMTP_PORT}:25" + - "${HTTP_PORT}:80" + - "${HTTPS_PORT}:443" volumes: - piler_etc:/etc/piler - piler_var_store:/var/piler/store diff --git a/config/piler-ssl-no-mysql.yml b/config/piler-ssl-no-mysql.yml index fd90d07..87a9625 100644 --- a/config/piler-ssl-no-mysql.yml +++ b/config/piler-ssl-no-mysql.yml @@ -5,8 +5,8 @@ services: container_name: nginx-proxy restart: always ports: - - "80:80" - - "443:443" + - "${HTTP_PORT}:80" + - "${HTTPS_PORT}:443" volumes: - ./nginx-data/certs:/etc/nginx/certs - ./nginx-data/vhost.d:/etc/nginx/vhost.d @@ -51,7 +51,7 @@ services: - LETSENCRYPT_HOST=${PILER_DOMAIN} - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} ports: - - "25:25" + - "${SMTP_PORT}:25" volumes: - piler_etc:/etc/piler - piler_var_store:/var/piler/store diff --git a/config/piler-ssl.yml b/config/piler-ssl.yml index d0831b4..b7f2444 100644 --- a/config/piler-ssl.yml +++ b/config/piler-ssl.yml @@ -5,8 +5,8 @@ services: container_name: nginx-proxy restart: always ports: - - "80:80" - - "443:443" + - "${HTTP_PORT}:80" + - "${HTTPS_PORT}:443" volumes: - ./nginx-data/certs:/etc/nginx/certs - ./nginx-data/vhost.d:/etc/nginx/vhost.d @@ -76,7 +76,7 @@ services: - LETSENCRYPT_HOST=${PILER_DOMAIN} - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} ports: - - "25:25" + - "${SMTP_PORT}:25" volumes: - piler_etc:/etc/piler - piler_var_store:/var/piler/store diff --git a/install-piler.sh b/install-piler.sh index 38814b0..80665d8 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -178,6 +178,21 @@ if [ ! -f $installPth/.configDone ]; then sed -i 's/MYSQL_PASSWORD=.*/MYSQL_PASSWORD="'$pilerPassword'"/g' ./piler.conf echo + # SMTP Port + read -ep "Please set your SMTP Port (Enter for default: $SMTP_PORT): " pilerSmtpPort + pilerSmtpPort=${pilerSmtpPort:=$SMTP_PORT} + sed -i 's/SMTP_PORT=.*/SMTP_PORT="'$pilerSmtpPort'"/g' ./piler.conf + + # HTTP Port + read -ep "Please set your HTTP Port (Enter for default: $HTTP_PORT): " pilerHttpPort + pilerHttpPort=${pilerHttpPort:=$HTTP_PORT} + sed -i 's/HTTP_PORT=.*/HTTP_PORT="'$pilerHttpPort'"/g' ./piler.conf + + # HTTPS Port + read -ep "Please set your HTTPS Port (Enter for default: $HTTPS_PORT): " pilerHttpsPort + pilerHttpsPort=${pilerHttpsPort:=$HTTPS_PORT} + sed -i 's/HTTPS_PORT=.*/HTTPS_PORT="'$pilerHttpsPort'"/g' ./piler.conf + # use Let's Encrypt while true; do read -ep "Enabled / Disabled (yes/no) Let's Encrypt? For local Run disabled / Y|N: " jn @@ -272,15 +287,18 @@ elif [ -f $installPth/.configDone ]; then done fi -# uninstall Postfix -while true; do - read -ep "Postfix must be uninstalled prior to installation. Do you want to uninstall Postfix now? (y/n): " yn - case $yn in - [Yy]* ) apt purge postfix -y; break;; - [Nn]* ) echo -e "${redBold} The installation process is aborted because Postfix has not been uninstalled.!! ${normal}"; exit;; - * ) echo -e "${redBold} Please confirm with y or n.${normal}";; - esac -done +# uninstall Postfix, if SMTP_PORT is 25 +if [[ "${SMTP_PORT}" -eq 25 ]] +then + while true; do + read -ep "Postfix must be uninstalled prior to installation. Do you want to uninstall Postfix now? (y/n): " yn + case $yn in + [Yy]* ) apt purge postfix -y; break;; + [Nn]* ) echo -e "${redBold} The installation process is aborted because Postfix has not been uninstalled.!! ${normal}"; exit;; + * ) echo -e "${redBold} Please confirm with y or n.${normal}";; + esac + done +fi # start piler install while true; do diff --git a/piler.conf.example b/piler.conf.example index 2091c45..c6409bf 100644 --- a/piler.conf.example +++ b/piler.conf.example @@ -42,6 +42,20 @@ MYSQL_USER="piler" MYSQL_PASSWORD="" +# ------------ Port Settings ------------- + +# SMTP Port + +SMTP_PORT="25" + +# HTTP Port + +HTTP_PORT="80" + +# HTTPS Port + +HTTPS_PORT="443" + # ------- Let's Encrypt Settings ---------- # Enabled / Disabled (yes/no) Let's Encrypt From 56fb378e441df62739fe887407ad11c42eb00857 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:40:05 +0100 Subject: [PATCH 07/12] feat: custom docker volumes path --- install-piler.sh | 15 +++++++++++---- piler.conf.example | 4 ++++ update.sh | 5 ++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/install-piler.sh b/install-piler.sh index 80665d8..133af0b 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -94,13 +94,10 @@ else exit 1 fi -####################################################################################### +################################ Path-Settings ######################################### -# Path-Settings installPth=`pwd` configPth="$installPth/config" -etcPth="/var/lib/docker/volumes/piler-docker_piler_etc/_data" -cronPth="/var/lib/docker/volumes/piler-docker_piler_cron/_data" buildPth="$installPth/build" ############################## Installer Settings ###################################### @@ -137,6 +134,11 @@ if [ ! -f $installPth/.configDone ]; then pilerSmartHost=${pilerSmartHost:=$SMARTHOST} sed -i 's/SMARTHOST=.*/SMARTHOST="'$pilerSmartHost'"/g' ./piler.conf + # Docker Volumes Path + read -ep "Please set your Docker Volumes Path (Enter for default: $DOCKER_VOLUMES_PATH): " pilerDockerVolumesPath + pilerDockerVolumesPath=${pilerDockerVolumesPath:=$DOCKER_VOLUMES_PATH} + sed -i 's/DOCKER_VOLUMES_PATH=.*/DOCKER_VOLUMES_PATH="'$pilerDockerVolumesPath'"/g' ./piler.conf + # IMAP Server read -ep "Please set your IMAP Server (Enter for default: $IMAP_SERVER): " imapServer imapServer=${imapServer:=$IMAP_SERVER} @@ -310,6 +312,11 @@ while true; do esac done +################################ Path-Settings ######################################### + +etcPth="${DOCKER_VOLUMES_PATH}/piler-docker_piler_etc/_data" +cronPth="${DOCKER_VOLUMES_PATH}/piler-docker_piler_cron/_data" + ######################################################################################### # reload config diff --git a/piler.conf.example b/piler.conf.example index c6409bf..35d557d 100644 --- a/piler.conf.example +++ b/piler.conf.example @@ -24,6 +24,10 @@ TIME_ZONE="Europe/Berlin" SMARTHOST="127.0.0.1" +# Docker Volumes Path + +DOCKER_VOLUMES_PATH="/var/lib/docker/volumes" + # ------------ MySql Settings ------------- # MySql Database diff --git a/update.sh b/update.sh index 15a5620..e631071 100644 --- a/update.sh +++ b/update.sh @@ -105,9 +105,12 @@ while true; do esac done +# config load +. ./piler.conf + installPth=`pwd` configPth="$installPth/config" -etcPth="/var/lib/docker/volumes/piler-docker_piler_etc/_data" +etcPth="${DOCKER_VOLUMES_PATH}/piler-docker_piler_etc/_data" buildPth="$installPth/build" if [ -f $installPth/docker-compose.yml ]; then From f6f29d7c6b12ee91cb14e3bb2a226712d970c879 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:58:06 +0100 Subject: [PATCH 08/12] fix: sed command for docker volumes --- install-piler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-piler.sh b/install-piler.sh index 133af0b..7317751 100644 --- a/install-piler.sh +++ b/install-piler.sh @@ -137,7 +137,7 @@ if [ ! -f $installPth/.configDone ]; then # Docker Volumes Path read -ep "Please set your Docker Volumes Path (Enter for default: $DOCKER_VOLUMES_PATH): " pilerDockerVolumesPath pilerDockerVolumesPath=${pilerDockerVolumesPath:=$DOCKER_VOLUMES_PATH} - sed -i 's/DOCKER_VOLUMES_PATH=.*/DOCKER_VOLUMES_PATH="'$pilerDockerVolumesPath'"/g' ./piler.conf + sed -i 's#DOCKER_VOLUMES_PATH=.*#DOCKER_VOLUMES_PATH=\"'$pilerDockerVolumesPath'\"#g' ./piler.conf # IMAP Server read -ep "Please set your IMAP Server (Enter for default: $IMAP_SERVER): " imapServer From 1a6d37863fa8f6a15fe8e8e554f5eed62f73b1d8 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:56:25 +0100 Subject: [PATCH 09/12] feat: database table structure --- examples/piler.sql | 1232 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1232 insertions(+) create mode 100644 examples/piler.sql diff --git a/examples/piler.sql b/examples/piler.sql new file mode 100644 index 0000000..a61b4d0 --- /dev/null +++ b/examples/piler.sql @@ -0,0 +1,1232 @@ +-- MariaDB dump 10.19 Distrib 10.6.17-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: mailpiler +-- ------------------------------------------------------ +-- Server version 10.6.17-MariaDB-1:10.6.17+maria~ubu2004 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `archiving_rule` +-- + +DROP TABLE IF EXISTS `archiving_rule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `archiving_rule` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(128) DEFAULT NULL, + `from` varchar(128) DEFAULT NULL, + `to` varchar(128) DEFAULT NULL, + `subject` varchar(128) DEFAULT NULL, + `body` varchar(128) DEFAULT NULL, + `_size` char(2) DEFAULT NULL, + `size` int(11) DEFAULT 0, + `attachment_name` varchar(128) DEFAULT NULL, + `attachment_type` varchar(64) DEFAULT NULL, + `_attachment_size` char(2) DEFAULT NULL, + `attachment_size` int(11) DEFAULT 0, + `spam` tinyint(1) DEFAULT -1, + `days` int(11) DEFAULT 0, + `folder_id` int(11) DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `from` (`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `archiving_rule` +-- + +LOCK TABLES `archiving_rule` WRITE; +/*!40000 ALTER TABLE `archiving_rule` DISABLE KEYS */; +/*!40000 ALTER TABLE `archiving_rule` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `attachment` +-- + +DROP TABLE IF EXISTS `attachment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `attachment` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `piler_id` char(36) NOT NULL, + `attachment_id` int(11) NOT NULL, + `name` tinyblob DEFAULT NULL, + `type` varchar(128) DEFAULT NULL, + `sig` char(64) NOT NULL, + `size` int(11) DEFAULT 0, + `ptr` bigint(20) unsigned DEFAULT 0, + `deleted` tinyint(1) DEFAULT 0, + PRIMARY KEY (`id`), + KEY `attachment_idx` (`piler_id`), + KEY `attachment_idx2` (`sig`,`size`,`ptr`), + KEY `attachment_idx3` (`ptr`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `attachment` +-- + +LOCK TABLES `attachment` WRITE; +/*!40000 ALTER TABLE `attachment` DISABLE KEYS */; +/*!40000 ALTER TABLE `attachment` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `audit` +-- + +DROP TABLE IF EXISTS `audit`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `audit` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `ts` int(11) NOT NULL, + `email` varchar(128) NOT NULL, + `domain` varchar(128) NOT NULL, + `action` int(11) NOT NULL, + `ipaddr` varchar(39) NOT NULL, + `meta_id` bigint(20) unsigned NOT NULL, + `description` varchar(255) DEFAULT NULL, + `vcode` char(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `audit_idx` (`email`), + KEY `audit_idx2` (`action`), + KEY `audit_idx3` (`ipaddr`), + KEY `audit_idx4` (`ts`), + KEY `audit_idx5` (`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `audit` +-- + +LOCK TABLES `audit` WRITE; +/*!40000 ALTER TABLE `audit` DISABLE KEYS */; +/*!40000 ALTER TABLE `audit` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `autosearch` +-- + +DROP TABLE IF EXISTS `autosearch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `autosearch` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `query` varchar(512) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `autosearch` +-- + +LOCK TABLES `autosearch` WRITE; +/*!40000 ALTER TABLE `autosearch` DISABLE KEYS */; +/*!40000 ALTER TABLE `autosearch` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `counter` +-- + +DROP TABLE IF EXISTS `counter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `counter` ( + `rcvd` bigint(20) unsigned DEFAULT 0, + `virus` bigint(20) unsigned DEFAULT 0, + `duplicate` bigint(20) unsigned DEFAULT 0, + `ignore` bigint(20) unsigned DEFAULT 0, + `size` bigint(20) unsigned DEFAULT 0, + `stored_size` bigint(20) unsigned DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `counter` +-- + +LOCK TABLES `counter` WRITE; +/*!40000 ALTER TABLE `counter` DISABLE KEYS */; +INSERT INTO `counter` VALUES (0,0,0,0,0,0); +/*!40000 ALTER TABLE `counter` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `counter_stats` +-- + +DROP TABLE IF EXISTS `counter_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `counter_stats` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` int(11) NOT NULL, + `email` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `sent` int(11) NOT NULL, + `recd` int(11) NOT NULL, + `sentsize` int(11) NOT NULL, + `recdsize` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `date` (`date`), + KEY `email` (`email`), + KEY `domain` (`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `counter_stats` +-- + +LOCK TABLES `counter_stats` WRITE; +/*!40000 ALTER TABLE `counter_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `counter_stats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `customer_settings` +-- + +DROP TABLE IF EXISTS `customer_settings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customer_settings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `domain` varchar(128) NOT NULL, + `branding_text` varchar(255) DEFAULT NULL, + `branding_url` varchar(255) DEFAULT NULL, + `branding_logo` varchar(255) DEFAULT NULL, + `support_link` varchar(255) DEFAULT NULL, + `background_colour` varchar(255) DEFAULT NULL, + `text_colour` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain` (`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customer_settings` +-- + +LOCK TABLES `customer_settings` WRITE; +/*!40000 ALTER TABLE `customer_settings` DISABLE KEYS */; +/*!40000 ALTER TABLE `customer_settings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `deleted` +-- + +DROP TABLE IF EXISTS `deleted`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deleted` ( + `id` bigint(20) unsigned NOT NULL, + `requestor` varchar(128) NOT NULL, + `reason1` varchar(128) NOT NULL, + `date1` int(10) unsigned DEFAULT 0, + `approver` varchar(128) DEFAULT NULL, + `reason2` varchar(128) DEFAULT NULL, + `date2` int(10) unsigned DEFAULT 0, + `deleted` tinyint(1) DEFAULT -1, + UNIQUE KEY `id` (`id`), + KEY `id_2` (`id`), + KEY `deleted` (`deleted`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `deleted` +-- + +LOCK TABLES `deleted` WRITE; +/*!40000 ALTER TABLE `deleted` DISABLE KEYS */; +/*!40000 ALTER TABLE `deleted` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `domain` +-- + +DROP TABLE IF EXISTS `domain`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `domain` ( + `domain` char(64) NOT NULL, + `mapped` char(64) NOT NULL, + `ldap_id` int(11) DEFAULT 0, + PRIMARY KEY (`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `domain` +-- + +LOCK TABLES `domain` WRITE; +/*!40000 ALTER TABLE `domain` DISABLE KEYS */; +INSERT INTO `domain` VALUES ('local','local',0); +/*!40000 ALTER TABLE `domain` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `domain_user` +-- + +DROP TABLE IF EXISTS `domain_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `domain_user` ( + `domain` char(64) NOT NULL, + `uid` int(10) unsigned NOT NULL, + KEY `domain_user_idx` (`domain`), + KEY `domain_user_idx2` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `domain_user` +-- + +LOCK TABLES `domain_user` WRITE; +/*!40000 ALTER TABLE `domain_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `domain_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `email` +-- + +DROP TABLE IF EXISTS `email`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `email` ( + `uid` int(10) unsigned NOT NULL, + `email` char(128) NOT NULL, + PRIMARY KEY (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `email` +-- + +LOCK TABLES `email` WRITE; +/*!40000 ALTER TABLE `email` DISABLE KEYS */; +INSERT INTO `email` VALUES (0,'admin@local'),(1,'auditor@local'); +/*!40000 ALTER TABLE `email` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `email_groups` +-- + +DROP TABLE IF EXISTS `email_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `email_groups` ( + `uid` int(10) unsigned NOT NULL, + `gid` int(10) unsigned NOT NULL, + UNIQUE KEY `uid` (`uid`,`gid`), + KEY `email_groups_idx` (`uid`,`gid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `email_groups` +-- + +LOCK TABLES `email_groups` WRITE; +/*!40000 ALTER TABLE `email_groups` DISABLE KEYS */; +/*!40000 ALTER TABLE `email_groups` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `folder` +-- + +DROP TABLE IF EXISTS `folder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `parent_id` int(11) DEFAULT 0, + `name` char(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `parent_id` (`parent_id`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `folder` +-- + +LOCK TABLES `folder` WRITE; +/*!40000 ALTER TABLE `folder` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `folder_extra` +-- + +DROP TABLE IF EXISTS `folder_extra`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folder_extra` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uid` int(10) unsigned NOT NULL, + `name` char(64) NOT NULL, + UNIQUE KEY `uid` (`uid`,`name`), + KEY `id` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `folder_extra` +-- + +LOCK TABLES `folder_extra` WRITE; +/*!40000 ALTER TABLE `folder_extra` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder_extra` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `folder_message` +-- + +DROP TABLE IF EXISTS `folder_message`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folder_message` ( + `folder_id` bigint(20) NOT NULL, + `id` bigint(20) NOT NULL, + UNIQUE KEY `folder_id` (`folder_id`,`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `folder_message` +-- + +LOCK TABLES `folder_message` WRITE; +/*!40000 ALTER TABLE `folder_message` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder_message` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `folder_rule` +-- + +DROP TABLE IF EXISTS `folder_rule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folder_rule` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(100) DEFAULT NULL, + `from` varchar(100) DEFAULT NULL, + `to` varchar(100) DEFAULT NULL, + `subject` varchar(128) DEFAULT NULL, + `body` varchar(128) DEFAULT NULL, + `_size` char(2) DEFAULT NULL, + `size` int(11) DEFAULT 0, + `attachment_name` varchar(128) DEFAULT NULL, + `attachment_type` varchar(64) DEFAULT NULL, + `_attachment_size` char(2) DEFAULT NULL, + `attachment_size` int(11) DEFAULT 0, + `spam` tinyint(1) DEFAULT -1, + `days` int(11) DEFAULT 0, + `folder_id` int(11) DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `domain` (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `folder_rule` +-- + +LOCK TABLES `folder_rule` WRITE; +/*!40000 ALTER TABLE `folder_rule` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder_rule` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `folder_user` +-- + +DROP TABLE IF EXISTS `folder_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folder_user` ( + `id` bigint(20) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL, + KEY `folder_user_idx` (`id`), + KEY `folder_user_idx2` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `folder_user` +-- + +LOCK TABLES `folder_user` WRITE; +/*!40000 ALTER TABLE `folder_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `google` +-- + +DROP TABLE IF EXISTS `google`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `google` ( + `id` char(32) NOT NULL, + `email` char(128) NOT NULL, + `access_token` char(255) DEFAULT NULL, + `refresh_token` char(255) DEFAULT NULL, + `created` int(11) DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `google` +-- + +LOCK TABLES `google` WRITE; +/*!40000 ALTER TABLE `google` DISABLE KEYS */; +/*!40000 ALTER TABLE `google` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `google_imap` +-- + +DROP TABLE IF EXISTS `google_imap`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `google_imap` ( + `id` char(32) NOT NULL, + `email` char(128) NOT NULL, + `last_msg_id` bigint(20) DEFAULT 0, + PRIMARY KEY (`id`), + KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `google_imap` +-- + +LOCK TABLES `google_imap` WRITE; +/*!40000 ALTER TABLE `google_imap` DISABLE KEYS */; +/*!40000 ALTER TABLE `google_imap` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `group_email` +-- + +DROP TABLE IF EXISTS `group_email`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_email` ( + `id` bigint(20) unsigned NOT NULL, + `email` char(128) NOT NULL, + KEY `group_email_idx` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_email` +-- + +LOCK TABLES `group_email` WRITE; +/*!40000 ALTER TABLE `group_email` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_email` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `group_user` +-- + +DROP TABLE IF EXISTS `group_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_user` ( + `id` bigint(20) unsigned NOT NULL, + `email` char(128) NOT NULL, + KEY `group_user_idx` (`id`), + KEY `group_user_idx2` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_user` +-- + +LOCK TABLES `group_user` WRITE; +/*!40000 ALTER TABLE `group_user` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `import` +-- + +DROP TABLE IF EXISTS `import`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `import` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` varchar(255) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `server` varchar(255) NOT NULL, + `created` int(11) DEFAULT 0, + `started` int(11) DEFAULT 0, + `finished` int(11) DEFAULT 0, + `updated` int(11) DEFAULT 0, + `status` int(11) DEFAULT 0, + `total` int(11) DEFAULT 0, + `imported` int(11) DEFAULT 0, + `duplicate` int(11) DEFAULT 0, + `error` int(11) DEFAULT 0, + `cleared` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `import` +-- + +LOCK TABLES `import` WRITE; +/*!40000 ALTER TABLE `import` DISABLE KEYS */; +/*!40000 ALTER TABLE `import` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ldap` +-- + +DROP TABLE IF EXISTS `ldap`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ldap` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) NOT NULL, + `ldap_type` varchar(255) NOT NULL, + `ldap_host` varchar(255) NOT NULL, + `ldap_base_dn` varchar(255) NOT NULL, + `ldap_bind_dn` varchar(255) NOT NULL, + `ldap_bind_pw` varchar(255) NOT NULL, + `ldap_auditor_member_dn` varchar(255) DEFAULT NULL, + `ldap_mail_attr` varchar(128) DEFAULT NULL, + `ldap_account_objectclass` varchar(128) DEFAULT NULL, + `ldap_distributionlist_attr` varchar(128) DEFAULT NULL, + `ldap_distributionlist_objectclass` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `ldap` +-- + +LOCK TABLES `ldap` WRITE; +/*!40000 ALTER TABLE `ldap` DISABLE KEYS */; +/*!40000 ALTER TABLE `ldap` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `legal_hold` +-- + +DROP TABLE IF EXISTS `legal_hold`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `legal_hold` ( + `email` varchar(128) NOT NULL, + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `legal_hold` +-- + +LOCK TABLES `legal_hold` WRITE; +/*!40000 ALTER TABLE `legal_hold` DISABLE KEYS */; +/*!40000 ALTER TABLE `legal_hold` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `metadata` +-- + +DROP TABLE IF EXISTS `metadata`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `metadata` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `from` varchar(255) NOT NULL, + `fromdomain` varchar(255) NOT NULL, + `subject` blob DEFAULT NULL, + `spam` tinyint(1) DEFAULT 0, + `arrived` int(10) unsigned NOT NULL, + `sent` int(10) unsigned NOT NULL, + `retained` int(10) unsigned NOT NULL, + `deleted` tinyint(1) DEFAULT 0, + `size` int(11) DEFAULT 0, + `hlen` int(11) DEFAULT 0, + `direction` int(11) DEFAULT 0, + `attachments` int(11) DEFAULT 0, + `piler_id` char(36) NOT NULL, + `message_id` varchar(255) NOT NULL, + `reference` char(64) NOT NULL, + `digest` char(64) NOT NULL, + `bodydigest` char(64) NOT NULL, + `vcode` char(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `metadata_idx` (`piler_id`), + KEY `metadata_idx2` (`message_id`), + KEY `metadata_idx3` (`reference`), + KEY `metadata_idx4` (`bodydigest`), + KEY `metadata_idx5` (`deleted`), + KEY `metadata_idx6` (`arrived`), + KEY `metadata_idx7` (`retained`), + KEY `metadata_idx8` (`fromdomain`), + KEY `metadata_idx9` (`from`), + KEY `metadata_idx10` (`sent`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `metadata` +-- + +LOCK TABLES `metadata` WRITE; +/*!40000 ALTER TABLE `metadata` DISABLE KEYS */; +/*!40000 ALTER TABLE `metadata` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `note` +-- + +DROP TABLE IF EXISTS `note`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `note` ( + `_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `id` bigint(20) unsigned NOT NULL, + `uid` int(11) NOT NULL, + `note` text DEFAULT NULL, + UNIQUE KEY `id` (`id`,`uid`), + KEY `_id` (`_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `note` +-- + +LOCK TABLES `note` WRITE; +/*!40000 ALTER TABLE `note` DISABLE KEYS */; +/*!40000 ALTER TABLE `note` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `online` +-- + +DROP TABLE IF EXISTS `online`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `online` ( + `username` varchar(128) NOT NULL, + `ts` int(11) DEFAULT 0, + `last_activity` int(11) DEFAULT 0, + `ipaddr` varchar(64) DEFAULT NULL, + UNIQUE KEY `username` (`username`,`ipaddr`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `online` +-- + +LOCK TABLES `online` WRITE; +/*!40000 ALTER TABLE `online` DISABLE KEYS */; +/*!40000 ALTER TABLE `online` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `option` +-- + +DROP TABLE IF EXISTS `option`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `option` ( + `key` char(64) NOT NULL, + `value` char(32) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `option` +-- + +LOCK TABLES `option` WRITE; +/*!40000 ALTER TABLE `option` DISABLE KEYS */; +INSERT INTO `option` VALUES ('enable_purge','1'); +/*!40000 ALTER TABLE `option` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `private` +-- + +DROP TABLE IF EXISTS `private`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `private` ( + `id` bigint(20) unsigned NOT NULL, + UNIQUE KEY `id` (`id`), + KEY `id_2` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `private` +-- + +LOCK TABLES `private` WRITE; +/*!40000 ALTER TABLE `private` DISABLE KEYS */; +/*!40000 ALTER TABLE `private` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `rcpt` +-- + +DROP TABLE IF EXISTS `rcpt`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rcpt` ( + `id` bigint(20) unsigned NOT NULL, + `to` varchar(128) NOT NULL, + `todomain` varchar(128) NOT NULL, + UNIQUE KEY `id` (`id`,`to`), + KEY `rcpt_idx` (`id`), + KEY `rcpt_idx2` (`to`), + KEY `rcpt_idx3` (`todomain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `rcpt` +-- + +LOCK TABLES `rcpt` WRITE; +/*!40000 ALTER TABLE `rcpt` DISABLE KEYS */; +/*!40000 ALTER TABLE `rcpt` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `remote` +-- + +DROP TABLE IF EXISTS `remote`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `remote` ( + `remotedomain` char(64) NOT NULL, + `remotehost` char(64) NOT NULL, + `basedn` char(255) NOT NULL, + `binddn` char(255) NOT NULL, + `sitedescription` char(64) DEFAULT NULL, + PRIMARY KEY (`remotedomain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `remote` +-- + +LOCK TABLES `remote` WRITE; +/*!40000 ALTER TABLE `remote` DISABLE KEYS */; +/*!40000 ALTER TABLE `remote` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `retention_rule` +-- + +DROP TABLE IF EXISTS `retention_rule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `retention_rule` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(100) DEFAULT NULL, + `from` varchar(100) DEFAULT NULL, + `to` varchar(100) DEFAULT NULL, + `subject` varchar(128) DEFAULT NULL, + `body` varchar(128) DEFAULT NULL, + `_size` char(2) DEFAULT NULL, + `size` int(11) DEFAULT 0, + `attachment_name` varchar(100) DEFAULT NULL, + `attachment_type` varchar(64) DEFAULT NULL, + `_attachment_size` char(2) DEFAULT NULL, + `attachment_size` int(11) DEFAULT 0, + `spam` tinyint(1) DEFAULT -1, + `days` int(11) DEFAULT 0, + `folder_id` int(11) DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `domain` (`domain`,`from`,`to`,`subject`,`body`,`_size`,`size`,`attachment_name`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `retention_rule` +-- + +LOCK TABLES `retention_rule` WRITE; +/*!40000 ALTER TABLE `retention_rule` DISABLE KEYS */; +/*!40000 ALTER TABLE `retention_rule` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `search` +-- + +DROP TABLE IF EXISTS `search`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `search` ( + `email` char(128) NOT NULL, + `ts` int(11) DEFAULT 0, + `term` text NOT NULL, + KEY `search_idx` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `search` +-- + +LOCK TABLES `search` WRITE; +/*!40000 ALTER TABLE `search` DISABLE KEYS */; +/*!40000 ALTER TABLE `search` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sph_counter` +-- + +DROP TABLE IF EXISTS `sph_counter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sph_counter` ( + `counter_id` bigint(20) NOT NULL, + `max_doc_id` bigint(20) NOT NULL, + PRIMARY KEY (`counter_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sph_counter` +-- + +LOCK TABLES `sph_counter` WRITE; +/*!40000 ALTER TABLE `sph_counter` DISABLE KEYS */; +INSERT INTO `sph_counter` VALUES (1,0); +/*!40000 ALTER TABLE `sph_counter` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sph_index` +-- + +DROP TABLE IF EXISTS `sph_index`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sph_index` ( + `id` bigint(20) NOT NULL, + `from` tinyblob DEFAULT NULL, + `to` blob DEFAULT NULL, + `fromdomain` tinyblob DEFAULT NULL, + `todomain` blob DEFAULT NULL, + `subject` blob DEFAULT NULL, + `arrived` int(10) unsigned NOT NULL, + `sent` int(10) unsigned NOT NULL, + `body` mediumblob DEFAULT NULL, + `size` int(11) DEFAULT 0, + `direction` int(11) DEFAULT 0, + `folder` int(11) DEFAULT 0, + `attachments` int(11) DEFAULT 0, + `attachment_types` text DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sph_index` +-- + +LOCK TABLES `sph_index` WRITE; +/*!40000 ALTER TABLE `sph_index` DISABLE KEYS */; +/*!40000 ALTER TABLE `sph_index` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `tag` +-- + +DROP TABLE IF EXISTS `tag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tag` ( + `_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `id` bigint(20) NOT NULL, + `uid` int(11) NOT NULL, + `tag` varchar(255) DEFAULT NULL, + UNIQUE KEY `id` (`id`,`uid`), + KEY `_id` (`_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tag` +-- + +LOCK TABLES `tag` WRITE; +/*!40000 ALTER TABLE `tag` DISABLE KEYS */; +/*!40000 ALTER TABLE `tag` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `timestamp` +-- + +DROP TABLE IF EXISTS `timestamp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `timestamp` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `start_id` bigint(20) DEFAULT 0, + `stop_id` bigint(20) DEFAULT 0, + `hash_value` varchar(128) DEFAULT NULL, + `count` int(11) DEFAULT 0, + `response_time` bigint(20) DEFAULT 0, + `response_string` blob NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `timestamp` +-- + +LOCK TABLES `timestamp` WRITE; +/*!40000 ALTER TABLE `timestamp` DISABLE KEYS */; +/*!40000 ALTER TABLE `timestamp` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `uid` int(10) unsigned NOT NULL, + `username` char(64) NOT NULL, + `realname` char(64) DEFAULT NULL, + `samaccountname` char(64) DEFAULT NULL, + `password` char(128) DEFAULT NULL, + `domain` char(64) DEFAULT NULL, + `dn` char(255) DEFAULT '*', + `isadmin` tinyint(4) DEFAULT 0, + PRIMARY KEY (`uid`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (0,'admin','built-in piler admin','','$1$PItc7d$zsUgON3JRrbdGS11t9JQW1','local','*',1),(1,'auditor','built-in piler auditor','','$1$SLIIIS$JMBwGqQg4lIir2P2YU1y.0','local','*',2); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_settings` +-- + +DROP TABLE IF EXISTS `user_settings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_settings` ( + `username` char(64) NOT NULL, + `pagelen` int(11) DEFAULT 20, + `theme` char(8) DEFAULT 'default', + `lang` char(2) DEFAULT NULL, + `ga_enabled` int(11) DEFAULT 0, + `ga_secret` varchar(255) DEFAULT NULL, + UNIQUE KEY `username` (`username`), + KEY `user_settings_idx` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_settings` +-- + +LOCK TABLES `user_settings` WRITE; +/*!40000 ALTER TABLE `user_settings` DISABLE KEYS */; +/*!40000 ALTER TABLE `user_settings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `usergroup` +-- + +DROP TABLE IF EXISTS `usergroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `usergroup` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `groupname` char(128) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `groupname` (`groupname`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `usergroup` +-- + +LOCK TABLES `usergroup` WRITE; +/*!40000 ALTER TABLE `usergroup` DISABLE KEYS */; +/*!40000 ALTER TABLE `usergroup` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Temporary table structure for view `v_attachment` +-- + +DROP TABLE IF EXISTS `v_attachment`; +/*!50001 DROP VIEW IF EXISTS `v_attachment`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_attachment` AS SELECT + 1 AS `i`, + 1 AS `piler_id`, + 1 AS `attachment_id`, + 1 AS `ptr`, + 1 AS `refcount` */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `v_messages` +-- + +DROP TABLE IF EXISTS `v_messages`; +/*!50001 DROP VIEW IF EXISTS `v_messages`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_messages` AS SELECT + 1 AS `id`, + 1 AS `piler_id`, + 1 AS `from`, + 1 AS `fromdomain`, + 1 AS `to`, + 1 AS `todomain`, + 1 AS `subject`, + 1 AS `size`, + 1 AS `direction`, + 1 AS `sent`, + 1 AS `retained`, + 1 AS `arrived`, + 1 AS `digest`, + 1 AS `bodydigest`, + 1 AS `deleted`, + 1 AS `attachments` */; +SET character_set_client = @saved_cs_client; + +-- +-- Final view structure for view `v_attachment` +-- + +/*!50001 DROP VIEW IF EXISTS `v_attachment`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`mailpiler`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_attachment` AS select `attachment`.`id` AS `i`,`attachment`.`piler_id` AS `piler_id`,`attachment`.`attachment_id` AS `attachment_id`,`attachment`.`ptr` AS `ptr`,(select count(0) from `attachment` where `attachment`.`ptr` = `i`) AS `refcount` from `attachment` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_messages` +-- + +/*!50001 DROP VIEW IF EXISTS `v_messages`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`mailpiler`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_messages` AS select `metadata`.`id` AS `id`,`metadata`.`piler_id` AS `piler_id`,`metadata`.`from` AS `from`,`metadata`.`fromdomain` AS `fromdomain`,`rcpt`.`to` AS `to`,`rcpt`.`todomain` AS `todomain`,`metadata`.`subject` AS `subject`,`metadata`.`size` AS `size`,`metadata`.`direction` AS `direction`,`metadata`.`sent` AS `sent`,`metadata`.`retained` AS `retained`,`metadata`.`arrived` AS `arrived`,`metadata`.`digest` AS `digest`,`metadata`.`bodydigest` AS `bodydigest`,`metadata`.`deleted` AS `deleted`,`metadata`.`attachments` AS `attachments` from (`metadata` join `rcpt`) where `metadata`.`id` = `rcpt`.`id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2024-02-20 15:34:35 From a746be066e3d0cff215a622936abb8dceed4ce62 Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:56:30 +0100 Subject: [PATCH 10/12] docs: custom database --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index e7e40f7..3031c82 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,16 @@ The Default Login is `admin@local` and the Password ist `pilerrocks` > After installation, any changes can be made in piler.conf at any time and the install script can then be run again. +#### Using Custom Database + +If you are using a custom database (for example your existing mysql/mariadb server), you have to create the database by yourself. + +First create a new user, for example `piler`, and write down the username and password. + +After that create a new database, for example `piler`, and then import the `piler.sql` from the examples folder in the new database, so that you have all database tables.
+(Tested with `mailpiler 1.4.4` installation) + +Finally enter everything during the installation process (`hostname`, `username`, `password` and `database`). ********************************************************************************************************** From 7fcea42686ab8bd13cd6486ca17c671c651a52cb Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:24:38 +0200 Subject: [PATCH 11/12] fix: MYSQL_HOSTNAME variable --- piler.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piler.conf.example b/piler.conf.example index d4bcf40..a0cad3c 100644 --- a/piler.conf.example +++ b/piler.conf.example @@ -36,7 +36,7 @@ MYSQL_DATABASE="piler" # MySql Hostname -MYSQL_HOSTNAME="mysql" +MYSQL_HOSTNAME="mysql_piler" # MySql User From 2b80f9d8da55c292fa0c4f25cdc1c73f27ded8cb Mon Sep 17 00:00:00 2001 From: Bleala <51357182+Bleala@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:36:46 +0200 Subject: [PATCH 12/12] fix: MYSQL_HOSTNAME variable --- update.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 9befabe..df5f15d 100644 --- a/update.sh +++ b/update.sh @@ -250,16 +250,16 @@ if [ ! -f $etcPth/MANTICORE ]; then fi # Copy docker-compose.yml -if [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +if [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql_piler" ]] then cp "${configPth}/piler-ssl.yml" "${installPth}/docker-compose.yml" -elif [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +elif [[ "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql_piler" ]] then cp "${configPth}/piler-ssl-no-mysql.yml" "${installPth}/docker-compose.yml" -elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql" ]] +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ "${MYSQL_HOSTNAME}" == "mysql_piler" ]] then cp "${configPth}/piler-default.yml" "${installPth}/docker-compose.yml" -elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql" ]] +elif [[ ! "${USE_LETSENCRYPT}" == "yes" ]] && [[ ! "${MYSQL_HOSTNAME}" == "mysql_piler" ]] then cp "${configPth}/piler-default-no-mysql.yml" "${installPth}/docker-compose.yml" fi