Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.
/ devilbox-cli Public archive

A minimal cli tool to interact with devilbox from anywhere

License

Notifications You must be signed in to change notification settings

louisgab/devilbox-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Alternatives

If you don't have npm or don't wan to use it, you can also download the script directly:

curl -O https://raw.githubusercontent.com/louisgab/devilbox-cli/master/dist/devilbox-cli.sh
chmod +x devilbox-cli.sh
sudo mv devilbox-cli.sh /usr/local/bin/devilbox

This way you can call the script from anywhere, but you won't be able to download updates (that was the point of using npm). For a manual update, delete it first

sudo rm /usr/local/bin/devilbox

Then re-download the script.

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