README

Sharetribe

Would you like to work with an API-based marketplace solution that allows you to build your marketplace with the programming language of your choice, build a mobile app, or easily integrate third party services? Check out Sharetribe Flex.

A database. Only MySQL 5.7 has been tested, so we give no guarantees that other databases (e.g. PostgreSQL) work. You can install MySQL Community Server two ways:

If you are on a Mac, use homebrew: brew install mysql (highly recommended). Also consider installing the MySQL Preference Pane to control MySQL startup and shutdown. It is packaged with the MySQL downloadable installer, but can be easily installed as a stand-alone.

Sphinx. Version 2.1.4 has been used successfully, but newer versions should work as well. Make sure to enable MySQL support. If you're using OS X and have Homebrew installed, install it with brew install sphinx --with-mysql

Imagemagick. If you're using OS X and have Homebrew installed, install it with brew install imagemagick

Setting up the development environment

Get the code. Clone this git repository and check out the latest release:

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

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

Add your database configuration details to config/database.yml. You will probably only need to fill in the password for the database(s).

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

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

Create and initialize the database:

bundle exec rake db:create db:structure:load

Run Sphinx index:

bundle exec rake ts:index

Note: If your MySQL server is configured for SSL, update the config/thinking_sphinx.yml file and uncomment the mysql_ssl_ca lines. Configure correct SSL certificate chain for connection to your database over SSL.

Start the Sphinx daemon:

bundle exec rake ts:start

Start the development server:

foreman start -f Procfile.static

Invoke the delayed job worker in a new console (open the project root folder):

bundle exec rake jobs:work

Congratulations! Sharetribe should now be up and running for development purposes. Open a browser and go to the server URL (e.g. http://lvh.me:3000 or http://lvh.me:5000). 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.

If you need to debug the Rails parts of Sharetribe with Pry, it's not possible with Foreman due to a known compatibility issue. In this case we recommend running Rails with old-fashioned rails server and React builds with Foreman in a separate terminal. That way your binding.pry calls open nicely in the same window with the Rails process.

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.

It is not recommended to serve static assets from a Rails server in production. Instead, you should use a CDN (Content Delivery Network) service, such as Amazon CloudFront. 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.

You need to configure a couple scheduled tasks in order to properly run your marketplace in production. See the [Scheduled tasks](docs/scheduled_tasks.md) documentation.

For production use we recommend you to upgrade only when new version is released and not to follow the master branch.

Setting your domain

In your database, change the value of the domain column in the communities table to match the hostname of your domain. For example, if the URL for your marketplace is http://mymarketplace.myhosting.com, then the domain is mymarketplace.myhosting.com.

Change the value of the use_domain column to true (or 1) in the communities table.

If you wish to enable HTTP Strict Transport Security (recommended), set also the hsts_max_age column in communities table to a non-zero number of seconds. For instance 31536000 (1 year).

Setting up S3

If you want to use S3 to host your images, you need to do a bit more configuration.

Create a IAM role which has full S3 access. Save the AWS access and secret keys.

In the S3 console, create two buckets, one for upload and one for permanent storage. For example your-sharetribe-images and your-sharetribe-images-tmp.

Set the upload bucket (your-sharetribe-images-tmp) to have an expiration (for example, of 14 days) using lifecycle management

Set the following configuration in your sharetribe config.yml: s3_bucket_name: "your-sharetribe-images"s3_upload_bucket_name: "your-sharetribe-images-tmp"

Add your AWS keys to the sharetribe app. The best way to do that is via environment variables, rather than checking them into your config.yml. Set the aws_access_key_id and aws_secret_access_key environment variables to the values for the IAM user.

(Optional) When you enable S3, uploaded images are linked directly to the S3 bucket. If you want to serve these assets through CDN, you can set the user_asset_host configuration option in addition to asset_host in config/config.yml.

Here's a sample CORS configuration that allows anyone to post to your bucket. Note that you may want to lock down the origin host more tightly, depending on your needs.

Troubleshooting S3 Setup

if you are having trouble uploading, look at the request using browser devtools and see what error statuses and messages are being sent.

double check that your AWS keys are being correctly set.

if you can upload images successfully, but the images aren't processed, make sure that the delayed-job worker is running.

Advanced settings

Default configuration settings are stored in config/config.default.yml. If you need to change these, use the config/config.yml file to override the defaults. You can also set configuration values to environment variables.

React components can be created using hot module replacement HMR technique in Styleguide (http://localhost:9001/) path in local development environment. Webpack is used to bundle React components for deployments and hot loading. Related webpack configs can be found from folder sharetribe/client/

Unofficial installation instructions

Use these instructions to set up and deploy Sharetribe for production in different environments. They have been put together by the developer community, and are not officially maintained by the Sharetribe core team. The instructions might be somewhat out of date.

If you have installation instructions that you would like to share, don't hesitate to share them at the Sharetribe community forum.

Payments

PayPal and Stripe are the two available payment gateways integrated.

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 source available version of Sharetribe Go in the future.

Stripe can be used in the source available version, as long as your country and currency are supported.

Enable Stripe

Starting from release 7.2.0, Stripe is supported.

Stripe API keys will be encrypted when stored so it is important to configure your own random encryption key.
You should fill the app_encryption_key variable in the config/config.yml file with a long random string, unique to your project.

Stripe can be configured from the admin panel, in the "Payment settings" section. Instructions on how to get Stripe API keys can be found there.

If Stripe isn't automatically enabled in the admin panel after upgrading to 7.2.0, you should run the following commands in your Rails console, where <ID> is your marketplace ID (probably 1):
TransactionService::API::Api.processes.create(community_id: <ID>, process: :preauthorize, author_is_seller: true)
and
TransactionService::API::Api.settings.provision(community_id: <ID>, payment_gateway: :stripe, payment_process: :preauthorize, active: true).

Versioning

MINOR version when you add functionality in a backwards-compatible manner, and

PATCH version when you make backwards-compatible bug fixes.

See the document [How Sharetribe applies Semantic Versioning](docs/semantic-versioning.md) to read more how Semantic Versioning is applied in practice.

Changes

See [CHANGELOG.md](CHANGELOG.md) for detailed list of changes between releases.

Upgrade

See [UPGRADE.md](UPGRADE.md) for information about actions needed when upgrading.

For production use we recommend you to upgrade only when new version is released and not to follow the master branch.

Contribute

Would you like to make Sharetribe better?

See [CONTRIBUTING.md](CONTRIBUTING.md) for the steps to contribute.

Release

See [RELEASE.md](RELEASE.md) for information about how to make a new release.

Translation

Sharetribe uses WebTranslateIt (WTI) for translations. If you'd like to translate Sharetribe to your language or improve existing translations, please ask for a WTI invitation. To get an invite, send an email to info@sharetribe.com and mention that you would like to become a translator.

All language additions and modifications (except for English) should be done through the WTI tool. We do not accept Pull Requests that add or modify languages (except English).

About
Your go-to Self Hosted Toolbox.
Our goal is to help you find the software and libraries you need.
Made by developers for developers.
The collection of libraries and resources is based on the
Awesome Self Hosted List and direct contributions here.
To add a new software solution, please, check the contribute section.