{"id":13469428,"url":"https://github.com/pretzelhands/jinx","last_synced_at":"2025-03-26T06:32:12.225Z","repository":{"id":135653068,"uuid":"164344107","full_name":"pretzelhands/jinx","owner":"pretzelhands","description":"✨jinx - a magical nginx wrapper","archived":false,"fork":false,"pushed_at":"2020-02-29T09:49:28.000Z","size":47,"stargazers_count":219,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-20T09:54:08.840Z","etag":null,"topics":["devops","nginx","productivity","shell"],"latest_commit_sha":null,"homepage":"https://pretzelhands.com/posts/jinx","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pretzelhands.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-06T20:47:06.000Z","updated_at":"2025-01-18T10:25:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5e9ae50-e1f3-44f6-a01d-bc94d672eb21","html_url":"https://github.com/pretzelhands/jinx","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pretzelhands%2Fjinx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pretzelhands%2Fjinx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pretzelhands%2Fjinx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pretzelhands%2Fjinx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pretzelhands","download_url":"https://codeload.github.com/pretzelhands/jinx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245604177,"owners_count":20642957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","nginx","productivity","shell"],"created_at":"2024-07-31T15:01:39.469Z","updated_at":"2025-03-26T06:32:10.339Z","avatar_url":"https://github.com/pretzelhands.png","language":"Shell","readme":"\u003cp align=\"center\"\u003e\n\u003cimg alt=\"jinx - a magical nginx wrapper\" src=\"https://pretzelhands.com/assets/jinx/jinx-logo-full.png\" width=\"560\"\u003e\n\u003c/p\u003e\n\n---\n\njinx is a wrapper script for nginx written entirely in Bash. It helps you manage your sites and configurations in a more streamlined way than working with plain shell commands.\n\n---\n\n#### Table of Contents\n\n* [Prerequisites](#prerequisites)\n* [Installation](#installation)\n* [Updating](#updating)\n* [Deinstallation](#deinstallation)\n* [Configuring `jinx`](#configuring-jinx)\n    * [Setting options](#setting-options-via-jinx)\n    * [Getting options](#reading-the-value-of-options-with-via-jinx)\n    * [Available options](#available-options)\n* [Using the commands](#using-the-commands)\n    * [`jinx start|restart|stop`](#jinx-startrestartstop)\n    * [`jinx logs`](#jinx-logs)\n    * `jinx site`\n        * [`jinx site activate`](#jinx-site-activate)\n        * [`jinx site deactivate`](#jinx-site-deactivate)\n        * [`jinx site delete`](#jinx-site-delete)\n        * [`jinx site create`](#jinx-site-create)\n        * [`jinx site edit`](#jinx-site-edit)\n* [Templating](#templating)\n    * [Naming of templates](#naming-of-templates)\n    * [Default template](#default-template)\n    * [Replacement variables](#replacement-variables)\n* [Miscellaneous](#miscellaneous)\n* [Contributors](#contributors)\n\n---\n\n## Prerequisites\n\nSince this is an early release of jinx, it still has some assumptions about your enviroment. Currently these are as follows:\n\n* **Your sites are organized in two folders: `sites-available` and `sites-enabled`**: The former one holding all available sites you could potentially host and the latter holding the sites that are reachable on the web.\n\n## Installation\n\nInstallation of jinx can be done in one line using the convenient installer script. Just copy and paste this into your terminal and you'll be all set!\n\n```\nbash \u003c(curl -s https://raw.githubusercontent.com/pretzelhands/jinx/master/installer)\n```\n\nIf you don't trust using `curl` with remote scripts, you can [inspect the script](https://github.com/pretzelhands/jinx/blob/master/installer) and execute the steps manually.\n\n## Updating\n\njinx will occasionally (once a day) check if a new version is available in this repository. Should this be the case you will receive a little notice on top of the other commands.\n\nIf you're ever unsure which version of `jinx` you're running you can check with `jinx version`.\n\nYou need only run `jinx update` and the tool will handle the rest!\n\n## Deinstallation\n\n\u003csmall\u003eYou should probably skip this chapter. 😁\u003c/small\u003e\n\nShould you ever wish to uninstall `jinx`, you can do so with `jinx uninstall`.\nYou will be asked if you're really sure that this is what you wanted. To complete\ndeinstallation run `jinx uninstall -y`\n\n## Configuring `jinx`\n\n`jinx` has a few configuration options that you should be aware of. When you run `jinx` for the first time it will automatically create a `.jinx/config` in your home directory and display a notice that this has happened. This configuration file contains some basic configuration to make everything run smoothly.\n\nA first run looks approximately like this:\n\n```\n$ jinx start\nFirst run! Creating default configuration in ~/.jinx/config\nPardon the interruption, we will now continue running your command.\n\nSuccess. Started nginx service on your system.\n```\n\n### Setting options via `jinx`\n\nThis is the recommended way of setting options, because it will automatically format them correctly for later use.\nTo set an option with `jinx`, you need only write `jinx config \u003coption\u003e \u003cvalue\u003e` and `jinx` will handle the rest\n\n```\n$ jinx config nginx_path /etc/nginx/\nSuccess. Updated setting 'nginx_path' to '/etc/nginx/'.\n```\n\n### Setting options manually\n\nYou can do this if you want to see exactly how everything is set up. Open up `~/.jinx/config` in your favorite editor and off you go. The configuration file is arranged as a set of key-value pairs separated by an equals sign.\n\nThere are a few options you can set. You can find detailed descriptions down below.\n\n### Reading the value of options with via `jinx`\n\nIf you only provide an option key to `jinx` it will spit out the value that this option is currently set to.\n```\n$ jinx config nginx_path\n/etc/nginx/\n```\nThis can be useful if you want to do a quick check or if you want to use the value in your own script.\n\n### Available options\n\n* **nginx_path:** The root directory of your nginx installation.    \n  This is where your `nginx.conf` and `sites-available`/`sites-enabled` directories should reside. \n  \n* **config_path:** This is where `jinx` looks for configuration templates.\n  It is a subdirectory of `nginx_path`. By default this directory is set to `templates` which means `jinx` will look for\n  templates in `/etc/nginx/templates`.\n  \n* **editor:** This is the editor used to open your configuration files when you use `jinx site edit`.\n  You can use any editor you like (e.g. `emacs` or `vim`). I defaulted to nano, because it is the easiest for newcomers.\n\n* **grumpy:** This option can be used to determine whether you want colored output or not. \n  If you set `grumpy` to `1` the console output will not be colored. By default it is set to 0.\n\n## Using the commands\n\nTo see all commands offered by `jinx`, you can run `jinx help` and it will give you a nicely formatted list:\n```\n$ jinx help\n\nAvailable commands:\n\nconfig \u003ckey\u003e                             get config value from ~/.jinx/config\nconfig \u003ckey\u003e \u003cvalue\u003e                     set config value in ~/.jinx/config\n\nsite activate \u003cname\u003e [--restart|-r]      activate a site\nsite deactivate \u003cname\u003e [--restart|-r]    deactivate a site\nsite delete \u003cname\u003e [--yes|-y]            delete a site\nsite create \u003cname\u003e [\u003ctemplate\u003e]          create a site from template\nsite edit \u003cname\u003e                         edit a site .conf file with editor\n\nstart                                    start nginx service\nrestart                                  restart nginx service\nstop                                     stop nginx service\nlogs                                     get nginx error logs\n\nversion                                  output jinx version number\nupdate                                   update to latest version\nuninstall                                uninstall jinx (aw!)\n```\n\n### `jinx start|restart|stop`\n\nDoes as it says. These commands start, restart or stop your nginx server.\n\n### `jinx logs`\n\nOpens up what it determines to be the nginx error logs you have configured. For this it examines the `error_log` \ndirective in your `nginx.conf`\n\n### `jinx site activate`\n\nThis links the site you pass in from `sites-available` to `sites-enabled`, thus making it available on the web. The name of the site corresponds to the name of the configuration file. So if you have a configuration file called `/etc/nginx/sites-available/pretzelhands.com.conf` then the site name will be `pretzelhands.com` and you can activate it like so:\n\n```\n$ jinx site activate pretzelhands.com\nSuccess. Activated site 'pretzelhands.com'.\n```\n\nYou can also add the `-r` or `--restart` flag to automatically restart nginx after the activation\n\n```\n$ jinx site activate pretzelhands.com --restart\nSuccess. Activated site 'pretzelhands.com'.\nSuccess. Restarted nginx service on your system.\n```\n\n### `jinx site deactivate`\n\nThis deactivates any active site you have. The naming conventions work the same as for `jinx site activate`. And you can also pass in the same `-r` or `--restart` flag.\n\n\n#### Simple\n```\n$ jinx site deactivate pretzelhands.com\nSuccess. Deactivated site 'pretzelhands.com'.\n```\n\n#### With restart\n```\n$ jinx site deactivate pretzelhands.com --restart\nSuccess. Deactivated site 'pretzelhands.com'.\nSuccess. Restarted nginx service on your system.\n```\n\n### `jinx site delete`\n\nThis deletes any inactive site you have. Before deleting you will however be prompted if you really wish to delete your site.\nYou may also not delete any currently active site, to prevent unexpected breaking of your websites.\n\nWhen prompted if you wish to delete your site accepted values are `y` and `yes`. Note that any site you delete will be **remove permanently**. Be cautious and double check!\n\n#### Deleting a site\n```\n$ jinx site delete pretzelhands.com\nCareful: Are you sure you want to delete site 'pretzelhands.com'? (y/N): y\nSuccess. Site 'pretzelhands.com' was deleted.\n```\n\n#### Skipping the confirmation\n\nYou can also skip the confirmation by passing either `-y` or `--yes` to the command.\nUse this with caution!\n\n```\n$ jinx site delete pretzelhands.com --yes\nSuccess. Site 'pretzelhands.com' was deleted.\n```\n\n### `jinx site create`\n\nThis will create a new site based on a template of your choice and move it to your `sites-available` directory so you can immediately activate it. To find out how the template system works, please [refer to the section Templating](#templating) further below.\n\nNote that the same name cannot be used twice and `jinx` will throw an error if you try to do so.\n\n#### Creating a new site with default template\n```\n$ jinx site create my-awesome-website.com\nSuccess. Site 'my-awesome-website.com' was created and can now be activated.\n```\n\n#### Creating a new site from a different configuration template\n```\n$ jinx site create my-awesome-php-website.com php\nSuccess. Site 'my-awesome-php-website.com' was created and can now be activated.\n```\n\n### `jinx site edit`\n\nThis will open up the chosen site configuration in the text editor of your choice. By default `nano` is used, but as described in [\"Available Options\"](#available-options) you can set this to any text editor of your liking.\n\n## Templating\n\nThis first version of `jinx` offers some very limited templating functionality to make creating sites as frictionless as possible. By default `jinx` will look for templates in the `templates` subdirectory of your `nginx` folder (e.g. `/etc/nginx/templates`.) This can be changed by [adjusting the `config_path` setting of `jinx`](#available-options).\n\n### Naming of templates\n\nThe name of the template is decided by the file name of it. (e.g. a file `/etc/nginx/templates/php.conf` can be used by invoking the following command\n\n```\n$ jinx site create mysite.com php\n```\n\n### Default template\n\nIf no special template is passed to `jinx` (`jinx site create mysite.com`), it will look for a default template in `/etc/nginx/templates/default.conf`, or in whichever folder you have specified for configuration templates.\n\n### Replacement variables\n\nAll configuration templates are essentially normal nginx configuration files, with the exception that you can use `___` (that's three underscores) as a replacement variable. This will be replaced by the site name you pass to `jinx site create` \n\nHere is an example of my `default.conf`\n```nginx\nserver {\n    listen 80;\n    listen [::]:80;\n    listen 443 ssl http2;\n\n    include snippets/use-https.conf;\n    include snippets/use-non-www.conf;\n    include snippets/use-ssl.conf;\n    include snippets/use-react.conf;\n\n    server_name ___ www.___;\n\n    root /var/www/live/___;\n    index index.html index.htm;\n}\n```\n\nWhen I run `jinx site create mysite.com` the resulting `mysite.com.conf` will look as such\n```nginx\nserver {\n    listen 80;\n    listen [::]:80;\n    listen 443 ssl http2;\n\n    include snippets/use-https.conf;\n    include snippets/use-non-www.conf;\n    include snippets/use-ssl.conf;\n    include snippets/use-react.conf;\n\n    server_name mysite.com www.mysite.com;\n\n    root /var/www/live/mysite.com;\n    index index.html index.htm;\n}\n```\n\n## Miscellaneous\n\nThis is for common questions and other quips I want to add but that didn't fit in anywhere.\n\n#### Is this usable in production?\nI personally use it to run all the ~25 virtual hosts for my freelance business and it has been doing its job well so far. I would still recommend you try it out in a local environment first, though. See how you like it and if you think it's good, put it on your server.\n\n#### What's with the name? Isn't nginx pronounced \"engine-x\"?\nI'm so glad you asked! And you are indeed correct that the proper pronounciation of \"nginx\" is \"engine-x\". However before many, many people told me so, I used to consistently pronounce it as \"En-jinx\". So I just threw out the \"En\" and kept the rest. Hence, `jinx`!\n\n## Like this project? Support it!\n\nIf you like this project and want to help me out, you can go and [buy me a coffee!](https://paypal.me/pretzelhands/5EUR)\nIn case that is not an option you can also help me by sharing this project with your friends and [following me on Twitter](https://twitter.com/_pretzelhands)\n\n## Contributors\n\n* **[Richard 'pretzelhands' Blechinger](https://twitter.com/_pretzelhands)** (Creator/maintainer)\n* **[Vladislav 'click0' Prodan](https://github.com/click0)**","funding_links":["https://paypal.me/pretzelhands/5EUR"],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpretzelhands%2Fjinx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpretzelhands%2Fjinx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpretzelhands%2Fjinx/lists"}