louisgab / devilbox-cli Goto Github PK
View Code? Open in Web Editor NEWA minimal cli tool to interact with devilbox from anywhere
License: MIT License
A minimal cli tool to interact with devilbox from anywhere
License: MIT License
this line in get_current_choice function is not valid for:
mariadb-*
percona-*
current=$(grep -Eo "^$config+[.[:digit:]]*" "$ENV_FILE" | sed "s/.*$config//g")
I'm finding this very useful but I've recently decided to add some additional services outside of the aforementioned list and I'm not finding a way to quickly start / stop these containers using this CLI.
After reviewing everything it looks like that's because these services are hardcoded into the run
command.
I've taken a stab at rewriting the command to accommodate my requirement but I'm not super familiar with bash and ended up doing something kind of hacky to get it working to my liking.
My desire would be to be able to either specify which services I'd like to run via run
and stop
when calling the command, for example devilbox run -s http mysql php mailhog
, or, alternatively, and what I've come up with, is to specify default services via a variable which will be used in favor of the currently hardcoded list if it exists. This would allow the existing default behavior to start my additional container if I decide I want an additional container. For example:
EXPORT DEVILBOX_SERVICES="php mysql httpd mailhog
When I run devilbox run
it should start all of these services.
Here's the modifications I made to the compiled distribution script to make this latter option possible:
get_default_services() {
if [ -n "$DEVILBOX_SERVICES" ]; then
printf %s "${DEVILBOX_SERVICES}"
else
printf %s "httpd php mysql"
fi
}
run_containers () {
docker-compose up $(get_default_services)
}
run_containers_silent () {
docker-compose up -d $(get_default_services)
}
If this seems like an acceptable solution I'd be happy to convert this into a useable PR and submit it for you.
Thanks,
Yes I know we should use at our own risk so just alerting to the fact that you can't do "devilbox e" in windows as it complains about winpty, and with winpty prefixed, it gives an error.
I wrote a simple bash command to restart devilbox via the cli, devilbox stop && devilbox run -s
. In the last week I've found myself regularly running this command.
If it seems generally useful I added a new command to the devilbox-cli to enable this in a single command:
devilbox restart # Stop and restart containers.
devilbox restart -s # Stop and restart containers silently.
I've already committed the command to my fork and if it feels useful I'll submit it as a PR instead of working off my fork locally.
Here's the diff if you're interested: https://github.com/louisgab/devilbox-cli/compare/master...gocodebox:feature/restart-command?expand=1
However I accidentally committed after submitting #4 and I don't feel like rewriting history on my fork to get a clean diff without the changes made to #4
Thanks! This is a great tool and I just want to make it a little better for my personal needs
Hi,
It seems that devilbox run
behaves like docker-compose up
. Is it possible to change it to make it detached? As of docker-compose up -d
I am not fan of installing node and npm in my local system, that's why I use Devilbox.
Could you provide instructions for manual installation ?
Thank you in advance.
Hello,
My suggestion, is to add a new command to handle other services/containers that we could add in docker-compose.overrride.yml
easily.
We have to fix a coding standard to make it possible.
As introduced in devilbox project itself there is a compose/
folder with lot of docker-compose.overrride.yml-*
files
Here are what my draft version is able to do :
dist/devilbox-cli.sh compose --containers
will give the current stack containers : see DEVILBOX_CONTAINERS
env var already available
i.e: with defaults containers
dist/devilbox-cli.sh compose --containers
[!] Stack Containers ready:
httpd
php
mysql
Now, if I want to launch httpd, php, mysql
(default containers) plus mailhog
, we have to run
dist/devilbox-cli.sh compose --containers=mailhog
And the four containers will be launch
When there are many others containers, we just have to enclose list in double quote like this
dist/devilbox-cli.sh compose --containers="mailhog portainer"
Hope you will like this new feature. Waiting your feedback to propose a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.