2020-08-04 23:57:49 +02:00
< h1 align = "center" > < a href = "https://kill-the-newsletter.com" > Kill the Newsletter!< / a > < / h1 >
2020-03-24 02:22:30 +01:00
< h3 align = "center" > Convert email newsletters into Atom feeds< / h3 >
2020-08-10 00:05:31 +02:00
< p align = "center" > < img src = "static/logo.svg" alt = "Convert email newsletters into Atom feeds" > < / p >
2020-03-24 02:22:30 +01:00
< p align = "center" >
2020-08-10 00:05:31 +02:00
< a href = "https://github.com/leafac/kill-the-newsletter.com" > < img src = "https://img.shields.io/badge/Source---" alt = "Source" > < / a >
< a href = "https://github.com/leafac/kill-the-newsletter.com/actions" > < img src = "https://github.com/leafac/kill-the-newsletter.com/workflows/.github/workflows/main.yml/badge.svg" alt = "Continuous Integration" > < / 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-08-04 23:57:49 +02:00
2. [Fork ](https://github.com/leafac/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
2020-08-04 23:47:58 +02:00
$ npm run deploy:setup
2020-04-06 16:29:33 +02:00
```
12. Migrate the existing feeds (if any):
```console
$ ssh-add
$ ssh -A root@< YOUR DOMAIN , FOR EXAMPLE , “ kill-the-newsletter . com ” >
2020-08-04 23:57:49 +02:00
root@< YOUR DOMAIN , FOR EXAMPLE , “ kill-the-newsletter . com ” > $ rsync -av < path-to-previous-feeds > /root/kill-the-newsletter.com/current/static/feeds/
root@< YOUR DOMAIN , FOR EXAMPLE , “ kill-the-newsletter . com ” > $ rsync -av < path-to-previous-alternate > /root/kill-the-newsletter.com/current/static/alternate/
2020-04-06 16:29:33 +02:00
```
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
2020-08-05 00:00:29 +02:00
$ npm run develop
2020-04-06 16:29:33 +02:00
```
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
```
2020-07-18 04:20:36 +02:00
2020-07-24 10:03:17 +02:00
# Docker Support (Experimental)
2020-07-18 04:20:36 +02:00
2020-07-24 10:03:17 +02:00
Install [Docker ](https://www.docker.com/ ) and run:
2020-07-18 04:20:36 +02:00
```console
2020-07-24 10:03:17 +02:00
$ docker build -t kill-the-newsletter .
$ docker run kill-the-newsletter
```
The web server will be running at `http://localhost:8000` and the email server at `smtp://localhost:2525` .
For use in production, start with the example [`Dockerfile` ](Dockerfile ).