Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zilionis/dash
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: onnimonni/dash
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Oct 8, 2015

  1. Copy the full SHA
    cde220b View commit details
  2. Copy the full SHA
    b0129b0 View commit details

Commits on Nov 5, 2015

  1. Merge pull request #1 from geerlingguy/ansible-syntax

    Spruce up Ansible syntax for legibility.
    silvamerica committed Nov 5, 2015
    Copy the full SHA
    c18893e View commit details
  2. Copy the full SHA
    686d2a6 View commit details
  3. Copy the full SHA
    f1f674e View commit details
  4. Copy the full SHA
    c4bee9c View commit details
  5. Copy the full SHA
    0c822c0 View commit details
  6. Merge pull request #6 from benjamin-smith/feature/fix-ansible-whitespace

    fix ansible error caused by yml parsing
    silvamerica committed Nov 5, 2015
    Copy the full SHA
    de3dc39 View commit details
  7. Merge pull request #5 from benjamin-smith/feature/machine-command-fix

    update "dev machine" command to allow proxying to alternate machines,…
    silvamerica committed Nov 5, 2015
    Copy the full SHA
    10b7e97 View commit details

Commits on Nov 6, 2015

  1. Copy the full SHA
    d57a6a4 View commit details

Commits on Nov 20, 2015

  1. Set dns options while creating the docker machine

    Remove dns options from bootsync
    manojlds committed Nov 20, 2015
    Copy the full SHA
    42ec563 View commit details

Commits on Dec 1, 2015

  1. Merge pull request #9 from manojlds/better-dns-options

    Set dns options while creating the docker machine
    silvamerica committed Dec 1, 2015
    Copy the full SHA
    6b3921b View commit details
  2. Merge pull request #7 from benjamin-smith/feature/homebrew-formulae-u…

    …pdate
    
    dev update command updates homebrew itself
    silvamerica committed Dec 1, 2015
    Copy the full SHA
    da1ec5d View commit details

Commits on Feb 12, 2016

  1. Copy the full SHA
    4041477 View commit details

Commits on Feb 15, 2016

  1. Fixed bootstrap if ansible is installed and is too old

    Fixed bootstrap script if ansible is already installed but version is too old. 'became' directives are available from ansible version 1.9. I had 1.8.2 so the bootstrap didn't work.
    onnimonni committed Feb 15, 2016
    Copy the full SHA
    acf6921 View commit details
  2. Fixed problems with /etc/exports

    Changed lineinfile method to blockinfile for easier multiline configuration
    This works well but needs ansible version > 2.0
    onnimonni committed Feb 15, 2016
    Copy the full SHA
    8b8db9e View commit details

Commits on Feb 16, 2016

  1. Merge pull request #15 from botimer/master

    Fix fork URL and typo in README.md
    silvamerica committed Feb 16, 2016
    Copy the full SHA
    fb04b7f View commit details
  2. Require at least ansible 2.0 in bootstrap

    Onni Hakala committed Feb 16, 2016
    Copy the full SHA
    0b624a7 View commit details
  3. Merge pull request #17 from onnimonni/patch-1

    Fixed bootstrap if ansible is installed but is too old
    silvamerica committed Feb 16, 2016
    Copy the full SHA
    1acad32 View commit details
  4. Merge pull request #18 from onnimonni/patch-2

    Fixed problems with /etc/exports lineinfile ansible directive
    silvamerica committed Feb 16, 2016
    Copy the full SHA
    5b72cd6 View commit details

Commits on Feb 17, 2016

  1. Use explicit args in 'Create Docker Machine'

    Spencer Elliott committed Feb 17, 2016
    Copy the full SHA
    80d9676 View commit details
  2. Add fish shell support

    Spencer Elliott committed Feb 17, 2016
    Copy the full SHA
    60dc4bb View commit details
  3. Use verbose option for ansible-playbook

    This makes more clear how ansible is modifying your system
    Spencer Elliott committed Feb 17, 2016
    Copy the full SHA
    f194206 View commit details

Commits on Feb 18, 2016

  1. Updated readme about network problems VPN

    I have had plenty of problems related to this. I hope this small description will help others from banging their heads against a wall.
    onnimonni committed Feb 18, 2016
    Copy the full SHA
    73188a4 View commit details
  2. Merge pull request #23 from onnimonni/patch-3

    Updated readme about network problems and VPN errors
    silvamerica committed Feb 18, 2016
    Copy the full SHA
    ac5eb6e View commit details

