Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 29 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save pcm211/10950bf5447a51fdcd1c to your computer and use it in GitHub Desktop.
Save pcm211/10950bf5447a51fdcd1c 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.

@husseiny
Copy link

husseiny commented Jun 4, 2016

thanks for the guide! quick question for: vi config.defaults.yml, do you mean: config.yml?

@rmard
Copy link

rmard commented Sep 30, 2016

Excellent guide!
I believe the line bundle exec db:create should be bundle exec rake db:create

@krshntj
Copy link

krshntj commented Oct 17, 2016

It says:
Sorry, you can't use byebug without Readline. To solve this, you need to
rebuild Ruby with Readline support. If using Ubuntu, try sudo apt-get install libreadline-dev and then reinstall your Ruby.
rake aborted!
LoadError: cannot load such file -- readline
/tmp/ruby-2.3.1/sharetribe/config/application.rb:20:in <top (required)>' /tmp/ruby-2.3.1/sharetribe/Rakefile:4:inrequire'
/tmp/ruby-2.3.1/sharetribe/Rakefile:4:in <top (required)>' /usr/local/bin/bundle:22:inload'
/usr/local/bin/bundle:22:in `

'
(See full trace by running task with --trace)
ubuntu@ip-172-31-23-244:/tmp/ruby-2.3.1/sharetribe$

@cstbr
Copy link

cstbr commented Jan 23, 2017

Hello anybody can update this tutorial?
thanks anyway

@Aero-geek
Copy link

could you please update with instructions for production? I'm experiencing issues with delayed jobs on production set up

@johnlewis88
Copy link

does anyone know how to set up deployments with bitbucket pipelines?

@sophy17
Copy link

sophy17 commented Nov 2, 2017

hello do you have the documentation for the laste version of sharztribe

@nadjet
Copy link

nadjet commented Dec 31, 2017

I was able to setup Sharetribe with AWS and my domain name by following these instructions, the up to date ones on Sharetribe github, and resolving some issues along the way. I wrote a document about it if it might help anyone:
https://github.com/nadjet/sharetribe-aws
Best of luck!

@pcm211
Copy link
Author

pcm211 commented Feb 23, 2019

I would be updating this in detail :)
very soon

@jkinlan
Copy link

jkinlan commented Jun 12, 2019

I would be updating this in detail :)
very soon

Hi pcm211.
Do you know when you will be posting your update?

@pcm211
Copy link
Author

pcm211 commented Jun 14, 2019 via email

@jkinlan
Copy link

jkinlan commented Jun 19, 2019

What branch you using now?

@pcm211
Copy link
Author

pcm211 commented Jun 19, 2019 via email

@abhiniveshjain
Copy link

Is there any plan of getting this in container?

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