Skip to content

Commit 607a253

Browse files
committed
Add deployment docs
1 parent 66f7fb0 commit 607a253

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ With less than 50 lines of code this service is the smallest analytics you'll ev
1919
2. `npm install` to install the dependencies.
2020
3. `npm start` to start the service.
2121

22-
And that's it! 🎉
22+
And that's it! 🎉 (see [`deployment.md`](./deployment.md) for deployment instructions)
2323

2424
### Tracking views
2525

deployment.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Deployment
2+
3+
Deploying this service is a short two step process. This assumes you already have a server with an OS of your choice that runs Node setup, if not refer to the [acquiring a server](#acquiring-a-server) section.
4+
5+
1. Upload the files of the service to your server and start the service
6+
2. Setup `nginx` as a reverse proxy to make your service publicy accessible
7+
8+
This is what my `nginx` conf looks like in `/etc/nginx/sites-available/default`:
9+
10+
```nginx
11+
server {
12+
listen 80;
13+
server_name yourserver.com;
14+
15+
location ~^.*$ {
16+
proxy_set_header X-Real-IP $remote_addr;
17+
proxy_set_header X-Forwarded-For $remote_addr;
18+
proxy_set_header Host $host;
19+
proxy_pass http://localhost:3000;
20+
}
21+
}
22+
```
23+
24+
(note that I have no idea what I'm doing here, this was copied from [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache))
25+
26+
## Acquiring a server
27+
28+
If you don't have a server to deploy this on just yet, here is what I do:
29+
30+
I use and like [DigitalOcean](https://m.do.co/c/d371ed7f99af) (referral link) for my servers. A simple, 5$/month droplet will suffice to run this service reliably. (upgrading to more power in case of big traffic is two clicks away too)
31+
32+
Make sure to choose the `NodeJS x.x.x on 16.04` (where `x.x.x` is the highest version number you can find) one-click app when creating the droplet to get the server fully setup with Node and Ubuntu.

0 commit comments

Comments
 (0)