Skip to content
Mikko Koski edited this page Jul 3, 2014 · 81 revisions

Welcome to the Sharetribe wiki!

WARNING! The wiki is OUTDATED. For installation instructions, see README.md

This is currently the central place for documentation related to running Sharetribe software on your server or participating in the development.

The wiki is a community effort, so feel free to edit any page to improve the documentation. And if you feel that something is missing or wrong, please report in the Issues.

Installation instructions

WARNING! The wiki is OUTDATED. For installation instructions, see README.md

NOTE: If you try installing and encounter problems, please report them for example in Issues. We try to help you and enhance the documentation.

You can also ask for help in Sharetribe Development Flowdock

Below the installation instructions there is space for Operating system-specific tips, so if you have problems, check there, and if you get your problem solved, add instructions to the tips section.

  1. Install
    • “Ruby (we use currently version 2.1.1 and don’t guarantee everything working with others. If you need multiple versions of Ruby, RVM can help.)
    • RubyGems
    • Bundler gem install bundler
    • Git.
  2. Get the code (git clone is probably easiest way: git clone git://github.com/sharetribe/sharetribe.git)
  3. Go to the root folder of Sharetribe
  4. Copy the example database configuration file as database.yml, which will be used to read the database information: cp config/database.example.yml config/database.yml
  5. You need to have a database available for Sharetribe and a DB user account that has access to it. We have only used MySQL, so we give no guarantees of things working with others (e.g. PostgreSQL). (If you are going to do development you should have separate databases for development and testing also).
  6. Edit details according to your database to config/database.yml (if you are not going to develop Sharetribe, it’s enough to fill in the production database)
    • Probably you only need to change the passwords to the same that you used when creating the databases.
  7. Copy the example configuration file as config.yml, which will be used to read the Sharetribe configuration information: cp config/config.defaults.yml config/config.yml
  8. Edit details according to your system configuration to config/config.yml. If there is something unclear, post a question for example to Issues.
    • If you are planning to run Sharetribe in production mode on your local machine (without Apache or similar server in front) you’ll need to set the value of serve_static_assets_in_production to true (to make images and CSS files show correctly). Otherwise leave it as it is.
  9. Install Sphinx. Version 2.0.6 has been used successfully, but probably also newer and older (>0.9.9) versions will work. See Sphinx installation instructions. (no need to start it yet. You can try running searchd command, but it should fail at this point complaining about missing config)
  10. Install Imagemagick
  11. You may have more success installing the mysql2 gem manually at this point, particularly on Mac OS X
    gem install mysql2 -v 0.2.7
  12. run bundle install in the project root directory (sharetribe) to install required gems
  13. (In the following commands, leave out the RAILS_ENV=production part if you want to get Sharetribe running in development mode.) Load the database structure to your database: rake RAILS_ENV=production db:schema:load
  14. run rake db:seed to add some initially needed data to the database (e.g. default categories)
  15. run sphinx index rake RAILS_ENV=production ts:index
  16. start sphinx daemon rake RAILS_ENV=production ts:start
  17. If you want to run Sharetribe in production mode (i.e. you are not developing the software) you’ll need to precompile the assets. This puts the Javascript and CSS files in right places. Use command: rake assets:precompile
  18. If you want to enable Sharetribe to send email locally (in the development environment), you might want to change the email settings in the config file. There is an example of configuring settings using a gmail account, but you can also use any other SMTP server. If you do not touch the settings, the development version works otherwise normally but might crash in instances where it tries to send email (like when sending a message to another user).
  19. Invoke the delayed job worker on your local machine: rake RAILS_ENV=production jobs:work . The worker processes tasks that are done in the background, like sending email notifications and assigning badges to people.
  20. Start the server. There are many options for this, lately we have been using Passenger, but the simplest way is to use command rails server which will start it on Webrick, which is good option for development use.
    • To start the server in production environment, use command rails server -e production
  21. Sharetribe server can serve multiple Sharetribe communities (tribes) that are separated by subdomains. You need at least one community to use Sharetribe. To create a community, start the Rails Console: rails console production and choose the name and subdomain for your community and insert them in the following command:
    Community.create(:name => "your_chosen_name_here", :domain => "your_chosen_subdomain_here")
  22. go to your selected community address (your_chosen_subdomain_here.yourdomain.com or your_chosen_subdomain_here.lvh.me:3000) and register as a user. The first registered user will be automatically made as an admin in that community.

Tips for different platforms and OS

Windows
  • The core team is doing development on macs and running servers on linux, so we don’t have experience on running Sharetribe on Windows. It is possible, but with guidance you might have to rely on the community support.
  • Note that the installation instructions on this page are written for *nix-based systems so you need to change the commands a little to make them work in windows (e.g. cp becomes copy in windows)
  • You may need to add few windows specific gems to Gemfile. Versions prior to 2.3.0 included these, but because they caused trouble running Sharetribe on Heroku, we decided to remove them from the default Gemfile. You can just add these lines to Gemfile and run “bundle install”.
    gem 'win32console', :platforms => [:mswin, :mingw]
    gem 'win32-process', :platforms => [:mswin, :mingw]
Mac Os X
  • If you are using MySQL, please note that Mac OS X 10.6 requires a 64-bit version of MySQL.
  • Paths and mysql-libs can cause problems with sphinx. At one computer running OS X we tried all kinds of trick to let sphinx know where the mysql libraries are, but none of them fixed the issue. The final and working method was to copy the missing library file directly to the project directory.. :D
    • If you use home brew, you can try installing sphinx with this command: `brew install sphinx —mysql`
  • RVM requires both Xcode and Command Line Tools for Xcode to be installed
    • Install Xcode from App Store
    • To install Command Line Tools for Xcode, open Xcode and from the application menu, select Xcode > Open Developer Tools > More Developer Tools…
Ubuntu (and Linux in general)
  • If, during precompile, you face an error like Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes., you have to install nodejs. Execute sudo apt-get install nodejs and run precompile again.
  • These are the bash commands I used to install Sharetribe on a fresh Ubuntu 12.10 box:
    
    - sudo aptitude install ruby1.9.3
    - sudo gem install bundler
    - sudo aptitude install git
    - git clone git://github.com/sharetribe/sharetribe.git
    - cd sharetribe
    - cp config/database.example.yml config/database.yml
    - sudo aptitude install mysql-server-5.5
    - sudo mysql_secure_installation
    - <execute 2 production SQL commands>
    - emacs config/database.yml
    	- edit the pw of "sharetribe_production"
    - cp config/config.example.yml config/config.yml
    - emacs config/config.yml
    	- check all once
    	- don't forget serve_static_assets_in_production = true (if not using Apache?)
    - sudo aptitude install sphinxsearch
    - sudo aptitude install imagemagick
    - sudo aptitude install build-essential mysql-client libmysql-ruby libmysqlclient-dev
    - sudo gem install mysql2 -v 0.2.7
    - sudo aptitude install libxml2-dev libxslt-dev
    - emacs Gemfile.lock
    	- change money-rails (0.8.0) to money-rails (0.8.1)
    - bundle install
    - rake RAILS_ENV=production db:schema:load
    - (note: if you ever want to uninstall all ruby gems)
    	- sudo su
    	- gem list | cut -d" " -f1 | xargs gem uninstall -aIx
    - sudo aptitude install nodejs
    - rake RAILS_ENV=production db:seed
    - rake RAILS_ENV=production thinking_sphinx:index
    - rake RAILS_ENV=production thinking_sphinx:start
    - emacs app/assets/stylesheets/application.scss.erb
    	- prepend this to the <% %> block at the top:
    		require "#{Rails.root}/app/helpers/scss_helper.rb"
    - rake assets:precompile
    - to enable logs in production (Passenger+Apache)
    	- emacs config/application.rb
    	- comment out the lines:
    		if Rails.env.production? || Rails.env.staging? 
    			config.logger = Logger.new(STDOUT)
    			config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO')
    		end
    - emacs app/views/layouts/application.haml
    	- delete the last include IE9 javascript imports
    - sudo aptitude install apache2 libapache2-mod-passenger
    - sudo gem install passenger
    - edit the apache site config file
    - rake RAILS_ENV=production jobs:work
    

Admin & Management of the installed Sharetribe server

Most of the management operations need to be done in the Rails console.Admin of Sharetribe server page contains some help for that.

Contribute to development

If you want to see what is currently being done by the core development team, you can take a look at the Roadmap

We also recommend to join the Sharetribe Development Flowdock where you can get the fastest answers for your questions and get to know the other developers. (If you prefer using IRC client for dev chat, that’s possible too after you create a Flowdock account)

  1. Install git: instructions
  2. If you are a collaborator with push rights to main repo, see Collaborator guide otherwise fork the project.
  3. Check git instructions if needed from: learn.github.com
  4. Run all tests and make sure they all pass. (see bottom of the Coding Guidelines page for details.)
  5. If you are a collaborator pushing directly to main repo, you must use Git Flow type of branching . We recommend installing and using Git Flow in any case as it makes it very simple to follow good branching logic.
  6. Make changes to the code in a feature branch and do tests for your features. See our Coding Guidelines if you need guidance in this!
  7. Make sure the old and new tests pass.
  8. Commiting changes with informative english commit message that explains the changes you’ve made. This article gives nice example of how to format commit comments.
    • if you are a collaborator, you can push directly, if you set the ssh-key on your profile
    • otherwise make a push to your own forked repository and if you thing that the commit would be useful for the main Sharetribe branch, please make a pull request by clicking the “Pull request” button in your project or on the page of your commit. This github guide explains forking nicely.
Clone this wiki locally