Sunday, April 6, 2014

Getting edx devstack to run on Windows

1) Fix issue https://github.com/edx/edx-platform/issues/3230

2) Change Vagrant ansible-play command to

ansible-playbook -i localhost, -c local vagrant-devstack.yml --tags=deploy -e configuration_version=master -e edx_ansible_source_repo=https://github.com/lsiu/configuration.git -e edx_platform_repo=https://github.com/lsiu/edx-platform.git -e edx_platform_version=master -vvv

3) Fix symbolic link issue
See: https://github.com/edx/configuration/wiki/Vagrant-troubleshooting#dealing-with-line-endings-and-symlinks-under-windows
 # You need to run this from cygwin, not the Windows command-line (see above)
 git rm --cached -r . && git reset --hard
 git config --global alias.add-symlink '!__git_add_symlink(){ dst=$(echo "$2")/../$(echo "$1"); if [ -e "$dst" ]; then hash=$(echo "$1" | git hash-object -w --stdin); git update-index --add --cacheinfo 120000 "$hash" "$2"; git checkout -- "$2"; else echo "ERROR: Target $dst does not exist!"; echo "       Not creating invalid symlink."; fi; }; __git_add_symlink "$1" "$2"'
 git config --global alias.rm-symlink '!__git_rm_symlink(){ git checkout -- "$1"; link=$(echo "$1"); POS=$'\''/'\''; DOS=$'\''\\\\'\''; doslink=${link//$POS/$DOS}; dest=$(dirname "$link")/$(cat "$link"); dosdest=${dest//$POS/$DOS}; if [ -f "$dest" ]; then rm -f "$link"; cmd //C mklink //H "$doslink" "$dosdest"; elif [ -d "$dest" ]; then rm -f "$link"; cmd //C mklink //J "$doslink" "$dosdest"; else echo "ERROR: Something went wrong when processing $1 . . ."; echo "       $dest may not actually exist as a valid target."; fi; }; __git_rm_symlink "$1"'
 git config --global alias.rm-symlinks '!__git_rm_symlinks(){ for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; do git rm-symlink "$symlink"; git update-index --assume-unchanged "$symlink"; done; }; __git_rm_symlinks'
 git config --global alias.checkout-symlinks '!__git_checkout_symlinks(){ POS=$'\''/'\''; DOS=$'\''\\\\'\''; for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; do git update-index --no-assume-unchanged "$symlink"; if [ -d "$symlink" ]; then dossymlink=${symlink//$POS/$DOS}; cmd //C rmdir //S //Q "$dossymlink"; fi; git  checkout -- "$symlink"; echo "Restored git symlink $symlink <<===>> `cat $symlink`"; done; }; __git_checkout_symlinks'
 git rm-symlinks
4) Before running `vagrant provision`, comment out the checkout and clean resets (if left in playbook, it will resets the above fix)

/edx/app/edx_ansible/edx_ansiblplaybooks/roles/edx_ansible/tasks/deploy.yml
/edx/app/edx_ansible/edx_ansiblplaybooks/roles/edxapp/tasks/deploy.yml