Commits on Feb 23, 2016

  1. Merge pull request #20 from EventMobi/fish-support

    Add fish shell support
    silvamerica committed Feb 23, 2016
    Copy the full SHA
    7cbd056 View commit details
  2. Merge pull request #22 from EventMobi/ansible-playbook-verbose

    Use verbose option for `ansible-playbook`
    silvamerica committed Feb 23, 2016
    Copy the full SHA
    b8bdaee View commit details
  3. Merge pull request #21 from EventMobi/ansible-docker-machine-args

    Use explicit `args` in 'Create Docker Machine'
    silvamerica committed Feb 23, 2016
    Copy the full SHA
    09d96f8 View commit details

Commits on Feb 25, 2016

  1. Copy the full SHA
    68862bb View commit details
  2. Changed binary to gdev in bootstrap

    Onni Hakala committed Feb 25, 2016
    Copy the full SHA
    20962f9 View commit details

Commits on Feb 26, 2016

  1. Add OS X version check in bootstrap

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    e48c719 View commit details
  2. Copy the full SHA
    5cfd472 View commit details
  3. Changed gdev binary name

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    f5515c5 View commit details
  4. Corrected home directory

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    3f4dd21 View commit details
  5. Corrected home directory

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    e0758bb View commit details
  6. Use sudo for creating dlite machine

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    a02f1ca View commit details
  7. Added mail server to services.yml

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    4da55fe View commit details
  8. Fix dlite machine ip binding

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    13e14d0 View commit details
  9. Fix dns problems

    Onni Hakala committed Feb 26, 2016
    Copy the full SHA
    4715e7e View commit details

Commits on Mar 1, 2016

  1. Added 'gdev status' command

    Onni Hakala committed Mar 1, 2016
    Copy the full SHA
    6e29afd View commit details
  2. Merge branch 'master' of github.com:onnimonni/dash

    Onni Hakala committed Mar 1, 2016
    Copy the full SHA
    556a461 View commit details
  3. Small fixes to gdev

    Onni Hakala committed Mar 1, 2016
    Copy the full SHA
    cd18bf8 View commit details
  4. Copy the full SHA
    2772182 View commit details

Commits on Mar 4, 2016

  1. Bug fixes to bootstrap

    Hopefully after this new installations will go smoothly
    onnimonni committed Mar 4, 2016
    Copy the full SHA
    6de35d6 View commit details

Commits on Mar 7, 2016

  1. Copy the full SHA
    18416fd View commit details
  2. Copy the full SHA
    b667391 View commit details
Showing with 320 additions and 140 deletions.
  1. +23 −3 README.md
  2. +118 −77 ansible/mac.yml
  3. +1 −3 ansible/mac_profile
  4. +2 −0 ansible/mac_profile.fish
  5. +0 −1 ansible/resolver-dev.conf
  6. +7 −0 ansible/resolver-dev.conf.j2
  7. +74 −4 bin/bootstrap
  8. +46 −27 bin/{dev → gdev}
  9. +0 −9 docker/bootsync.sh
  10. +0 −16 docker/dash.yml
  11. +49 −0 docker/services.yml
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

## The tl;dr Version

