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

fab-canvas is a python script that helps with (mostly) hands-free installation of canvas in the cloud.

Quick summary

Typing this in your virtualenv will Production Start canvas in your cloud server

$ workon workhere    ----start working inside your virtualenv
$ cd ~/domains/workhere
$ git clone https://lvnilesh@github.com/lvnilesh/fab-canvas.git
$ cd fab-canvas
...
...needs some hands on work for DNS and passwords
...
$ 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 in production mode

##REQUIRED hands on work

##Things you need

  • a cloud account, like rackspace or better yet get the free tier at AWS http://aws.amazon.com/free which is good for experimenting
  • setup a cloud server with Ubuntu Lucid Lynx (10.04) 64 bit
  • IP address of your cloud server
  • root password of your cloud server
  • access to a domain and its DNS zone records
  • make up a password for mysql db user root
  • make up a password for mysql db user canvas
  • make up a shell password for regular nonroot ubuntu user nilesh
  • access to a gmail account (for setting up outgoing mail)

###REQUIRED create keys if you dont have it already The keys will save in ~/.ssh

ssh-keygen -t dsa -C "lvnilesh@yahoo.com"

REQUIRED change TargetDomain in fabfile to match your domain

TargetDomain = 'canvas.nescorp.us'

###REQUIRED setup your domain and files_domain DNS A record pointing to the cloud IP Address

canvas.nescorp.us.        IN  A 50.57.36.98
canvasfiles.nescorp.us.   IN  A 50.57.36.98

###OPTIONAL setup reverse DNS points to back to your domain

###REQUIRED edit domains.yml to match your DNS A records for your domain and your files_domain

production:
  domain: "canvas.nescorp.us"
  files_domain: "canvasfiles.nescorp.us"

###REQUIRED edit canvas.sites apache virtual host file to match your domain and your files_domain and server admin

<VirtualHost *:80>
  ServerName canvas.nescorp.us
  ServerAlias canvas.nescorp.us 
  ServerAdmin lvnilesh@yahoo.com
...
...
<VirtualHost *:443>
  ServerName canvas.nescorp.us
  ServerAlias canvas.nescorp.us
  ServerAdmin lvnilesh@yahoo.com

###REQUIRED edit database.yml to insert your db passwords for canvas db user

production:
  adapter: mysql
  encoding: utf8
  database: canvas_production
  host: localhost
  username: canvas
  password: THIS-IS-A-VERY-SECURE-CANVAS-PASSWORD
  timeout: 5000
  queue:
    adapter: mysql
    encoding: utf8
    database: canvas_queue_production
    host: localhost
    username: canvas
    password: THIS-IS-A-VERY-SECURE-CANVAS-PASSWORD
    timeout: 5000

###REQUIRED edit mysql-script.sh to insert your db passwords for canvas db user and root db user

#!/bin/sh
# This is a comment
mysql -t --user=root --password=THIS-IS-A-VERY-SECURE-ROOT-PASSWORD <<STOP
-- This is a comment inside an sql-command-stream.
create database canvas_production;
create database canvas_queue_production;
create user 'canvas'@'localhost' identified by 'THIS-IS-A-VERY-SECURE-CANVAS-PASSWORD';
grant all privileges on canvas_production.* to 'canvas'@'localhost' with grant option;
grant all privileges on canvas_queue_production.* to 'canvas'@'localhost' with grant option;
\q
STOP
test $? = 0 && echo "Your mysql batch job completed gracefully"

###REQUIRED add fabric to the virtual environment

workon workhere
pip install fabric

###REQUIRED add openstack.compute to the virtual environment openstack.compute library helps manage servers in the cloud using python

workon workhere
cd ~/domains/workhere
git clone https://github.com/jacobian/openstack.compute.git
cd openstack.compute
python setup.py install
cd ~/domains/workhere