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.
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!
Add this line to your application's Gemfile:
gem 'dockistrano'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dockistrano
To use Dockistrano for your application, two files should be created:
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.
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
Dockistrano provides a range of commands to create containers and run commands in containers:
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.
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
Stops the current container or stops all containers, including the backing services.
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
.
Executes the command in the container, printing the result in the 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.
Prints all running processes on Docker
Cleans unused containers and images from Docker
Prints information about the current container and lists environment variables that are provided to the container when started.
Pulls new versions of containers from the registry