From 2e7f8483b338333abe78195f7cc9049c0b9170c8 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 9 Dec 2023 13:43:56 +0100 Subject: [PATCH] rework UI for chatmail setup --- README.md | 94 +++++++++++++++++++++------------- deploy-chatmail/pyproject.toml | 3 ++ 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 63cfff50..044d14ba 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Chatmail instances optimized for Delta Chat apps +# Chatmail services optimized for Delta Chat apps -This repository helps to setup a ready-to-use chatmail instance +This repository helps to setup a ready-to-use chatmail server comprised of a minimal setup of the battle-tested [postfix smtp](https://www.postfix.org) and [dovecot imap](https://www.dovecot.org) services. @@ -13,27 +13,72 @@ for use by [Delta Chat apps](https://delta.chat). Chatmail accounts are automatically created by a first login, after which the initially specified password is required for using them. -## Getting Started deploying your own chatmail instance +## Deploying your own chatmail server -1. Setup a domain with `A` and `AAAA` records for your chatmail server. +We subsequently use `CHATMAIL_DOMAIN` as a placeholder for your fully qualified +DNS domain name (FQDN), for example `chat.example.org`. -2. Prepare your local system for deploying to $CHATMAIL_DOMAIN: +1. Setup DNS `A` and `AAAA` records for your `CHATMAIL_DOMAIN`. + Verify that DNS is set and SSH root login works: - scripts/init.sh $CHATMAIL_DOMAIN + ``` + ssh root@CHATMAIL_DOMAIN + ``` -3. Edit the generated `chatmail.ini` file +2. Install the `cmdeploy` binary in a Python virtual environment: -4. Deploy chatmail services remotely: + ``` + python3 -m venv venv + source venv/bin/activate + pip install -e deploy-chatmail -e chatmaild + ``` - scripts/deploy.sh chatmail.ini +3. Create chatmail configuration file `chatmail.ini`: -5. Run `scripts/generate-dns-zone.sh` and - transfer the generated DNS `chatmail.zone` records to your DNS provider + ``` + cmdeploy genconfig chatmail.ini CHATMAIL_DOMAIN + ``` + +4. Deploy to the remote chatmail server, pointing to the chatmail config file: + + ``` + cmdeploy install chatmail.ini + ``` + +5. To output a DNS zone file from which you can transfer DNS records + to your DNS provider for your `CHATMAIL_DOMAIN` + + ``` + cmdeploy dns chatmail.ini + ``` + + to generate a DNS zone file from which you can transfer records to your + DNS provider. + + + +### Refining the web pages + + +``` + cmdeploy webdev +``` + +This starts a local live development cycle for chatmail Web pages: + +- uses the `www/src/page-layout.html` file for producing static + HTML pages from `www/src/*.md` files + +- continously builds the web presence reading files from `www/src` directory + and generating html files and copying assets to the `www/build` directory. + +- Starts a browser window automatically where you can "refresh" as needed. ### Home page and getting started for users -The `deploy.sh` script deploys +`cmdeploy install chatmail.ini` script sets up mail services, +and also creates default static Web pages and deploys them: - a default `index.html` along with a QR code that users can click to create accounts on your chatmail provider, @@ -42,31 +87,10 @@ The `deploy.sh` script deploys - a default `policy.html` that is linked from the home page. -All files are generated by the according markdown `.md` file in the `www` directory. +All `.html` files are generated +by the according markdown `.md` file in the `www/src` directory. -### Refining the web pages - -The `scripts/webdev.sh` script supports live development of the chatmail web presence: - -``` - scripts/init.sh # to locally initialize python virtual environments etc. - scripts/webdev.sh -``` - -- uses the `www/src/page-layout.html` file for producing html documents - from `www/src/*.md` files. - -- continously builds the web presence reading files from `www/src` directory - and generating html files and copying assets to the `www/build` directory. - -- Starts a browser window automatically where you can "refresh" as needed. - -Note that this script is not needed for running `scripts/deploy.sh" -which deploys the whole chatmail setup remotely. -The code that generates the web pages is identical -which means that `webdev.sh` gives a pretty good preview. - ### Ports Postfix listens on ports 25 (smtp) and 587 (submission) and 465 (submissions). diff --git a/deploy-chatmail/pyproject.toml b/deploy-chatmail/pyproject.toml index 9073d81e..649e7973 100644 --- a/deploy-chatmail/pyproject.toml +++ b/deploy-chatmail/pyproject.toml @@ -10,6 +10,9 @@ dependencies = [ "pillow", "qrcode", "markdown", + "pytest", + "setuptools>=68", + "tox", ] [tool.pytest.ini_options]