Skip to main content

2.2 Shortcut

Heroku Deployment

Click the below button. Seriously.

Deploy

After you're done deploying, visit the dashboard at $YOURAPPNAME.herokuapp.com/app

This is a basic 12-factor node app, so you could also just run it on your server directly with pm2. If you're hosting on your own environment, take care to configure the Redis and Postgres URLs correctly.

Updating Heroku Source For the Server

In your clone of this repo, run:

heroku git:remote -a $YOURAPPNAME
git fetch origin vX.Y.Z
git push heroku master

Docker-Compose Deployment

Please see here for a simple docker-compose.yml that you can use to run the Blink server (and its dependencies).

CDN & Analytics

You actually don't need analytics to use Blink; if you want to use Blink just to shorten links for yourself, you can stop right here.

If you want to a. cache Blink's shortened links, or b. get an insight into your links' traffic (e.g. who's clicking, how many clicks there were in the past week, etc), you can put a simple CDN on top of Blink, and use the CDN's built-in analytics to track your link's traffic.

See https://www.pingdom.com/blog/a-beginners-guide-to-using-cdns-2/ for an example of how to use a CDN to cache contents of the Blink server.

TL;DR: point the domain of your choosing (e.g. https://bit.ly) to the URL of the server or its load-balanced endpoint (e.g. https://blink-server.herokuapp.com).

caution

Not all CDNs cache HTTP responses. For example, CloudFlare doesn't cache redirect responses (which is what Blink's entire architecture is built around) without enabling "Cache Everything" for Blink's domain/subdomain, which, unfortunately, uses up a Page Rule.

Using the CDN's Built-in Analytics

Once you point a CDN to the Blink server, every request after the first one will be served by the CDN instead. This means the CDN has full information about every request to a shortened link, so you can use the CDN's built-in analytics (if the CDN supports it) to gain insight into the nature of the requests.

See https://developers.cloudflare.com/analytics/web-analytics/understanding-web-analytics for an example of what analytics are available and how to use it (most CDNs expose some built-in request analytics).