death-notifier/README.md

66 lines
1.9 KiB
Markdown

# Death Notifier
Get notified when a famous person dies.
Wikipedia's editors [are known](https://knowyourmeme.com/memes/wikipedia-editors-when-someone-dies) for updating pages
as soon as someone has died.
Why not turn that into a service?
This tool regularly checks if people are still alive according to Wikipedia, and emails you as soon as that changes.
## Development
### Requirements
* PHP 8.1+ (i.e. `apt install php php-cgi`)
* [PHP cURL](https://www.php.net/manual/en/book.curl.php) (i.e. `apt install php-curl`)
* [PHP DOM](https://www.php.net/manual/en/book.dom.php) (i.e. `apt install php-dom`)
* [PHP SQLite 3](https://www.php.net/manual/en/book.sqlite3.php) (i.e. `apt install php-sqlite3`)
* [composer](https://getcomposer.org/) (make sure `composer.phar` is on your path)
* [npm](https://www.npmjs.com/)
### Setting up
```shell script
# Install dependencies (only needed once)
$> composer.phar install
$> npm ci
```
### Building
```shell script
# Build the tool in `dist/` for development
$> npm run dev
# Same as above, but automatically rerun it whenever files are changed
$> npm run dev:server
# Build the tool in `dist/` for deployment
$> npm run deploy
```
### Pre-commit
```shell script
# Update lock files
$> composer.phar update
$> npm install
```
### Static analysis
```shell script
# Run static analysis
$> npm run analyze
# Run tests
$> npm run test
# Run static analysis and tests
$> npm run check
```
## Deployment
Build the software and move it to the right directory.
```shell script
$> npm run deploy # Build
$> mv dist/ /var/www/death-notifier/ # Move to public directory
```
Then, add the following lines to your crontab using `sudo -u www crontab -e`:
```
* * * * * cd /var/www/death-notifier && php /var/www/death-notifier/api.php process-email-queue secret_password
*/5 * * * * cd /var/www/death-notifier && php /var/www/death-notifier/api.php update-all-trackings secret_password
```