Move to Docker Compose and multiple containers

This commit is contained in:
Pierre Jaury
2016-02-24 07:44:49 +01:00
parent caab793716
commit d0006dc624
33 changed files with 260 additions and 175 deletions

View File

View File

@@ -1,5 +0,0 @@
require ["fileinto", "envelope", "mailbox"];
if header :contains "X-Spam-Flag" "YES" {
fileinto :create "Junk";
}

View File

@@ -1,16 +0,0 @@
driver = sqlite
connect = /data/freeposte.db
# Return the user hashed password
password_query = \
SELECT password \
FROM user INNER JOIN domain ON user.domain_id = domain.id \
WHERE domain.name = '%d' \
AND user.username = '%n'
# Mostly get the user quota
user_query = \
SELECT '*:bytes=' || user.quota_bytes AS quota_rule \
FROM user INNER JOIN domain ON user.domain_id = domain.id \
WHERE domain.name = '%d' \
AND user.username = '%n'

View File

@@ -1,145 +0,0 @@
###############
# General
###############
protocols = imap lmtp sieve
postmaster_address = %{env:POSTMASTER_ADDRESS}
hostname = %{env:MAIL_HOSTNAME}
mail_plugins = $mail_plugins quota
service dict {
unix_listener dict {
group = mail
mode = 0660
}
}
###############
# Mailboxes
###############
first_valid_gid = 8
first_valid_uid = 8
mail_location = maildir:/data/mail/%u
mail_home = /data/mail/%u
mail_uid = mail
mail_gid = mail
mail_privileged_group = mail
mail_access_groups = mail
namespace inbox {
inbox = yes
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
}
###############
# TLS
###############
ssl = yes
ssl_cert = </data/ssl/cert.pem
ssl_key = </data/ssl/key.pem
###############
# Authentication
###############
auth_mechanisms = plain login cram-md5
passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
service auth {
user = dovecot
unix_listener auth-userdb {
}
unix_listener /var/spool/postfix/private/dovecot-auth {
user = postfix
group = postfix
mode = 0600
}
}
service auth-worker {
unix_listener auth-worker {
user = mail
group = $default_internal_user
mode = 0660
}
user = mail
}
###############
# IMAP
###############
protocol imap {
mail_plugins = $mail_plugins imap_quota
}
service imap-login {
inet_listener imap {
port = 143
}
inet_listener imaps {
port = 993
}
}
###############
# Delivery
###############
protocol lmtp {
mail_plugins = $mail_plugins sieve
recipient_delimiter = +
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
user = postfix
group = postfix
mode = 0600
}
}
plugin {
quota = maildir:User quota
}
###############
# Filtering
###############
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
plugin {
sieve = ~/.sieve
sieve_dir = ~/sieve
sieve_before = /etc/dovecot/before.sieve
sieve_default = /etc/dovecot/default.sieve
sieve_after = /etc/dovecot/after.sieve
}

View File

@@ -1,52 +0,0 @@
user www-data;
worker_processes 1;
error_log /data/logs/nginx-error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /data/logs/nginx.log;
sendfile on;
keepalive_timeout 65;
server_tokens off;
server {
listen 80;
listen 443 ssl;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_certificate /data/ssl/cert.pem;
ssl_certificate_key /data/ssl/key.pem;
if ($scheme = http) {
return 301 https://$host$request_uri;
}
root /webmail;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /admin {
include uwsgi_params;
uwsgi_modifier1 30;
uwsgi_pass unix:/var/run/freeposte.sock;
}
}
}

View File

