Skip to content
Nilesh edited this page Sep 5, 2011 · 35 revisions

fab-canvas is an first attempt at almost hands-free automatic installation of canvas in the cloud.

quick summary

Once setup correctly, you need to type these commands in your virtualenv

workon workhere
fab test 	-----pings your server IP address to make sure your DNS is set correctly
fab prep    -----prepares your cloud server for canvas installation 
fab canvas  -----installs canvas according to production install instructions at https://github.com/instructure/canvas-lms/wiki/Production-Start

###adding fabric to the virtual environment

workon workhere
pip install fabric

###adding openstack.compute to the virtual environment

  • openstack.compute library helps manage servers in the cloud using python

##prepare a virtual environment

install Xcode on mac  
sudo easy_install pip    Mac Lion already has easy_install. sudo apt-get install python-setuptools for linux   
sudo pip install virtualenv virtualenvwrapper  
mkdir ~/domains  
  • append this to ~/.profile in mac or ~/.bashrc in linux
export WORKON_HOME=$HOME/domains  
source /usr/local/bin/virtualenvwrapper.sh  
export PIP_VIRTUALENV_BASE=$WORKON_HOME  
  • exit out of that shell, start a new shell/terminal

Now you can create any number of python virtual environments. Lets create a new virtual environment we call workhere

macbook:~ nilesh$ mkvirtualenv workhere
New python executable in test/bin/python
Installing setuptools............done.
Installing pip...............done.
virtualenvwrapper.user_scripts creating /Users/nilesh/domains/workhere/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/nilesh/domains/workhere/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/nilesh/domains/workhere/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/nilesh/domains/workhere/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/nilesh/domains/workhere/bin/get_env_details
(workhere)macbook:~ nilesh$ 
(workhere)nilesh@ubuntu:~$ cd ~/domains/workhere
...
....you work here...
...
and deactivate when you are done.
(workhere)macbook:workhere nilesh$ deactivate
macbook:workhere nilesh$
  • To work with virtualenv again, simply type below
workon workhere
cd ~/domains/workhere

###Wrappers

mkvirtualenv (create a new virtualenv)
rmvirtualenv (remove an existing virtualenv)
workon (change the current virtualenv)
add2virtualenv (add external packages in a .pth file to current virtualenv)
cdsitepackages (cd into the site-packages directory of current virtualenv)
cdvirtualenv (cd into the root of the current virtualenv)
deactivate (deactivate virtualenv, which calls several hooks)

###Hooks

One of the coolest things about virtualenvwrapper is the ability to provide hooks when an event occurs. Hook files can be placed in ENV/bin/ and are simply plain-text files with shell commands. virtualenvwrapper provides the following hooks:

postmkvirtualenv
prermvirtualenv
postrmvirtualenv
postactivate
predeactivate
postdeactivate

##github setup

macbook:~ nilesh$ workon workhere  
(workhere)macbook:~ nilesh$ cd ~/domains/workhere/  
(workhere)macbook:workhere nilesh$ git config --global user.name "Nilesh"  
(workhere)macbook:workhere nilesh$ git config --global user.email [email protected]  
(workhere)macbook:workhere nilesh$ mkdir fab-canvas  
(workhere)macbook:workhere nilesh$ cd fab-canvas  
(workhere)macbook:fab-canvas nilesh$ git init  
Initialized empty Git repository in /Users/nilesh/domains/workhere/fab-canvas/.git/  
(workhere)macbook:fab-canvas nilesh$ touch README  
(workhere)macbook:fab-canvas nilesh$ git add README  
(workhere)macbook:fab-canvas nilesh$ git commit -m 'first commit'  
[master (root-commit) ba5c664] first commit  
 0 files changed, 0 insertions(+), 0 deletions(-)  
 create mode 100644 README  
(workhere)macbook:fab-canvas nilesh$ git remote add origin [email protected]:lvnilesh/fab-canvas.git  
(workhere)macbook:fab-canvas nilesh$ git push -u origin master  
Counting objects: 3, done.  
Writing objects: 100% (3/3), 207 bytes, done.  
Total 3 (delta 0), reused 0 (delta 0)  
To [email protected]:lvnilesh/fab-canvas.git  
 * [new branch]      master -> master  
Branch master set up to track remote branch master from origin.  
(workhere)macbook:fab-canvas nilesh$  
(workhere)macbook:fab-canvas nilesh$ cd ..  
(workhere)macbook:workhere nilesh$ git clone [email protected]:lvnilesh/fab-canvas.wiki.git  
Cloning into fab-canvas.wiki...  
remote: Counting objects: 3, done.  
remote: Total 3 (delta 0), reused 0 (delta 0)  
Receiving objects: 100% (3/3), done.  
(workhere)macbook:workhere nilesh$ pwd  
/Users/nilesh/domains/workhere  
(workhere)macbook:workhere nilesh$ ls -l   
drwxr-xr-x  19 nilesh  staff  646 Sep  3 20:57 bin  
drwxr-xr-x   3 nilesh  staff  102 Sep  3 20:55 build  
drwxr-xr-x   4 nilesh  staff  136 Sep  4 16:27 fab-canvas  
drwxr-xr-x   4 nilesh  staff  136 Sep  4 16:40 fab-canvas.wiki  
drwxr-xr-x   3 nilesh  staff  102 Sep  3 20:53 include  
drwxr-xr-x   3 nilesh  staff  102 Sep  3 20:53 lib  
Clone this wiki locally