From 54772127a411a6e86a7d833ef06b276d94eaabd7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 12 Nov 2020 16:17:33 +0100 Subject: [PATCH] add documentation --- .env | 2 +- README.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ private/.gitkeep | 0 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 private/.gitkeep diff --git a/.env b/.env index 85d8816..d9ad72c 100644 --- a/.env +++ b/.env @@ -14,7 +14,7 @@ # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration ###> symfony/framework-bundle ### -APP_ENV=dev +APP_ENV=prod APP_SECRET=aa708f7c537a5c6d167229524aea0817 ###< symfony/framework-bundle ### diff --git a/README.md b/README.md new file mode 100644 index 0000000..9023fe7 --- /dev/null +++ b/README.md @@ -0,0 +1,98 @@ +Mail RSS +======== + +This application allows you to transform emails into an RSS feed without connecting to a mailbox. + +![](https://upload.deblan.org/u/2020-11/5fad5081.svg) + +Installation +------------ + +Requirements: + +* PHP 7.4 +* [Symfony requirements](https://symfony.com/doc/4.2/reference/requirements.html) +* MySQL, PostgreSQL or SQLite +* Mailparse module (php-mailparse) + +``` +$ git clone https://gitnet.fr/deblan/mail-rss.git +$ cd mail-rss +$ cp .env env.local +$ composer install +``` + +Populate `.env.local`: + +- `APP_ENV`: `prod` or `dev` +- `DATABASE_URL`: [read the documentation](https://symfony.com/doc/5.3/doctrine.html#configuring-the-database) +- `APP_DEFAULT_URI`: URI of the application (without trailing slash) + +Be sure that the webserver can read/write `private/`, `var/` and `migrations/`. + +``` +$ php bin/console -e dev doctrine:migrations:diff +$ php bin/console -e dev doctrine:migrations:exe --up DoctrineMigrations\\VersionXXXXXXXXXXXXX +``` + +And read the doc to publish a symfony app: https://symfony.com/doc/5.3/deployment.html + +Usage +----- + +Use case: you want to create a feed of a newsletter named "Foo Bar". + +``` +$ sudo mkdir /var/lib/mailrss +$ sudo chmod 0770 /var/lib/mailrss +$ sudo chown you-web-user:nogroup +``` + +Add an alias into your mailserver: + +``` +# /etc/aliases +mailrss-foobar: "| > /var/lib/mailrss/foobar-$(date +%s) && chmod o+rw /var/lib/mailrss/foobar-$(date +%s)" +``` + +Then run `$ sudo newaliases`. + +Add a mailing in the app: + +``` +$ php bin/console mailing:new "Fo Bar" + +# Oops, you made a mistake in the label, let's fix it + +$ php bin/console mailing:list +$ php bin/console mailing:rename xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx "Foo bar" +``` + +With `mailing:list`, you retrieve the URL of the feed. + +In case of you want to delete the mailing: + +``` +$ php bin/console mailing:delete xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +``` + +Finally, create a script run in a cron: + +``` +#!/bin/sh + +cd "/path/to/app" + +find /var/lib/mailrss -name "foobar-*" | while read MAIL_FILE; do + cat "MAIL_FILE" | php bin/console mail:import xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + + rm "MAIL_FILE" +done +``` + +If you wan create another feed then: + +* Create an aliase +* Create a mailing +* Update your script run in the cron +* Get the URI using `mailing:list` diff --git a/private/.gitkeep b/private/.gitkeep new file mode 100644 index 0000000..e69de29