(simatec) first Beta

This commit is contained in:
simatec 2022-03-08 12:02:21 +01:00
parent a0a87ae945
commit 3e85dbf451
5 changed files with 266 additions and 2 deletions

1
.env
View file

@ -1 +0,0 @@
12345

View file

@ -13,3 +13,66 @@ https://www.mailpiler.org/
### Installation Guide: ### Installation Guide:
* Install Docker
`curl -sSL https://get.docker.com/ | CHANNEL=stable sh
systemctl enable --now docker`
* Install Docker-Compose
`curl -L https://github.com/docker/compose/releases/download/$(curl -Ls https://www.servercow.de/docker-compose/latest.php)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose`
* reboot your system
`reboot now`
* remove postfix
`apt purge postfix`
* Clone repository
`cd /opt
clone https://github.com/simatec/piler-docker.git
cd /opt/piler-docker`
configure your Piler seetings
`nano piler.conf`
after config start the Install
`./install-piler.sh`
Congratulations your Piler is installed...
**********************************************************************************************************
## Changelog
### 0.1.0 (08.03.2022)
* (simatec) first beta
## License
MIT License
Copyright (c) 2022 simatec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

80
docker-compose.yml Normal file
View file

@ -0,0 +1,80 @@
version: "3"
services:
mysql:
image: mariadb:10.5
container_name: mysql_piler
restart: unless-stopped
cap_drop:
- ALL
cap_add:
- dac_override
- setuid
- setgid
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- "TZ=Europe/Berlin"
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
healthcheck:
test: mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} piler --execute "show tables"
interval: "60s"
timeout: "5s"
start_period: "15s"
retries: 3
volumes:
- db_data:/var/lib/mysql
memcached:
image: memcached:latest
container_name: memcached_piler
restart: unless-stopped
cap_drop:
- ALL
command: -m 64
piler:
image: sutoj/piler:1.3.11
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
- PILER_HOSTNAME=${PILER_DOMAIN}
- MEMCACHED_HOST=memcached
- TZ=Europe/Berlin
ports:
- "25:25"
- "8080:80"
- "8443:443"
volumes:
- piler_etc:/etc/piler
- piler_var:/var/piler
- /etc/localtime:/etc/localtime
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:
db_data: {}
piler_etc: {}
piler_var: {}

98
install-piler.sh Normal file
View file

