kill-the-newsletter/README.md

86 lines
2.8 KiB
Markdown
Raw Normal View History

2020-03-20 19:36:18 +01:00
<div align="center">
<h1><a href="https://www.kill-the-newsletter.com">Kill the Newsletter!</a></h1>
<p><strong>Convert email newsletters into Atom feeds</strong></p>
<p><img alt="Convert email newsletters into Atom feeds" src="static/logo.png" width="150" /></p>
2020-03-21 16:58:28 +01:00
<p>
<a href="https://github.com/leafac/www.kill-the-newsletter.com">
<img alt="Source" src="https://img.shields.io/badge/Source---" />
</a>
<a href="https://github.com/leafac/www.kill-the-newsletter.com/actions">
<img alt=".github/workflows/main.yml" src="https://github.com/leafac/www.kill-the-newsletter.com/workflows/.github/workflows/main.yml/badge.svg" />
</a>
</p>
2020-03-20 19:36:18 +01:00
</div>
2020-03-19 15:48:31 +01:00
# Running Locally
Install [Node.js](https://nodejs.org/) and run:
```console
$ npm install
2020-03-20 07:52:49 +01:00
$ npm start
2020-03-19 15:48:31 +01:00
```
The web server will be running at `http://localhost:8000` and the email server at `smtp://localhost:2525`.
2020-03-21 17:53:17 +01:00
# Deployment
1. Create a deployment SSH key pair:
```console
$ ssh-keygen
```
2020-03-21 18:10:18 +01:00
**Private key (`id_rsa`):** Add to GitHub as a **Secret** called `SSH_PRIVATE_KEY`.
2020-03-21 17:53:17 +01:00
2020-03-21 18:10:18 +01:00
**Public key (`id_rsa.pub`):** Add to DigitalOcean and to GitHub as a **Deploy key** for the repository.
2020-03-21 17:53:17 +01:00
2020-03-21 18:10:18 +01:00
2. Create a DigitalOcean droplet:
2020-03-21 18:06:14 +01:00
| | |
| ------------------ | ------------------------- |
| Image | Ubuntu 18.04.3 (LTS) x64 |
| Plan | Starter Standard \$5/mo |
| Additional options | Monitoring |
| Authentication | Deployment SSH Key |
| Hostname | `kill-the-newsletter.com` |
| Backups | Enable |
2020-03-21 17:53:17 +01:00
2020-03-22 08:34:55 +01:00
**Firewall**
| | | |
| ------------- | ------------------------- | --------- |
| Name | `kill-the-newsletter.com` | |
2020-03-22 09:11:55 +01:00
| Inbound Rules | ICMP | |
| | SSH | 22 |
| | Custom | 25 (SMTP) |
2020-03-22 08:34:55 +01:00
| | HTTP | 80 |
| | HTTPS | 443 |
**Floating IP**
2020-03-21 18:10:18 +01:00
3. Configure DNS in Namecheap:
2020-03-21 17:53:17 +01:00
| Type | Host | Value |
| ------- | ----- | ------------------------- |
| `A` | `@` | `<droplet-ip>` |
| `CNAME` | `www` | `kill-the-newsletter.com` |
| `MX` | `@` | `kill-the-newsletter.com` |
2020-03-21 18:10:18 +01:00
4. Setup the server:
2020-03-21 17:53:17 +01:00
```console
2020-03-21 18:13:30 +01:00
$ ssh-add
2020-03-21 17:53:17 +01:00
$ npx pm2 deploy package.json production setup
```
2020-03-21 18:23:01 +01:00
5. Migrate the existing feeds:
```console
$ ssh-add
$ ssh -A root@kill-the-newsletter.com
root@kill-the-newsletter.com $ rsync -av <path-to-previous-feeds> /root/www.kill-the-newsletter.com/current/static/feeds/
```
2020-03-21 18:13:30 +01:00
6. Push to GitHub, which will trigger the Action that deploys the code and starts the server.