The intended and recommended way of installing this application is via Composer. First,
make sure all requirements are met before trying to install the application.
All commands should be run as your unprivileged Apache/Nginx system user or the PHP-FPM/PHP-CGI user (depending on
your environment)! This is important in order to avoid later issues due to insufficient access permissions.
Commands intended to be run as root
are always prepended with sudo
throughout this documentation.
Step by Step
Create the database and two database users: one for the Post Office, which needs full access to create and update
the database tables, and one for Postfix and Dovecot, which only need to read them.
sudo mariadb
CREATE DATABASE vmail CHARACTER SET utf8mb4;
-- The Post Office
CREATE USER 'postoffice'@'127.0.0.1' IDENTIFIED BY 'a-secure-password';
GRANT ALL PRIVILEGES ON vmail.* TO 'postoffice'@'127.0.0.1';
-- Postfix and Dovecot
CREATE USER 'vmail'@'127.0.0.1' IDENTIFIED BY 'another-secure-password';
GRANT SELECT ON vmail.* TO 'vmail'@'127.0.0.1';
Postfix and Dovecot look up email addresses case-insensitively, which relies on the case-insensitive default
collation of the database. Don't change the collation of the database or its tables to a case-sensitive one.
Install the application. The following command will get you the latest stable version and all its dependencies.
# Install the latest stable version suitable for your environment
composer create-project sebastian-meyer/post-office --ask --no-dev
You can generate a random secret with php -r "echo bin2hex(random_bytes(16)), PHP_EOL;"
.
Create the database tables.
# Create all database tables
php bin/console doctrine:migrations:migrate
Compile the frontend assets and warm up the cache.
# Write all CSS and JavaScript files to ./public/assets/
php bin/console asset-map:compile
# Build the cache for the production environment
php bin/console cache:clear
Configure your web server to use the ./public/
directory as document root and index.php
as default entry
point. A minimal Nginx configuration looks like this: