Compare commits

..

2 Commits

Author SHA1 Message Date
link2xt
4385b84139 Add metrics 2023-12-14 19:26:51 +00:00
Septias
5a178ed235 feat: one more paragraph to explain chatmail
close #126
2023-12-14 16:39:41 +01:00
7 changed files with 55 additions and 9 deletions

View File

@@ -15,8 +15,8 @@ after which the initially specified password is required for using them.
## Deploying your own chatmail server ## Deploying your own chatmail server
We use `chat.example.org` as the chatmail domain in the following steps. We subsequently use `CHATMAIL_DOMAIN` as a placeholder for your fully qualified
Please substitute it with your own domain. DNS domain name (FQDN), for example `chat.example.org`.
1. Install the `cmdeploy` command in a virtualenv 1. Install the `cmdeploy` command in a virtualenv
@@ -25,19 +25,19 @@ Please substitute it with your own domain.
cd chatmail cd chatmail
scripts/initenv.sh scripts/initenv.sh
``` ```
2. Create chatmail configuration file `chatmail.ini`: 2. Create chatmail configuration file `chatmail.ini`:
``` ```
scripts/cmdeploy init chat.example.org # <-- use your domain scripts/cmdeploy init CHATMAIL_DOMAIN
``` ```
3. Setup first DNS records for your chatmail domain, 3. Setup first DNS records for your `CHATMAIL_DOMAIN`,
according to the hints provided by `cmdeploy init`. according to the hints provided by `cmdeploy init`.
Verify that SSH root login works: Verify that SSH root login works:
``` ```
ssh root@chat.example.org # <-- use your domain ssh root@CHATMAIL_DOMAIN
``` ```
4. Deploy to the remote chatmail server: 4. Deploy to the remote chatmail server:
@@ -75,7 +75,7 @@ scripts/cmdeploy bench
## Overview of this repository ## Overview of this repository
This repository drives the development of chatmail services, This repository drives the development of "chatmail instances",
comprised of minimal setups of comprised of minimal setups of
- [postfix smtp server](https://www.postfix.org) - [postfix smtp server](https://www.postfix.org)
@@ -91,7 +91,7 @@ as well as custom services that are integrated with these two:
to send mails for them. to send mails for them.
- `chatmaild/src/chatmaild/filtermail.py` prevents - `chatmaild/src/chatmaild/filtermail.py` prevents
unencrypted e-mail from leaving the chatmail service unencrypted e-mail from leaving the chatmail instance
and is integrated into postfix's outbound mail pipelines. and is integrated into postfix's outbound mail pipelines.
There is also the `cmdeploy/src/cmdeploy/cmdeploy.py` command line tool There is also the `cmdeploy/src/cmdeploy/cmdeploy.py` command line tool
@@ -104,7 +104,7 @@ to automatically install all chatmail components on a server.
### Home page and getting started for users ### Home page and getting started for users
`cmdeploy run` also creates default static Web pages and deploys them `cmdeploy run` also creates default static Web pages and deploys them
to a nginx web server with: to an nginx web server under `https://CHATMAIL_DOMAIN`.
- a default `index.html` along with a QR code that users can click to - a default `index.html` along with a QR code that users can click to
create accounts on your chatmail provider, create accounts on your chatmail provider,

View File

@@ -22,6 +22,7 @@ where = ['src']
doveauth = "chatmaild.doveauth:main" doveauth = "chatmaild.doveauth:main"
filtermail = "chatmaild.filtermail:main" filtermail = "chatmaild.filtermail:main"
echobot = "chatmaild.echo:main" echobot = "chatmaild.echo:main"
chatmail-metrics = "chatmaild.metrics:main"
[project.entry-points.pytest11] [project.entry-points.pytest11]
"chatmaild.testplugin" = "chatmaild.tests.plugin" "chatmaild.testplugin" = "chatmaild.tests.plugin"

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
from pathlib import Path
import time
import sys
def main():
vmail_dir = sys.argv[1]
accounts = 0
ci_accounts = 0
for path in Path(vmail_dir).iterdir():
accounts += 1
if path.name.startswith("ci-"):
ci_accounts += 1
timestamp = int(time.time() * 1000)
print(f"accounts {accounts} {timestamp}")
print(f"ci_accounts {ci_accounts} {timestamp}")
if __name__ == "__main__":
main()

View File

@@ -84,6 +84,18 @@ def _install_remote_venv_with_chatmaild(config) -> None:
], ],
) )
files.template(
src=importlib.resources.files(__package__).joinpath("metrics.cron.j2"),
dest="/etc/cron.d/chatmail-metrics",
user="root",
group="root",
mode="644",
config={
"mail_domain": config.mail_domain,
"execpath": f"{remote_venv_dir}/bin/chatmail-metrics",
},
)
# install systemd units # install systemd units
for fn in ( for fn in (
"doveauth", "doveauth",

View File

@@ -0,0 +1 @@
*/5 * * * * root {{ config.execpath }} /home/vmail/mail/{{ config.mail_domain }} >/var/www/html/metrics

View File

@@ -41,6 +41,10 @@ http {
try_files $uri $uri/ =404; try_files $uri $uri/ =404;
} }
location /metrics {
default_type text/plain;
}
# add cgi-bin support # add cgi-bin support
include /usr/share/doc/fcgiwrap/examples/nginx.conf; include /usr/share/doc/fcgiwrap/examples/nginx.conf;
} }

View File

@@ -3,6 +3,11 @@
## More information ## More information
`nine.testrun.org` provides a low-maintenance, resource efficient and
interoperable e-mail service for everyone. What's behind a `chatmail` is
effectively a normal e-mail address just like any other but optimized
for the usage in chats, especially DeltaChat.
### Choosing a chatmail address instead of using a random one ### Choosing a chatmail address instead of using a random one
In the Delta Chat account setup In the Delta Chat account setup