Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssippe/cac4741e876af50ac6b6828e16830868 to your computer and use it in GitHub Desktop.
Save ssippe/cac4741e876af50ac6b6828e16830868 to your computer and use it in GitHub Desktop.
This Is a step by step way to deploy Sharetribe to Amazon AWS Free Tier in Development Mode (Not Production)

Prerequisites

  1. Have an AWS Account
  2. Spin up an EC2 Instance of Ubuntu Server and Make sure that your instance's security groups allow incoming connections on TCP ports 22 and 3000
  3. Use an Elastic IP to bind your Instance to it --- You would not be paying for this -- Till the time the EC2 Instance is running
  4. Add the IP Allocated to your A Record --- with your registrar
  5. Have a SSH Connection to your EC2 Instance with the Key Pairs
  6. Connect to the EC2 Instance

STEP 1 -- Setting up the Playground

Libraries that need to be installed for a hastle free installation.

1. sudo apt-get install -y nodejs
2. sudo apt-get install libmysqlclient-dev.
3. sudo apt-get install libsqlite3-dev       #  for mailcatcher will not need
4. sudo apt-get update                       #  before starting instl --- always better to do this*

Intsalling Ruby

Download appropriate ruby version https://www.ruby-lang.org/en/downloads/

1. cd /tmp
2. wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.gz.
3. tar -xvzf ruby-2.2.4.tar.gz
4. cd ruby-2.2.4/
5. ./configure --prefix=/usr/local.
6. make
7. make check  *ALWAYS BETTER TO DO THIS STEP ----- to check all dependencies*.
8. sudo make install

Update the Sysytem.

1. sudo gem update --system.
2. sudo gem install bundler -- ## UPDATE BUNDLER

Installing Git

sudo apt-get install git

Configure the Installed Git

Check this link for more details - [https://help.github.com/articles/set-up-git/#platform-linux]

1. git config --global user.name "YOUR NAME"
2. git config --global user.email "YOUR EMAIL ADDRESS"

Install Mysql

sudo apt-get install mysql-client-5.5 mysql-server-5.5  # check latest from apt search cmd*  
# Though its better to use Amazon RDS services for better throughput and better overall efficiency in the system

Install Sphinx

sudo apt-get install sphinxsearch

Install ImageMagicx

sudo apt-get install imagemagick

Now we have completed all the prerequisites - Great Job

STEP 2 --- Setting up the development environment

git clone git://github.com/sharetribe/sharetribe.git  <preferably use a stable version>

Navigate to the Sharetribe project root directory.

cd sharetribe

Create a database.yml file by copying the example database configuration:

1. cp config/database.example.yml config/database.yml
2. cd sharetribe/config
3. vi database.yml
***Edit the pwds as reqd -- Your USERNAME AND PASSWORDS as while instl mysql*

Create a config.yml file by copying the example configution file:

cp config/config.example.yml config/config.yml

EDIT The newly made config.yml in config folder to override the default configurations

1. vi config.yml
2. domain: *yourdomain.com:3000*  
Note : there must be an entry in the A Record/CNAME Record to point to 
your AWS EC2 instance IP Addresses Do not work with sharetribe

Ready to Go

bundle install

Initialize your database:

1. bundle exec db:create
2. bundle exec rake db:schema:load

Run Sphinx index:

bundle exec rake ts:index

Start the Sphinx daemon:

bundle exec rake ts:start

LEAVING MAILCATCHER --- as it uses localhost which you will not be able to view

Invoke the delayed job worker:

bundle exec rake jobs:work

Invoke WEBRICK IN A NEW WINDOW SSH CONNECTION

bundle exec rails server -b 0.0.0.0  <to bind it on all interfaces>

TO KEEP IT RUNNING WHEN CLOSING TERMINAL DO THE FOLL

1. nohup bundle exec rake jobs:work & 
2. disown
3. bundle exec rails server -d -b 0.0.0.0

ENJOY

To integrate AWS RDS instance do the foll:

  1. Make an RDS Instance
  2. set the Instance to the same security group as your EC2 Instance -- critical
  3. update the databse.yml file with localhost to RDS Instance Endpoint
  4. Enjoy -- better speeds

To integrate S3 & CDN with your Sharetribe

  1. Make an IAM User with Appropriate S3 priviledges
  2. In the config file add bucket_name : xxx
  3. In the config file add Upload_bucket_name : yyy Note : Both the above buckets xxx,yyy should not be in your S3 bucket ; its better that Sharetribe creates it for you else it will not work --its a hack --dont know the exact reason
  4. In the config file add asset_host : zzz.cloudfront.com or a CNAME to the CDN
  5. In the config file ; Add the Created IAM User and pwd Now Edit the CORS Configs to accomodate Put Post Delete etc, And modify the Origin tags appropriately

COMING SOON

SHARETRIBE ON UBUNTU 14.03 VM -- Coming Soon -- Just Click and Go

Will also put in a link to a UBUNTU 14.04 LTS VM -- downloadable soon .... just finding where to upload it to as i have it ready with me ...looking for hosting it ... maybe a torrent if no other option exists.

This is the first Sketchy Guide -- will update with images etc as i dont know how to put inline images presently

Comments/Review for better deployment is welcome

Will help me to understand is this required or not . Tx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment