kill-the-newsletter/README.md

104 lines
4.4 KiB
Markdown
Raw Normal View History

2020-03-24 02:22:30 +01:00
<h1 align="center"><a href="https://www.kill-the-newsletter.com">Kill the Newsletter!</a></h1>
<h3 align="center">Convert email newsletters into Atom feeds</h3>
2020-05-05 08:12:57 +02:00
<p align="center"><img alt="Convert email newsletters into Atom feeds" src="static/logo.svg"></p>
2020-03-24 02:22:30 +01:00
<p align="center">
2020-05-03 03:37:08 +02:00
<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="Continuous Integration" src="https://github.com/leafac/www.kill-the-newsletter.com/workflows/.github/workflows/main.yml/badge.svg"></a>
2020-03-21 16:58:28 +01:00
</p>
2020-03-19 15:48:31 +01:00
2020-04-06 16:29:33 +02:00
# Deploy Your Own Instance (Self-Host)
2020-03-19 15:48:31 +01:00
2020-04-06 16:29:33 +02:00
1. Create accounts on [GitHub](https://github.com), [Namecheap](https://www.namecheap.com), and [DigitalOcean](https://www.digitalocean.com).
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
2. [Fork](https://github.com/leafac/www.kill-the-newsletter.com/fork) this repository.
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
3. Create a deployment SSH key pair:
2020-03-21 17:53:17 +01:00
```console
$ ssh-keygen
```
2020-04-06 16:29:33 +02:00
**Private key (`id_rsa`):** Add to your fork under **Settings > Secrets** as a new secret called `SSH_PRIVATE_KEY`.
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
**Public key (`id_rsa.pub`):** Add to your fork under **Settings > Deploy keys** and to your DigitalOcean account under **Account > Security > SSH keys**.
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
4. Buy a domain on Namecheap.
2020-03-21 18:06:14 +01:00
2020-04-06 16:29:33 +02:00
5. Create a DigitalOcean droplet:
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
| | |
| ---------------------- | ------------------------------------------------------- |
| **Image** | Ubuntu 18.04.3 (LTS) x64 |
| **Plan** | Starter Standard \$5/mo |
| **Additional options** | Monitoring |
| **Authentication** | Your Deployment SSH Key |
| **Hostname** | `<YOUR DOMAIN, FOR EXAMPLE, “kill-the-newsletter.com”>` |
| **Backups** | Enable |
2020-03-22 08:34:55 +01:00
2020-04-06 16:29:33 +02:00
6. Assign the new droplet a **Firewall**:
2020-03-22 08:34:55 +01:00
2020-04-06 16:29:33 +02:00
| | | |
| ----------------- | ------------------------------------------------------- | --------- |
| **Name** | `<YOUR DOMAIN, FOR EXAMPLE, “kill-the-newsletter.com”>` | |
| **Inbound Rules** | ICMP | |
| | SSH | 22 |
| | Custom | 25 (SMTP) |
| | HTTP | 80 |
| | HTTPS | 443 |
2020-03-22 08:34:55 +01:00
2020-04-06 16:29:33 +02:00
7. Assign the new droplet a **Floating IP**.
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
8. Configure the DNS in Namecheap:
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
| Type | Host | Value |
| ------- | ----- | ------------------------------------------------------- |
| `A` | `@` | `<FLOATING IP>` |
| `CNAME` | `www` | `<YOUR DOMAIN, FOR EXAMPLE, “kill-the-newsletter.com”>` |
| `MX` | `@` | `<YOUR DOMAIN, FOR EXAMPLE, “kill-the-newsletter.com”>` |
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
9. Configure the deployment on [`package.json`](package.json), particularly under the following keys:
2020-03-21 17:53:17 +01:00
2020-04-06 16:29:33 +02:00
- `apps.env.BASE_URL`.
- `apps.env.EMAIL_DOMAIN`.
- `apps.env.ISSUE_REPORT`.
- `deploy.production.host`.
- `deploy.production.repo`.
2020-03-21 18:23:01 +01:00
2020-07-09 13:36:48 +02:00
10. Configure [Caddy](https://caddyserver.com), the reverse proxy, on [`Caddyfile`](Caddyfile).
2020-04-06 16:29:33 +02:00
11. Setup the server:
```console
$ ssh-add
$ npx pm2 deploy package.json production setup
```
12. Migrate the existing feeds (if any):
```console
$ ssh-add
$ ssh -A root@<YOUR DOMAIN, FOR EXAMPLE, kill-the-newsletter.com>
root@<YOUR DOMAIN, FOR EXAMPLE, 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
2020-04-06 16:30:39 +02:00
13. Push to your fork, which will trigger the GitHub Action that deploys the code and starts the server.
2020-04-06 16:29:33 +02:00
# Run Locally
Install [Node.js](https://nodejs.org/) and run:
```console
$ npm install
$ npm start
```
The web server will be running at `http://localhost:8000` and the email server at `smtp://localhost:2525`.
# Run Tests
Install [Node.js](https://nodejs.org/) and run:
```console
$ npm install-test
```