@ -0,0 +1,98 @@
#!/bin/bash
. ./piler.conf
ln -s ./piler.conf .env
# docker stop
echo "start docker-compose for Piler"
cd /opt/piler
docker-compose up -d
echo "backup the File config-site.php"
cp /var/lib/docker/volumes/piler_piler_etc/_data/config-site.php /var/lib/docker/volumes/piler_piler_etc/_data/config-site.php.bak
echo "set User settings ..."
cat >> /var/lib/docker/volumes/piler_piler_etc/_data/config-site.php <<EOF
// Smarthost
$config['SMARTHOST'] = '$SMARTHOST';
$config['SMARTHOST_PORT'] = '25';
// CUSTOM
\$config['PROVIDED_BY'] = '$PILER_DOMAIN';
\$config['SUPPORT_LINK'] = 'mailto:$SUPPORT_MAIL';
\$config['COMPATIBILITY'] = '';
// fancy features.
\$config['ENABLE_INSTANT_SEARCH'] = 1;
\$config['ENABLE_TABLE_RESIZE'] = 1;
\$config['ENABLE_DELETE'] = 1;
\$config['ENABLE_ON_THE_FLY_VERIFICATION'] = 1;
// general settings.
\$config['TIMEZONE'] = '$TIME_ZONE';
// authentication
// Enable authentication against an imap server
\$config['ENABLE_IMAP_AUTH'] = 1;
\$config['RESTORE_OVER_IMAP'] = 1;
\$config['IMAP_RESTORE_FOLDER_INBOX'] = 'INBOX';
\$config['IMAP_RESTORE_FOLDER_SENT'] = 'Sent';
\$config['IMAP_HOST'] = '$IMAP_SERVER';
\$config['IMAP_PORT'] = 993;
\$config['IMAP_SSL'] = true;
// authentication against an ldap directory (disabled by default)
//\$config['ENABLE_LDAP_AUTH'] = 1;
//\$config['LDAP_HOST'] = '$SMARTHOST';
//\$config['LDAP_PORT'] = 389;
//\$config['LDAP_HELPER_DN'] = 'cn=administrator,cn=users,dc=mydomain,dc=local';
//\$config['LDAP_HELPER_PASSWORD'] = 'myxxxxpasswd';
//\$config['LDAP_MAIL_ATTR'] = 'mail';
//\$config['LDAP_AUDITOR_MEMBER_DN'] = '';
//\$config['LDAP_ADMIN_MEMBER_DN'] = '';
//\$config['LDAP_BASE_DN'] = 'ou=Benutzer,dc=krs,dc=local';
// authentication against an Uninvention based ldap directory
//\$config['ENABLE_LDAP_AUTH'] = 1;
//\$config['LDAP_HOST'] = '$SMARTHOST';
//\$config['LDAP_PORT'] = 7389;
//\$config['LDAP_HELPER_DN'] = 'uid=ldap-search-user,cn=users,dc=mydomain,dc=local';
//\$config['LDAP_HELPER_PASSWORD'] = 'myxxxxpasswd';
//\$config['LDAP_AUDITOR_MEMBER_DN'] = '';
//\$config['LDAP_ADMIN_MEMBER_DN'] = '';
//\$config['LDAP_BASE_DN'] = 'cn=users,dc=mydomain,dc=local';
//\$config['LDAP_MAIL_ATTR'] = 'mailPrimaryAddress';
//\$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'person';
//\$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'person';
//\$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'mailAlternativeAddress';
EOF
if [ "$USE_MAILCOW" = true ] ; then
echo "set Mailcow Api-Key config"
cat >> /var/lib/docker/volumes/piler_piler_etc/_data/config-site.php <<EOF
// Mailcow API
$config['MAILCOW_API_KEY'] = '$MAILCOW_APIKEY';
$config['MAILCOW_SET_REALNAME'] = true;
$config['CUSTOM_EMAIL_QUERY_FUNCTION'] = 'query_mailcow_for_email_access';
$config['MAILCOW_HOST'] = '$MAILCOW_HOST'; // default $config['IMAP_HOST']
include('auth-mailcow.php');
EOF
curl -o /var/lib/docker/volumes/piler_piler_etc/_data/auth-mailcow.php https://raw.githubusercontent.com/patschi/mailpiler-mailcow-integration/master/auth-mailcow.php
fi
# docker start
echo "restart docker-compose ..."
cd /opt/piler
docker-compose restart
echo "Piler install completed successfully"
echo "you can start in your Browser with http://${PILER_DOMAIN}!"

View file

@ -1 +1,25 @@
121234555345 ################################ User Settings ##################################
PILER_DOMAIN="piler.example.com" # your Piler Domain
SUPPORT_MAIL="admin@example.com" # your Mailserver Admin Mail
IMAP_SERVER="imap.example.com" # your IMAP Server
TIME_ZONE="Europe/Berlin" # your Timezone
SMARTHOST="127.0.0.1" # Default 127.0.0.1
##################################################################################
################################ MySql Settings ##################################
MYSQL_DATABASE="piler" # MySql Database
MYSQL_USER="piler" # MySql User
MYSQL_PASSWORD="<your-mysql-password>" # MySql Password
##################################################################################
########################### optional Mailcow Settings ############################
USE_MAILCOW=false # if Use Mailcow API Options set "true"
MAILCOW_APIKEY="your_Mailcow_API-Key" # your Mailcow API-Key
MAILCOW_HOST="mail.example.com" # your Mailcow Host Domain
###################################################################################