Giter Club home page Giter Club logo

plis's Introduction

Code Climate Test Coverage Issue Count Made with Love by Icalia Labs

Plis

Helps your development process with Docker Compose by asking nicely :)

Install

On macOS, install it via Homebrew:

brew tap icalialabs/formulae
brew install plis

On other systems you can:

  • Download the executable for your system from the Releases Page
  • Place it on any of the paths reachable in $PATH

Special behaviors:

  • plis start [services-optional]: Starts a docker-compose project, with the following extra functionality:
    • If some or all of the requested project's containers are missing, issues a docker-compose up -d command.
    • If all of the requested project's containers are present, issues a docker-compose start command.
  • plis attach [service_name]: It figures out the given service's container, and attaches the console to it.
  • plis run [service_name] [command]: It runs the given command:
    • If there's a running container for the given service, it executes it issuing a docker exec -ti command.
    • If there are no running containers for the given service, it executes it issuing a docker-compose run --rm command.
# Start a docker-compose project:
plis start

# Restart a service:
plis restart web

# Attach the console to a service:
plis attach web

# Run a command on an existing or new container:
plis run web rails c

# Stop a service:
plis stop web

TODO's:

  • build command to invoke the docker-compose build command.
  • Split up the big plis.go file.
  • check context command to list the files that will pass to the Docker build context.
  • start command with just one service should attach to the container immediately. (i.e.: plis start web starts a rails web container and attaches to it, mimicking the behavior of running rails server on the host)
  • Change the run command to use docker-compose exec instead of docker exec whenever a running container is already available.
  • Copy (from existing templates/examples) or generate blank dotenv files referenced in the Compose file.
  • Install Docker (for Mac/Windows or native for Linux) if it is missing.
  • Make plis start github.com/some_org/some_dockerized_app clone the project and run it.
  • upgrade command that upgrades plis to the newest version.
  • prune command to invoke docker system prune.

plis's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plis's Issues

Plis Attach Regex

When you have a services with similar name, 'plis' match with the first coincidence.
Example

service:
    api_web:
   
    web:

If you want attach the 'web' service, you should run
plis attach web
but, 'plis' match with 'api_web' service

Oftentimes `attach` doesn't find the container.

$ plis start web && plis attach web
docker-compose up -d web
back-end-3_postgres_1 is up-to-date
Creating back-end-3_web_1 ... done
No container running for service web

however

$ docker ps                                                                                                                                                                   
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS                    NAMES
f13c0b362934       back_end:development   "/usr/src/bin/entryp…"   53 seconds ago      Up 53 seconds       0.0.0.0:3000->3000/tcp   back-end-3_web_1

I have other projects with pretty much the same docker-compose.yml where this DOES work, so I'm unsure of why it doesn't work in some others...

Should output more meaningful error messages

If Docker is not running on the machine, all you get now is:

Command:
%!(EXTRA string=docker-compose ps -q)Error:
%!(EXTRA *exec.ExitError=exit status 1)%  

Where it should explicitly say something like "It looks like Docker is not running on this machine!"

Send the converted command output to STDERR

Right now, the converted docker command is printed into the STDOUT.

This prevents us from doing something like:

echo "$(plis run web rails secret)" | docker secret create some_secret_base -

We need to output the converted command to the STDERR instead of the STDOUT.

Docker 1.13 compatibility

Somehow the new release changed the displayed output that is used by plis to parse project data when starting and attaching to containers...

Feature Request: Custom Tasks

I like the idea of how npm allows tasks to be defined in the package.json file.

Currently at IcaliaLabs, when we use plis inside a project, the most executed tasks are these:

  • plis run postgres restoredb some_database_name path/to/some/database.dump (Uses a script restoredb to restore a database from a dump file)
  • plis run web rails db:migrate searchkick:reindex:all another:rake:task (Runs a bunch of rake tasks in a rails project)
  • plis build service_a service_b service_c (Re-builds the dockerfiles referenced by the compose project)

Maybe we should be able to define these tasks in a file similar to how npm's package.json does.

IMPORTANT Having a config file must not be mandatory.

Would this file be a json? a YML?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.