Our marketplace is based on the Sharetribe platform.
- Installation
- Payments
- Updating
- Technical roadmap
- Contributing
- Translation
- Known issues
- Developer documentation
- License
- Good luck and God speed. You're gonna need it.
Before you get started, the following needs to be installed:
- Ruby. Version 2.1.2 is currently used and we don't guarantee everything works with other versions. We are operational in 2.1.7 but YMMV ...
- RubyGems
- Bundler:
gem install bundler
- Git
yum -y install git
- A database. Only MySQL has been tested. Not worth screwing around. You can install MySQL Community Server two ways:
- Download a MySQL installer from here
- Sphinx. Version 2.1.4 has been used successfully, but newer versions should work as well. Make sure to enable MySQL support.
- Imagemagick.
We had trouble with this, so we skipped this step. YOLO.
-
Don't get our code. Get it from the source ...
-
Navigate to the project root directory.
-
Create a
database.yml
file by copying the example database configuration:
cp config/database.example.yml config/database.yml
- Create the required databases with:
CREATE DATABASE sharetribe_test CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE sharetribe_development CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE sharetribe_production CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT all privileges ON sharetribe_development.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'my_favorite_pony';
GRANT all privileges ON sharetribe_production.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'my_favorite_pony';
GRANT all privileges ON sharetribe_test.* TO 'sharetribe'@'localhost' IDENTIFIED BY 'my_favorite_pony';
- Add your database configuration details to
config/database.yml
. (i.e. username/password) - Install the required gems by running the following command in the project root directory:
bundle install
- Initialize your database:
bundle exec rake db:schema:load
- Run Sphinx index:
bundle exec rake ts:index
- Start the Sphinx daemon:
bundle exec rake ts:start
- Invoke the delayed job worker:
bundle exec rake jobs:work
- In a new console, open the project root folder and start the server. The simplest way is to use the included Webrick server:
bundle exec rails server
Congratulations! If you're really lucky, it might be up and running for development purposes. Open a browser and go to the server URL (e.g. http://lvh.me:3000). Fill in the form to create a new marketplace and admin user. You should be now able to access your marketplace and modify it from the admin area.
Tests are handled by RSpec for unit tests and Cucumber for acceptance tests. We've never tried this ...
- Navigate to the root directory of project
- Initialize your test database:
bundle exec rake test:prepare
This needs to be rerun whenever you make changes to your database schema.
- If Zeus isn't running, start it:
zeus start
- To run unit tests, open another terminal and run:
zeus rspec spec
- To run acceptance tests, open another terminal and run:
zeus cucumber
Note that running acceptance tests is slow and may take a long time to complete.
To automatically run unit tests when code is changed, start Guard:
bundle exec guard
Before starting these steps, perform steps 1-6 from above.
- Initialize your database:
bundle exec rake RAILS_ENV=production db:schema:load
- Run Sphinx index:
bundle exec rake RAILS_ENV=production ts:index
- Start the Sphinx daemon:
bundle exec rake RAILS_ENV=production ts:start
- Precompile the assets:
bundle exec rake assets:precompile
- Invoke the delayed job worker:
bundle exec rake RAILS_ENV=production jobs:work
- In a new console, open the project root folder and start the server:
bundle exec rails server -e production
The built-in WEBrick server (which was started in the last step above) should not be used in production due to performance reasons. A dedicated HTTP server such as unicorn is recommended. But it is a b***h to set up.
It is not recommended to serve static assets from a Rails server in production. But you can. And we do. If you're really cool, you could pay through the nose and use a CDN (Content Delivery Network) service, such as Amazon CloudFront. But we're poor. To serve the assets from the CDN service, you need to change the asset_host
configuration in the the config/config.yml
file to point your CDN distribution.
-
In your database, change the value of the
domain
column in thecommunities
table to match the hostname of your domain. For example, if the URL for your marketplace is http://mymarketplace.myhosting.com, then the domain ismymarketplace.myhosting.com
. -
Change the value of the
use_domain
column totrue
(or1
) in thecommunities
table.
Default configuration settings are stored in config/config.default.yml
. If you need to change these, we recommend creating a config/config.yml
file to override these values. You can also set configuration values to environment variables.
Sharetribe's open source version supports payments using Braintree Marketplace. To enable payments with Braintree, you need to have a legal business in the United States. You can sign up for Braintree here. Once that's done, create a new row in the payment gateways table with your Braintree merchant_id, master_merchant_id, public_key, private_key and client_side_encryption_key.
PayPal payments are only available on marketplaces hosted at Sharetribe.com due to special permissions needed from PayPal. We hope to add support for PayPal payments to the open source version of Sharetribe in the future.
See release notes for information about what has changed and if actions are needed to upgrade.
- It's all in our heads.
Browse open issues if you like, but please don't submit new ones at https://github.com/ziyoucaishi/marketplace/issues.
- Testing
- SCSS coding guidelines
- Delayed job priorities
- Cucumber testing Do's and Don'ts
- Technical roadmap
Marketplace is open source under the MIT license. See LICENSE for details.