devilbox-cli

A simple and conveniant command line to manage devilbox from anywhere

Usage no npm install needed!

<script type="module">
  import devilboxCli from 'https://cdn.skypack.dev/devilbox-cli';
</script>

README

Devilbox CLI

npm npm GitHub file size in bytes GitHub license

A simple and conveniant command line to manage devilbox from anywhere


Getting Started

Requirements

You need Devilbox to be installed somewhere on your computer.

By default, the script will use the path $HOME/.devilbox. If you have cloned devilbox somewhere else, add the following to your profile and change ##PATH_TO_DEVILBOX## accordingly:

export DEVILBOX_PATH="$HOME/##PATH_TO_DEVILBOX##"

Then reload your terminal or run source ~/.zshrc if you use zsh.

Install

As simple as :

npm install -g devilbox-cli

If installed successfully, you should see something like this when you run devilbox -v:

devilbox-cli v0.4.1 (2020-12-06)
A simple and conveniant cli to manage devilbox from anywhere
https://github.com/louisgab/devilbox-cli

Usage

devilbox-cli provides all basic command to manage your installation:

devilbox check   # Check your .env
devilbox config  # Get and set variables on your .env
devilbox enter   # Enter the php container with shell.sh script
devilbox exec    # Execute a command in the container
devilbox mysql   # Execute a command in the container
devilbox open    # Open the devilbox intranet
devilbox run     # Start the containers
devilbox stop    # Stop all containers
devilbox restart # Stop and rerun all containers
devilbox update  # Update to latest devilbox version

To see containers current versions defined in devilbox .env file, use the config command:

devilbox config --apache --php --mysql
# [!] Apache current version is 2.4
# [!] PHP current version is 7.2
# [!] MySql current version is 5.6

It can also list available versions of any container:

devilbox config --mysql=*
# [!] MySql available versions:
# 5.5
# 5.6
# 5.7
# 8.0

And of course, it can change any version:

devilbox config --php=8.0
# [✔] PHP version updated to 8.0

You can also point devilbox to your projects folder:

devilbox config --www=../Documents/Projects/www
# [✔] Projects path config updated to ../Documents/Projects/wwww

And if you dont remember a command, devilbox help is your best friend :)

Optional Configuration

By default, the run command will start the default LAMP stack containers php httpd mysql. The command can be customized by configuring your desired services via the $DEVILBOX_CONTAINERS variable. For example, if you'd like to also run the NOSQL stack, you would define the following:

export DEVILBOX_CONTAINERS="php httpd mysql redis memcd mongo"

Then reload your terminal or run source ~/.zshrc if you use zsh.

Important notes

The script was tested on zsh and bash on linux. Use at your own risk on other platforms.

Contributing

Highly welcomed! The script only implements the basics I needed for myself (LAMP). It may be useful for others to add missing commands, test it on macOS and Windows, and test in on other shells.

License

MIT License