bash <(curl -fsSL https://raw.githubusercontent.com/IFTTT/dash/master/bin/bootstrap)
bash <(curl -fsSL https://raw.githubusercontent.com/onnimonni/dash/master/bin/bootstrap)
# Start a new shell and cd to a project that uses [Docker Compose](https://docs.docker.com/compose/)
dev up

@@ -20,7 +20,7 @@

**Host** or **host machine** refers to your physical computer.

**Docker Machine**, **virtual machine**, **guest**, **guest machine**, **guest VM**, etc., all refer to the virtual machine that runs the Docker server and Docker contiainers.
**Docker Machine**, **virtual machine**, **guest**, **guest machine**, **guest VM**, etc., all refer to the virtual machine that runs the Docker server and Docker containers.

**Containers** or **Docker containers** refer to the individual services running inside of the virtual machine. Mac OS cannot natively run Docker containers (yet), so they have to be run inside of a VM.

@@ -88,6 +88,26 @@ For NFS shares to work properly after initial setup, you may need to restart the

or just restart your host machine. Usually this is only required once.

#### Network related problems

If you can ssh to docker-machine but can't run `docker-compose`, `docker` or `dev up` it's usually sign of network interface problem.

Dash setup doesn't play well with some VPN providers. For example Cisco anyconnect can cause you plenty of problems. You can also mess networks just by changing to different wifi.

You can fix this by first leaving VPN (if any) and then by following these steps:

```
# Stop and kill dev machine
$ dev machine stop
$ dev machine kill # This triggers new network creation later on
# Remove virtualbox interface, usually vboxnet0
$ VBoxManage hostonlyif remove $(VBoxManage showvminfo dev --machinereadable | grep hostonlyadapter | cut -d '"' -f 2)
# Start dev machine again
$ dev machine start
```

#### Users of Vagrant VMs with NFS shares

Both Docker Machine and Vagrant can use NFS to mount host volumes, however the directory path model for Docker Machine conflicts with Vagrant's. The easiest solution is to reprovision your Vagrant VMs to use the Docker model. Instead of sharing a specific project folder, share the entire /Users path. Your /etc/exports may have looked like:
@@ -112,7 +132,7 @@ Now the entire /Users directory gets shared into the Vagrant VM. You may then ne

## Contributing

1. Fork it ( https://github.com/[my-github-username]/dash/fork )
1. Fork it ( https://github.com/IFTTT/dash/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
195 changes: 118 additions & 77 deletions ansible/mac.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,124 @@
---
- hosts: 127.0.0.1
connection: local
- hosts: 127.0.0.1
connection: local

vars:
dev_env_dir: /usr/local/dev-env
dev_env_dir: /usr/local/gdev-env
gdev_user_files: "{{ansible_env.HOME}}/.gdev"

tasks:

- name: Check Sudo Password
command: ls
become: yes
become_method: sudo

- name: Tap Caskroom
homebrew_tap: tap=caskroom/cask

- name: Install Caskroom
homebrew: name=brew-cask state=latest

- name: Install Virtualbox
homebrew_cask: name=virtualbox state=present
environment:
HOMEBREW_CASK_OPTS: --appdir=/Applications

- name: Install Docker and Extras
homebrew: >
name={{item}}
state=latest
with_items:
- docker
- docker-machine
- docker-compose

- name: Create resolver directory
file: path=/etc/resolver state=directory mode=0755
become: yes
become_method: sudo

- name: Create dev resolver file at /etc/resolver/dev
file: >
src={{dev_env_dir}}/ansible/resolver-dev.conf
dest=/etc/resolver/dev
state=link
force=yes
become: yes
become_method: sudo

- name: Add NFS share to /etc/exports
lineinfile: >
dest=/etc/exports
line="{{item}}"
create=yes
with_items:
- '## Begin Dash Developer Environment ##'
- '\"/Users\" 192.168.99.100 -alldirs -mapall=0:80'
- '## End Dash Developer Environment ##'
become: yes
become_method: sudo
register: exports

- name: Restart nfsd
command: sudo nfsd restart
become: yes
become_method: sudo
when: exports.changed

- name: Add Docker Machine Environment to .zshrc
lineinfile: >
dest=~/.zshrc
line="source {{dev_env_dir}}/ansible/mac_profile"
create=yes
when: ansible_env.SHELL == "/bin/zsh"

- name: Add Docker Machine Environment to .bash_profile
lineinfile: >
dest=~/.bash_profile
line="source {{dev_env_dir}}/ansible/mac_profile"
create=yes
when: ansible_env.SHELL == "/bin/bash"

- name: Create Docker Machine
command: "{{dev_env_dir}}/bin/dev machine create creates=~/.docker/machine/machines/dev/config.json"
- name: Check Sudo Password
command: "echo 'sudo works'"
become: yes
become_method: sudo

- name: Update Homebrew
homebrew: update_homebrew=yes

- name: Install Docker and Extras
homebrew:
name: "{{ item }}"
state: latest
with_items:
- docker
- docker-compose
- dlite

- name: Create resolver directory
file:
path: "{{ansible_env.HOME}}/.dlite"
state: directory
mode: 0755

- name: Create machine
command: "{{ dev_env_dir }}/bin/gdev machine create"
args:
creates: "{{ansible_env.HOME}}/.dlite/config.json"
become: yes
become_method: sudo

- name: Start machine
command: "{{ dev_env_dir }}/bin/gdev machine start"
args:
creates: "{{ansible_env.HOME}}/.dlite/config.json"
become: yes
become_method: sudo

- name: Wait for machine to start
wait_for:
path: "/var/run/docker.sock"
state: present
timeout: 30

- name: Get machine ip address
shell: "{{ dev_env_dir }}/bin/gdev machine ip"
register: machine_ip

- name: "Debug dlite ip"
debug:
msg: "Dlite is up and running: {{ machine_ip.stdout }}"

- name: Start gdev services
command: "{{ dev_env_dir }}/bin/gdev service up"

- name: Wait for signaler to create CA file
wait_for:
path: "{{ gdev_user_files }}/ca/ca.crt"
state: present
timeout: 30


# This only works in OS X and doesn't affect firefox
# We want to use https locally and you only use ca.key which is generated to you
- name: Trust self-generated signaler Root certificate in keychain
shell: "security add-trusted-cert -d -r trustRoot -k '/Library/Keychains/System.keychain' ca.crt"
args:
chdir: "{{ gdev_user_files }}/ca/"
become: yes
become_method: sudo

- name: Create resolver directory
file: path=/etc/resolver state=directory mode=0755
become: yes
become_method: sudo

- name: Delete resolver files to trigger dns change
file:
path: "/etc/resolver/{{item.domain}}"
state: absent
become: yes
become_method: sudo
with_items:
- { ip: "{{ machine_ip.stdout }}", domain: test }

- name: Create dns resolver files at /etc/resolver/
template:
src: "{{ dev_env_dir }}/ansible/resolver-dev.conf.j2"
dest: "/etc/resolver/{{item.domain}}"
force: yes
become: yes
become_method: sudo
with_items:
- { ip: "{{ machine_ip.stdout }}", domain: test }

- name: Add dev binary to PATH to .zshrc
lineinfile:
dest: ~/.zshrc
line: "source {{ dev_env_dir }}/ansible/mac_profile"
create: yes
when: ansible_env.SHELL == "/bin/zsh" or ansible_env.SHELL == "/usr/local/bin/zsh"

- name: Add dev binary to PATH to .bash_profile
lineinfile:
dest: ~/.bash_profile
line: "source {{ dev_env_dir }}/ansible/mac_profile"
create: yes
when: ansible_env.SHELL == "/bin/bash"

- name: Add dev binary to PATH to .config/fish/config.fish
lineinfile:
dest: ~/.config/fish/config.fish
line: "source {{ dev_env_dir }}/ansible/mac_profile.fish"
create: yes
when: ansible_env.SHELL == "/usr/local/bin/fish"
4 changes: 1 addition & 3 deletions ansible/mac_profile
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# Dash Developer Environment Profile
# This file should be shell-agnostic
export PATH=$PATH:/usr/local/dev-env/bin
eval "$(dev machine env)"
export PATH=$PATH:/usr/local/gdev-env/bin
2 changes: 2 additions & 0 deletions ansible/mac_profile.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dash Developer Environment Profile
set -x PATH $PATH "/usr/local/gdev-env/bin"
1 change: 0 additions & 1 deletion ansible/resolver-dev.conf

This file was deleted.

7 changes: 7 additions & 0 deletions ansible/resolver-dev.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
##
# Do not edit: This file is managed by ansible
# {{ item.domain }}
##
domain {{ item.domain }}
nameserver {{ item.ip }}
search_order 1
78 changes: 74 additions & 4 deletions bin/bootstrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
#!/usr/bin/env bash

# We need at least ansible 2.0 for blockinfile directive
ANSIBLE_NEEDED="2.0"

# Only OS X yosemite and later support xhyve
OSX_NEEDED="10.10.0"

# This is fork from original dash
REPO='devgeniem/dash'

# Returns 1 if upgrade is needed
# $1 - SYSTEM VERSION
# $2 - NEEDED VERSION
update_needed () {
if [[ $1 == $2 ]]
then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
return 0
fi
done
return 0
}

# Check that OS X is current enough
which -s sw_vers
if [[ $? != 0 ]] ; then
echo "ERROR: This is only supported with OS X. What system are you using?"
exit 1
else
echo "CHECK: Minimum OS-X version needed: $OSX_NEEDED"
OSX_VERSION=$(sw_vers -productVersion)
if update_needed $OSX_VERSION $OSX_NEEDED; then
echo "ERROR: You need to update your OS X, it is only $OSX_VERSION"
exit 1
else
echo "OK: OS X version is sufficient ($OSX_VERSION)..."
fi
fi

## Install or Update Homebrew ##
echo 'Installing or Updating Homebrew...'
which -s brew
@@ -14,15 +73,26 @@ echo -e "\n\n"
echo 'Installing or Updating Ansible...'
which -s ansible-playbook
if [[ $? != 0 ]] ; then
brew install ansible
echo "ansible installation..."
brew install ansible
else # Ansible needs to be at least 1.9
ANSIBLE_VERSION=$(ansible --version | grep ansible | cut -d " " -f 2)
if update_needed $ANSIBLE_VERSION $ANSIBLE_NEEDED; then
echo "Ansible is too old: $ANSIBLE_VERSION. We need >$ANSIBLE_NEEDED"
echo "Updating ansible through homebrew..."
brew upgrade ansible
brew link --overwrite ansible
else
echo "Ansible version is $ANSIBLE_VERSION. Update not needed..."
fi
fi
echo -e "\n\n"

## Check out a copy of this repo (first time only) ##
echo 'Checking out Dash repo...'
git clone https://github.com/IFTTT/dash.git /usr/local/dev-env 2>/dev/null
echo 'Checking out gdev repo...'
git clone https://github.com/$REPO.git /usr/local/gdev-env 2>/dev/null

## Run Ansible Playbook ##
echo 'Handing Playbook to Ansible (will require your sudo password)...'
echo -e "\n\n"
/usr/local/dev-env/bin/dev update
/usr/local/gdev-env/bin/gdev update
Loading