XUtils

Solidus

An open source, eCommerce application for high volume retailers.


Main Contributor & Director

At present, Nebulab is the main code contributor and director of Solidus, providing technical guidance and coordinating community efforts and activities.

Nebulab

Summary

Solidus is a complete open source ecommerce solution built with Ruby on Rails. It is a fork of Spree.

See the Solidus class documentation and the Solidus Guides for information about the functionality that Solidus provides.

Solidus consists of several gems. When you require the solidus gem in your Gemfile, Bundler will install all of the following gems:

All of the gems are designed to work together to provide a fully functional ecommerce platform. However, you may only want to use the solidus_core gem combine it with your own custom frontend, admin interface, and API.

Demo

You can try the live Solidus demo here. The admin section can be accessed here.

Getting started

Begin by making sure you have Imagemagick installed, which is required for Paperclip. (You can install it using Homebrew if you’re on a Mac.)

To add Solidus, begin with a newly created Rails application with its database.

rails new my_store

Installing Solidus

In your application’s root folder run:

bundle add solidus
bin/rails g solidus:install

And follow the prompt’s instructions.

Accessing Solidus Store

Start the Rails server with the command:

bin/rails s

The storefront will be accessible at http://localhost:3000/ and the admin can be found at http://localhost:3000/admin/.

For information on how to customize your store, check out the customization guides.

Performance

You may notice that your Solidus store runs slowly in development mode. This can be because in development each CSS and JavaScript is loaded as a separate include. This can be disabled by adding the following to config/environments/development.rb.

config.assets.debug = false

To gain some extra speed you may enable Turbolinks inside of Solidus admin.

Add gem 'turbolinks', '~> 5.0.0' into your Gemfile (if not already present) and change vendor/assets/javascripts/spree/backend/all.js as follows:

//= require turbolinks
//
// ... current file content
//
//= require spree/backend/turbolinks-integration.js

CAUTION Please be aware that Turbolinks can break extensions and/or customizations to the Solidus admin. Use at your own risk.

Developing Solidus

  • Clone the Git repo
  git clone git://github.com/solidusio/solidus.git
  cd solidus

Without Docker

  • Install the gem dependencies
  bin/setup

Note: If you’re using PostgreSQL or MySQL, you’ll need to install those gems through the DB environment variable.

  # PostgreSQL
  export DB=postgresql
  bin/setup

  # MySQL
  export DB=mysql
  bin/setup

With Docker

docker-compose up -d

Wait for all the gems to be installed (progress can be checked through docker-compose logs -f app).

You can provide the ruby version you want your image to use:

docker-compose build --build-arg RUBY_VERSION=3.0 app
docker-compose up -d

The rails version can be customized at runtime through RAILS_VERSION environment variable:

RAILS_VERSION='~> 5.0' docker-compose up -d

Running tests:

# sqlite
docker-compose exec app bin/rspec
# postgres
docker-compose exec app env DB=postgres bin/rspec
# mysql
docker-compose exec app env DB=mysql bin/rspec

Accessing the databases:

# sqlite
docker-compose exec app sqlite3 /path/to/db
# postgres
docker-compose exec app env PGPASSWORD=password psql -U root -h postgres
# mysql
docker-compose exec app mysql -u root -h mysql -ppassword

In order to be able to access the sandbox application, just make sure to provide the appropriate --binding option to rails server. By default, port 3000 is exposed, but you can change it through SANDBOX_PORT environment variable:

SANDBOX_PORT=4000 docker-compose up -d
docker-compose exec app bin/sandbox
docker-compose exec app bin/rails server --binding 0.0.0.0 --port 4000

Tests

Solidus uses RSpec for tests. Refer to its documentation for more information about the testing library.

CircleCI

We use CircleCI to run the tests for Solidus as well as all incoming pull requests. All pull requests must pass to be merged.

You can see the build statuses at https://circleci.com/gh/solidusio/solidus.

Run all tests

ChromeDriver is required to run the backend test suites.

To execute all of the test specs, run the bin/build script at the root of the Solidus project:

createuser --superuser --echo postgres # only the first time
bin/build

The bin/build script runs using PostgreSQL by default, but it can be overridden by setting the DB environment variable to DB=sqlite or DB=mysql. For example:

env DB=mysql bin/build

If the command fails with MySQL related errors you can try creating a user with this command:

# Creates a user with the same name as the current user and no restrictions.
mysql --user="root" --execute="CREATE USER '$USER'@'localhost'; GRANT ALL PRIVILEGES ON * . * TO '$USER'@'localhost';"

Run an individual test suite

Each gem contains its own series of tests. To run the tests for the core project:

cd core
bundle exec rspec

By default, rspec runs the tests for SQLite 3. If you would like to run specs against another database you may specify the database in the command:

env DB=postgresql bundle exec rspec

Code coverage reports

If you want to run the SimpleCov code coverage report:

COVERAGE=true bundle exec rspec

Articles

  • coming soon...