thisendout / cyclops

Docker-powered REPL for scripting and automation
MIT License
9 stars 3 forks source link

cyclops

Circle CI

A docker-backed read-eval-print loop for systems scripting and configuration. Faster than a VM, safer than production, more feedback than a local terminal.

cyclops-demo

cyclops executes commands inside of a docker container and provides immediate feedback. Commit changes to incrementally build a final image or Dockerfile. Quickly roll back if you don't like what you see. When you're done, write out your history to a Dockerfile and/or save the resulting docker container for later.

cyclops is designed to help with:

Getting Started

We're not packaging binaries just yet. You'll need a Go environment setup and then:

$ go get github.com/thisendout/cyclops

Make sure you have a DOCKER_HOST env variable set. docker-machine can help with this part.

$ docker-machine env dev
export DOCKER_TLS_VERIFY=yes
export DOCKER_CERT_PATH=/home/cyclops/.docker/machine/machines/dev
export DOCKER_HOST=tcp://192.168.99.100:2376
$ docker pull ubuntu:trusty

Launch the repl and try some bash commands.

$ cyclops
cyclops> :help
cyclops> :run apt-get update -y
cyclops> :run apt-get install -y tmux
cyclops> :print

Workflows

cyclops aims to be flexible in how you explore and commit changes to your environment.

Entering a command into the cyclops prompt will execute the command without committing the change. Use it for exploration and testing.

cyclops> dpkg -l | grep tmux     # no tmux installed
cyclops> apt-cache search tmux
...
cyclops> apt-get install -y tmux
...
cyclops> dpkg -l | grep tmux     # no tmux installed because apt-get install was ephemeral

:commit commits the change from the previous execution, regardless of exit code.

cyclops> dpkg -l | grep tmux     # no tmux installed
cyclops> apt-cache search tmux
...
cyclops> apt-get install -y tmux
...
cyclops> :commit                 # commit the changes from the previous step
cyclops> dpkg -l | grep tmux     # tmux is now installed

:run auto-commits the change if the command returns with exit 0.

cyclops> dpkg -l | grep tmux     # no tmux installed
cyclops> :run apt-get install -y tmux
...
cyclops> dpkg -l | grep tmux     # tmux is now installed

If a :run returns non-zero but you want to commit it anyway, follow it up with :commit.

When you're done, use :print and :write to get a Dockerfile representing your commit changes. cyclops also prints the container and image ids at every step if you want to use the resulting artifacts directly.

Commands

Output

For each :run executed, cyclops reports:

License

cyclops is released under the MIT License (c) 2015 This End Out, LLC. See LICENSE for the full license text.