Package: pitcrew
🔧 PitcrewAsyncIO-powered python DSL for running commands locally, on docker, or over ssh.What does Pitcrew do?Pitcrew can run commands$ crew sh date...or over ssh$ crew sh -p providers.ssh -P '{"hosts": ["192.168.0.1"]}' dateon hundreds of hosts!$ crew sh -p providers.ssh -P '{"hosts": ["192.168.0.1-100"]}' dateCrew can also run tasks$ crew run install.homebrewTasks are either other shell commands, or other tasks, for example,
        this provisions Cloudfront, SSL and S3 and builds and deploys docs to pitcrew.io$ crew run examples.deploy_pitcrewYou can list available tasks$ crew list...edit an existing task$ crew edit examples.deploy_pitcrew
            # opens in $EDITORor create a new task!$ crew new some.new.taskInstallationFrom binaryTo install pitcrew in your home directory, run the following:curl -fsSL "https://github.com/joshbuddy/pitcrew/releases/latest/download/crew-$(uname)" > crew
chmod u+x crew
./crew run crew.install --dest="$HOME/crew"From PyPiTo install from the Python Package Index, run the following:pip install pitcrew
crew run crew.install --dest="$HOME/crew"From sourcegit clone https://github.com/joshbuddy/pitcrew
cd pitcrew
python3.6 -m venv env
source env/bin/activate
pip install -e .ConceptsA command or set of commands is called atask. Acontextruns tasks either locally, on docker or over ssh.
Aprovidergenerates contexts.TasksTasks are either composed from other tasks or invoking a command on a shell.An example of ataskmight be reading a file.fs.read(path)reads a file as bytes and returns it:pitcrew/tasks/fs/read.pyimportbase64frompitcrewimporttask@task.arg("path",desc="The file to read",type=str)@task.returns("The bytes of the file")classFsRead(task.BaseTask):"""Read value of path into bytes"""asyncdefrun(self)->bytes:code,out,err=awaitself.sh_with_code(f"cat{self.params.esc_path}")assertcode==0,"exitcode was not zero"returnoutOther tasks might include writing a file, installing xcode or cloning a git repository. All the currently available
tasks are listed atdocs/tasks.md. The api available in a task is available atdocs/api.md#crewtask.ContextsAn example of acontextmight be over ssh, or even locally. Learn more about contexts atdocs/api.md#crewcontext.ProvidersAprovideris a task with a specific return type. The return type is an async iterator which returns contexts.UsageFor detailed usage, seedocs/cli.mdfor more details.Run a commandPitcrew allows running a command usingbin/crew sh -- [shell command].For examplecrew sh ls /will list the "/" directory locally.You can run this across three hosts via ssh usingcrew sh -p providers.ssh -P '{"hosts": ["192.168.0.1", "192.168.0.2", "192.168.0.3"]}' ls /.Run a taskPitcrew allows running a task usingcrew run [task name] <task args>. This will normally target your local machine unless you use the-pflag to select a different provider.See available tasksTo see all the available tasks runcrew list. This will show all available tasks which are stored increw/tasks.Make a new taskTo see all the available tasks runcrew new [task_name]. This will create a template of a new task.Run testsTo run an ad-hoc command use . For tasks usecrew run [task-name] <args>.Get CLI helpTo see the whole list of commands available from the command-line, runcrew help.