@@ -1,45 +0,0 @@
###############
# General
###############
# The list of relayed networks is still loaded from a configuration file
mynetworks = 127.0.0.1/32 [::1]/128
# Empty alias list to override the configuration variable and disable NIS
alias_maps = hash:/etc/aliases
# SQLite configuration
sql = sqlite:${config_directory}/
# Only accept virtual emails
mydestination =
###############
# TLS
###############
smtpd_use_tls = yes
smtpd_tls_cert_file=/data/ssl/cert.pem
smtpd_tls_key_file=/data/ssl/key.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
###############
# SASL
###############
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
###############
# Virtual
###############
virtual_mailbox_domains = ${sql}sqlite-virtual_mailbox_domains.cf
virtual_alias_maps = ${sql}sqlite-virtual_alias_maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
###############
# Milter
###############
milter_default_action = tempfail
milter_protocol = 6
smtpd_milters =
non_smtpd_milters =

View File

@@ -1,39 +0,0 @@
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# Exposed SMTP services
smtp inet n - - - - smtpd
-o content_filter=spamassassin
submission inet n - - - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
smtps inet n - - - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# Internal postfix services
pickup fifo n - n 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
proxymap unix - - - - - proxymap
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
smtp unix - - - - - smtp
relay unix - - - - - smtp
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
# Utility services
spamassassin unix - n n - - pipe
user=nobody argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

View File

@@ -1,6 +0,0 @@
dbpath = /data/freeposte.db
query =
SELECT destination
FROM alias INNER JOIN domain ON alias.domain_id = domain.id
WHERE domain.name = '%d'
AND alias.localpart = '%u'

View File

@@ -1,2 +0,0 @@
dbpath = /data/freeposte.db
query = SELECT name FROM domain WHERE name='%s'

View File

@@ -1,42 +0,0 @@
<?php
$config = array();
// Generals
$config['db_dsnw'] = 'sqlite:////data/webmail/roundcube.db';
$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
$config['identities_level'] = 3;
$config['reply_all_mode'] = 1;
// List of active plugins (in plugins/ directory)
$config['plugins'] = array(
'archive',
'zipdownload',
'managesieve',
'markasjunk',
'password'
);
// Mail servers
$config['default_host'] = 'localhost';
$config['default_port'] = 143;
$config['smtp_server'] = 'localhost';
$config['smtp_port'] = 25;
// Password management
$config['password_driver'] = 'sql';
$config['password_confirm_current'] = true;
$config['password_minimum_length'] = 6;
$config['password_db_dsn'] = 'sqlite:////data/freeposte.db';
$config['password_query'] = '
UPDATE user SET password=%D
WHERE id IN (SELECT user.id FROM user
INNER JOIN domain ON domain.id=user.domain_id
WHERE domain.name=%d AND user.name=%l
)
';
$config['password_dovecotpw'] = 'doveadm pw';
$confog['password_dovecotpw_method'] = 'SHA512-CRYPT';
// skin name: folder from skins/
$config['skin'] = 'larry';

View File

@@ -1,5 +0,0 @@
$ModLoad imuxsock
$ModLoad imklog
*.* /data/logs/mail.log

View File

@@ -1,28 +0,0 @@
[supervisord]
nodaemon = true
logfile = /data/logs/supervisord.log
[program:nginx]
command = nginx -g 'daemon off;'
[program:rsyslog]
command = rsyslogd -n
[program:postfix]
command = /usr/lib/postfix/master -d
[program:dovecot]
command = /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F
[program:spamassassin]
command = /usr/sbin/spamd
[program:admin]
command = uwsgi --yaml /etc/uwsgi/apps-enabled/freeposte.yml
stdout_logfile = /data/logs/admin.log
stderr_logfile = /data/logs/admin-error.log
[program:webmail]
command = php5-fpm -F
stdout_logfile = /data/logs/php.log
stderr_logfile = /data/logs/php-error.log

View File

@@ -1,16 +0,0 @@
uwsgi:
socket: /var/run/freeposte.sock
chown-socket: www-data:www-data
pidfile: /var/run/freeposte.pid
master: true
workers: 2
vacuum: true
plugins: python
wsgi-file: /admin/run.py
callable: app
processes: 1
pythonpath: /usr/lib/python2.7/site-packages
pythonpath: /admin
catch-exceptions: true
post-buffering: 8192