Releasing jinx - a magical wrapper around nginx
Tags: productivity, nginx, showdev, githunt
Published: 2019-01-07 19:46:23

---
title: Releasing jinx - a magical wrapper around nginx
description: A new tool that helps streamline your interactions with nginx
canonical_url: https://pretzelhands.com/posts/jinx
preview_image: https://pretzelhands.com/assets/jinx/jinx-logo-dev-to.png
published: true
tags: productivity, nginx, showdev, githunt
---

> This post was originally published on [my personal blog](https://pretzelhands.com/posts/jinx).

I am super excited about this post because I made a thing! Yes, I actually made a thing with my own two hands and now I'm releasing it! I present to you: **jinx**

As background story, I very recently [killed my entire server infrastructure](https://pretzelhands.com/posts/bringing-your-entire-infrastructure-down) by accidentally generating way too many Let's Encrypt accounts in a very short timeframe. It was super funny and I spent the better part of my Saturday getting everything back up on a backup nginx setup.

As part of that I quickly noticed a very repetitive pattern to setting up my virtual hosts. It went a little something like this for every site

```bash
# create a new site
cp \
    /etc/nginx/configurations/php.conf \
    /etc/nginx/sites-available/pretzelhands.com.conf

# change the host name to the new site name
nano /etc/nginx/sites-available/pretzelhands.com.conf  

# activate the site in nginx
ln -s \
    /etc/nginx/sites-available/pretzelhands.com.conf \
    /etc/nginx/sites-enabled

# restart to publish newly activated sites
systemctl restart nginx
```

Using `^R` was a bit faster but still incredibly tedious. That's 4 different commands and I have to enter the same or a similar path a whopping four times. That just didn't feel good and so I remembered how much I wrote about shell-scripting
recently and decided to make use of it to create **jinx**.

With it this same process now looks like this.

```bash
# create a new site and insert hostname in template file
jinx site create pretzelhands.com php

# activate the site and restart
jinx site activate pretzelhands.com -r
```

From four long, repetitive commands to two quite short ones. What a nice improvement. And it only cost me my Sunday afternoon.

The initial development effort may have been higher than setting the sites up manually but I'm still glad I did it because it was fun to do and I can reuse it all the time. Every time I create a new virtual host, this tool probably saves me some 2-3 minutes of repetitive typing.

There's also a few other features, but you can [read up on everything in the documentation](https://github.com/pretzelhands/jinx/blob/master/README.md).

I freely admit that this is probably my single most useful side-project to date. Also it got the approval of [Pieter Levels](https://twitter.com/levelsio) so I guess that counts for something!

{% github pretzelhands/jinx %}

I hope you get as much joy and and practical use out of this tool as I do and I'll be trying to extend it with some more useful features such as activating HTTPS and building configurations from included snippets. We'll see how far I can take it!

Enjoy!~