Dockistrano uses docker to create a development and testing environment for applications. It is inspired by Capistrano, because booting a container should be as easy as doing a cap deploy
. The approach has a lot of conventions and as little as configuration as possible.
Don't forget to have a look at the wiki for more information.
Current status
Dockistrano is actively used for software development at MoneyBird, but is still very immature. Feel free to play around and provide us feedback. A pull request with tested code is the best way to help us improve the software!
Installation
Add this line to your application's Gemfile:
gem 'dockistrano'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dockistrano
Preparing your application
To use Dockistrano for your application, two files should be created:
Dockerfile
The Dockerfile
describes the container that is created for the application and should contain all dependencies. Example:
FROM ubuntu
RUN apt-get update
RUN apt-get install mydependency
ADD ./ ./
EXPOSE 8000
CMD ["webserver", "start"]
For more information about writing Dockerfiles, see the documentation on docker.io.
config/dockistrano.yml
The configuration file contains information about the registry, dependencies, ports and environment variables.
---
registry: my.privateregistry.com:5000
dependencies:
postgresql:
database: "my_databasename"
redis:
environment:
rails_env: development
Usage
Dockistrano provides a range of commands to create containers and run commands in containers:
doc build
Builds the current container by using the Dockerfile
. The resulting container will be tagged with the registry name, name of the image and tag of the current git branch.
When building is successfull, the container will be tested by running the test_command
provided in the config. When tests are successfull, the container is pushes to the registry.
doc start
and doc start-services
Starts the container by running the default command. Environment variables from dependencies are automatically added to the run command. Optionally the backing services can be started seperatly with doc start-services
doc stop
and doc stop-all
Stops the current container or stops all containers, including the backing services.
doc logs [NAME]
Prints logs for the container or for a backing service when a name of the service is provided. When the container is running a docker attach
is used, otherwise a docker logs
.
doc exec COMMAND
Executes the command in the container, printing the result in the console.
doc console [CONSOLE]
Starts a console in the container, by default /bin/bash is started. Optionally a console can be provided, for example doc console rails console
to start a Rails console.
doc ps
Prints all running processes on Docker
doc clean
Cleans unused containers and images from Docker
doc status
Prints information about the current container and lists environment variables that are provided to the container when started.
doc pull
Pulls new versions of containers from the registry