naffiq / rocket-tools
RocketFirm tools to jumpstart with development
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Type:project
pkg:composer/naffiq/rocket-tools
Requires
- padraic/phar-updater: ^1.0
- symfony/console: ^3.2
Requires (Dev)
- phpunit/phpunit: ^6.1
README
This little php script helps you generate and manage nginx configuration for your project.
Installation
Via composer
Install this project globally by running
$ composer global require naffiq/rocket-tools
Make sure, that you have your composer's bin directory linked to your PATH environment
variable.
Download PHAR executable
You can get the latest version this utility on releases page.
Just grab rocket-tools.phar and put it to your /usr/local/bin directory (if you're on macOS/Linux) or just any
folder listed in your PATH on Windows.
Usage
Check the version by running
$ rocket-tools --version
Generate nginx configurations
You can create nginx config in sites-available for your Yii2 project (basic for now) by running
$ rocket-tools nginx:generate <server-name> [<config-name>] [<document-root>] [<sites-available>] [<port>] [<fast-cgi-pass>]
This command takes following arguments:
server-nameDomain (server_name) for newly created appconfig-nameFile name for your config file. If not set firstserver-nameis useddocument-rootDocument root for your project. If not set, taken from run directory. default: "CURRENT/RUNNING/DIRECTORY"sites-availablePath of sites-available folder default: "/etc/nginx/sites-available"portListen port. default: 80fast-cgi-passFast CGI pass. default: "unix:/var/run/php7.1-fpm.sock"
You can override defaults by configuring rocket-tools with [config:update](#Configuring RocketTools) command.
Link/unlink nginx sites available
Run this command to link config from sites-available to sites-enabled folder:
$ rocket-tools nginx:link <site-name> [<sites-available>] [<sites-enabled>]
Arguments:
site-nameConfiguration file namesites-availableSites available directory (without .conf) default: "/etc/nginx/sites-available"sites-enabledSites enabled directory default: "/etc/nginx/sites-enabled"
To unlink config run:
$ rocket-tools nginx:unlink <site-name> [<sites-enabled>]
Arguments:
site-nameConfiguration file namesites-enabledSites enabled directory default: "/etc/nginx/sites-enabled"
You can override defaults by configuring rocket-tools with [config:update](#Configuring RocketTools) command.
Configuring RocketTools
To override default configurations run:
$ config:update <config-name> <config-value>
$ config:set <config-name> <config-value>
Arguments:
config-nameConfiguration keyconfig-valueConfiguration value
So in order to override nginx:generate configurations simply take it's argument
(for example sites-available), add nginx- prefix to it and use it as configuration key.
The only exception is fast-cgi-pass, which is related to php-fpm and hand
Example:
$ config:update nginx-sites-available /usr/local/etc/nginx/sites-available
There is also a command for viewing your current configuration:
$ config:get [<config-name>]
Arguments:
config-nameConfiguration key. If not set, displays all config values.
Configuration files
All of the configuration files are stored in $HOME/.rocket-tools/ directory.
If you want to change it, set ROCKET_TOOLS_HOME environment variable to desired path.
Updating RocketTools
If you are using composer run:
$ composer global update naffiq/rocket-tools
Just like composer.phar, rocket-tools.phar file contains self-update command, if
you manually downloaded it from releases page.
Under the hood:
TODO:
- Add default templates for nginx configs (Yii2 advanced, Laravel, Symfony)
- Custom templates for nginx config
- Apache2 config generator
- Automated MySQL DB/User creation
- Automated
.envfile generator - hosts file editor
- All of the steps in one command master
License: MIT
Crafted with ♥