Tackle is a local development tool for multiple Docker Compose projects interconnected via Service Discovery mechanism. Host machine and containers use Consul Docker container as DNS resolver and Service Discovery agent. Registrator is used to register docker containers to Consul. Docker and Docker Compose are installed during installation steps.
- Install Ansible.
- Install bundle if not already
gem install bundle
- run in the project's folder
bundle install
- run in the project's folder
./tackle install
it will run Ansible's script to install Docker and Docker Compose.
- Adds default options for new Docker's container (sets Consul as DNS for container). Containers should see each other using container name.
- Adds Consul DNS for host machine
- Creates Consul container
- Creates Registrator container
- Parses tackle.yml and runs
docker-compose up -d
ordocker-compose stop
for each project.
help
- Show short helpup [PROJECT]
- Runs Consul, Registrator and Docker Compose for projects in tackle.ymldown [PROJECT]
- Stops Consul, Registrator and Docker Compose for projects in tackle.ymldown [PROJECT]
- Runs down and up commands for projects in tackle.ymlsetup [PROJECT]
- Run setup steps for projects in tackle.ymlinstall
- Install Docker and Docker Composelist
- lists active projectson [PROJECT]
- activate a projectoff [PROJECT]
- deactivate a project
Example ./tackle up
Consul UI is available at http://localhost:8500/ui/#/dc1/services
project1:
root: /var/www/project1
setup:
- docker-compose run web bundle install
- docker-compose run web rake db:create db:migrate db:seed
project2:
root: /var/www/project2
active: false
- Ruby
- Ansible
When running any container via docker, which exposes port, it will be registered in Consul.
You can access it via container_name.service
.
To give your service a name you can follow the next example in docker-compose.yml
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
environment:
RAILS_ENV: development
SERVICE_NAME: myservicename
Note that SERVICE_NAME
should be alphanumerical and dash. No underscore or dots are allowed by DNS parser.
Many thanks to IFTTT/dash for mac version code inspiration.