terra-ops / terra-cli

The Terra Command Line Interface
http://terra.readthedocs.org
GNU General Public License v2.0
48 stars 17 forks source link

Using terra with an existing docker-config file / dsh #96

Open frankcarey opened 9 years ago

frankcarey commented 9 years ago

We've been working with the binkreaction/FFW drude setup with much success. The gist of that is a docker-compose.yml file plus a script they call "dsh" that just abstracts docker-compose run calls. It would be nice if terra supported reusing an existing docker-compose.yml file as it's base template if it exists in a repo, then overriding it based on the .terra.tml file.

You can see an example repo here: https://github.com/devinci-code/local-docker-dev

At first, I tried to just copy the docker-compose into the .terrra.yml as @jonpugh described like so:

docker_compose:
  overrides:
# Web node
    app:
      hostname: web
      image: blinkreaction/drupal-apache-php:2.2-5.5
      environment:
        - ENVIRONMENT=docker
        # Use IP based mapping when working with multiple projects. See docs (^^) for more details.
        #- 192.168.10.10:80:80
        #- 192.168.10.10:443:443
      volumes:
        # PHP configuration overrides
        #- "./.docker/etc/php5/php.ini:/etc/php5/fpm/conf.d/z_php.ini"
        # Project root folder mapping
        #- &project_root ".:/var/www"
      links:
        - database
        # Uncomment this and the memcached service definition below to start using memcached.
        - memcached
        - solr

# DB node
    database:
      hostname: db
      image: blinkreaction/mysql:5.5
      ports:
        - ":3306"
        # Use IP based mapping when working with multiple projects. See docs (^^) for more details.
        #- 192.168.10.10:3306:3306
      # DB configuration
      environment:
        - MYSQL_ROOT_PASSWORD=admin123
        - MYSQL_USER=drupal
        - MYSQL_PASSWORD=123
        - MYSQL_DATABASE=drupal
      volumes:
         # MySQL configuration overrides
         - "./.docker/etc/mysql/my.cnf:/etc/mysql/conf.d/z_my.cnf"
         # Permanent DB data storage
         - /var/lib/mysql

# CLI node
# Used for all console commands and tools.
    cli:
      hostname: cli
      image: devinci/drupal-cli
      environment:
        - XDEBUG_CONFIG=idekey=cli
        - ENVIRONMENT=docker
      volumes:
        # PHP configuration overrides
        #- "./.docker/etc/php5/php-cli.ini:/etc/php5/cli/conf.d/z_php.ini"
        # Project root folder mapping
        #- *project_root
        # Host SSH keys mapping. Uncomment one of the lines below based on your setup.
        - /.ssh:/.ssh   # boot2docker-vagrant
        #- ~/.ssh:/.ssh  # Linux
      links:
        - db
        - web
        # Uncomment this and the browser service definition below to start using selenium2.
        - browser
        - memcached
        - solr

# Memcached node
# Uncomment the service definition section below and the link in the web service above to start using memcached.
    memcached:
      hostname: memcached
      image: memcached
      environment:
        # Memcached memory limit in megabytes
        - MEMCACHED_MEMORY_LIMIT=128

# ngrok node
# Uncomment the service definition section below to start using ngrok for sharing your local web server with the world.
# share:
#   hostname: share
#   image: fnichol/ngrok
#   ports:
#     - "4040:4040"
#     # Use IP based mapping when working with multiple projects. See docs (^^) for more details.
#     #- 192.168.10.10:4040:4040
#   links:
#     - web:http

# selenium2 node
# Uncomment the service definition section below and the link in the web service above to start using selenium2 driver for Behat tests requiring JS support.
    browser:
      hostname: browser
      image: selenium/standalone-chrome
      links:
        - web
      ports:
        - "4444:4444"

    solr:
      hostname: solr
      image: blinkreaction/drupal-solr:3.x
      ports:
        - "8983:8983"
    volumes:
      - "./.docker/etc/solr/3.x:/var/lib/solr/conf"

But one issue is our container names are not consistent with what terra expects (db vs database, web vs app) We somewhat resolved that using alternate HOSTNAMEs so the code expecting those hostnames still work, but it would be good if terra adapted itself to the docker-compose.yml instead of the other way around.

Second, was when we tried to install the site with terra it failed.. not recalling how exactly , but I'll test it soon and report back with more details.

frankcarey commented 9 years ago

Related ticket from before the docker_compose option was added: https://github.com/terra-ops/terra-cli/issues/21