On OS X,
-
Install XCode
If you are using XCode 4 and above, please also install Command Line Tools by
Launch XCode > Preferences > Settings > Downloads
-
Install Homebrew
If you are using OS 10.7 or above, please see these prerequisites before going to the next step
-
Install rbenv
brew install rbenv
-
Install ruby-build
brew install ruby-build
-
Insall ruby with rbenv
rbenv install 1.9.2-p290
-
Install git with
brew install git
-
Follow the instructions on this page to set up your SSH key pair and tell Github about your public key:
-
Clone
Tabs
to the directory of your choice.git clone git@github.com:vitrue/tabs.git git checkout develop
-
Set up the submodules:
git submodule init git submodule update
-
Install gems
cd ~ gem install bundler cd $project_root mkdir .bundle bundle install --path .bundle
-
Download file-syncing scripts (if you don't develop on Mac, skip to Setup Virtual Machine)
-
File Syncing Script * Save to
$project_root/fsevent_rsync.rb
* Change the variablevm_name
-
rsync File Ignore List * Save to
$project_root/.rsyncignore
-
rsync File Keep List * Save to
$project_root/.rsynckeep
-
Run the file-sync script to put files on dev VM
cd $project_root ruby fsevent_rsync.rb
Note: The script must be running at all times to keep files synchronized between Mac and VM
-
Create
tmp
directory If it doesn't already exist, domkdir tmp mkdir tmp/pids mkdir tmp/sockets mkdir log
On Virtual Machine,
-
Install rbenv
-
Install ruby-build
-
Install the following packages
For Ubuntu
sudo apt-get install mysql-client libmysqlclient-dev libxml2 libxml2-dev libxslt1-dev imagemagick libmagickcore-dev libcurl4-gnutls-dev sqlite3 libsqlite3-dev openssl libssl-dev libopenssl-ruby1.9 libreadline-dev redis-server mysql-server nginx
-
Install Ruby
For Ubuntu
sudo apt-get install libreadline5-dev libncurses5-dev ls -al /usr/include | ack-grep "readline" ls -al /usr/include | ack-grep "openssl" CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline --with-openssl-dir=/usr/include/openssl" rbenv install 1.9.2-p290
-
Install Gems
cd ~ gem install bundler rb_fsevent
-
Install RMagick (Image Processing)
For Ubuntu
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev librmagick-ruby
-
Download the following files
-
Unicorn Configuration File * Save to
$project_root/config/unicorn.rb
* Change the variableproject_root
-
Nginx Configuration File * Save to
etc/nginx/sites-available/tabs.config
* Change the variablesproject_url
andproject_root
* Link the above in etc/nginx/sites-enablecd /etc/nginx/sites-enable ln -s /etc/nginx/sites-available/tabs.config .
-
Start Nginx
sudo nginx
On Virtual Machine,
-
Create
development
andtest
databases, e.g. site_dev_tabs and site_test_tabsIn terminal:
mysql -u root
In MySQL terminal:
CREATE DATABASE site_dev_tabs; CREATE DATABASE site_test_tabs;
-
Make a
database.yml
file, in$project_app/config
folder, and configure it to use the newly created mysql database.Example:
development: &dev adapter: mysql2 hostname: localhost database: site_dev_tabs username: root password: test: adapter: mysql2 hostname: localhost database: site_test_tabs username: root password:
-
Create a new Facebook Application with these settings:
App Namespace
: pick something unique to go here, like "yourname_dev_tabs"
Notes: Don't fill URL or domain fields,
Tabs
will make it for you when you add application inTabs
. -
Make a
facebooker.yml
file, in the config folder, and configure it appropriately, with the info from previous step, like this:development: &dev api_key: "xxxx" # copy this from Facebook, make there are double-quotes around it secret_key: xxxx # copy this from Facebook application_id: xxxx # copy this from Facebook (same as api_key, but without quotes) canvas_page_name: yourname_dev_tabs callback_url: http://tabs.joelam123.dev.cloud.vitrue.com/ # your $project_url in Nginx config file pretty_errors: true set_asset_host_to_callback_url: false slug: fms use_for_fb_connect: true test: *dev
-
Copy config files from templates
bundle exec rake tabs:copy_configs
-
Install gems
bundle install
-
Database migration
bundle exec rake db:migrate
-
Seed the database
-
Edit
lib/tasks/seed.rake
to add your own userbundle exec rake --trace db:seed
-
-
Start
unicorn
, andresque
jobscd $project_root bundle exec unicorn -c config/unicorn.rb -E development -D start-stop-daemon --start --exec /home/deploy/.rbenv/shims/bundle -d /home/deploy/Projects/Vitrue/tabs -b --make-pidfile --pidfile /home/deploy/Projects/Vitrue/tabs/tmp/pids/resque-pool.pid -v -- exec rake resque:pool start-stop-daemon --start --exec /home/deploy/.rbenv/shims/bundle -d /home/deploy/Projects/Vitrue/tabs -b --make-pidfile --pidfile /home/deploy/Projects/Vitrue/tabs/tmp/pids/resque-scheduler.pid -v -- exec rake resque:scheduler
-
Check if
Tabs
is running- Go to http://tabs.[yourname].dev.cloud.vitrue.com
- You should see a login screen
-
Contact
Accounts
team for your own account- Ask for a super-admin account for
Accounts Sandbox
. Let them know you needTabs
- Test it out by going to http://accounts-sandbox.staging.cloud.vitrue.com, and log in
- Ask for a super-admin account for
-
Log into
Tabs
- Add your Facebook application Connections > My Apps
- Attach your Facebook Page to a
Tabs
view Connections > My Facebook Pages > Attach View
Please see the help files: http://help.vitrue.com/kb/vitrue-tabs/connections-making-a-view-live-on-facebook
-
[Optional] Setting up
Tabs
preview in development- Create a new Facebook App
-
Canvas URL (
$canvas_url
) is just like usual$project_url/apid/$app_id/
-
Tab URL is
$canvas_url/facebook/preview_iframe
- Add your Facebook App to a Facebook Page
- Go to the Profile Page for your Facebook App
- Click Add to Page
- Pick your Page
- Find the URL of your App on the Page and copy it to use for
$page_url
below
-
Next update your
facebooker.yml
by adding your new app underalternative_keys
. See an example below on where to putalternative_keys
:development: &dev api_key: 1234 secret_key: xxxx canvas_page_name: melsapp-fms-default callback_url: http://melinda.pipe.vitrue.com/ application_id: 326655126925 pretty_errors: true set_asset_host_to_callback_url: false page_url: "http://www.facebook.com/apps/application.php?id=326655126925&v=app_326655126925" slug: fms use_for_fb_connect: true alternative_keys: "<FILL IN NEW FACEBOOK APP ID>": secret_key: <FILL IN FACEBOOK SECRET KEY> canvas_page_name: <FILL IN CANVAS PAGE NAME> callback_url: <YOUR CALLBACK> application_id: <FILL IN YOUR APP ID> page_url: "<FILL IN THE URL FOR YOUR APP ON THE PAGE>" slug: tabs_iframe_preview
-
Run a rake task:
bundle exec rake facebook:add_preview_app