-
Notifications
You must be signed in to change notification settings - Fork 180
Description
I think it would be very nice to be able to change the default working directory for a network.
Most of my experiments/mini-projects run on one server (that is running docker containers). I have one user that i SSH with to manage all these projects. Each project is in a directory in that users home directory.
Take a look at this example:
networks:
local:
hosts:
- localhost
commands:
chdir:
run: cd /tmp && pwd
echo-dir:
run: pwd
echo-date:
run: pwd && date
targets:
all:
- chdir
- echo-dir
- echo-date
Imagine I had some real commands there instead. Every time a command is run, it is done in a new session. Me changing the directory in the chdir command doesn't affect the other commands. It makes sense and I think it would be a bit chaotic if it wasn't like that. I'm not proposing to change that.
The fact is that the Sup files become messy though. I have to prefix every single command with cd /my/directory; .... And even worse, it breaks my local environment. I don't use the same directory structure there...
What I propose it this:
networks:
local:
hosts:
- localhost
workdir: /my/local/directory
production:
hosts:
- api1.example.com
- api2.example.com
workdir: /my/production/directoryYou specify working directory for each network. It is optional. If it is not specified, the behavior would continue to be exactly what it is today. Before sup runs each command it would change the directory to what is specified in workdir, if it exists.
It would help clean up my Supfile and it would make me possible to deploy to both localhost and production with the same file.
I would like to make this change. I'm willing to write the code, tests, documentation etc.
I just wanted to vent it here first, just to make sure I was proposing something that was already being worked on, was not wanted or if there are better solutions.
Let me know what you think!