Hot questions for Using Spree in git

Question:

Ι have started a Rails Spree project along with a friend, and we use GitHub for version control.

I have created the sample project in my machine, and installed Spree functionality on it. This creates a database with sample products, like so:

When my friend clones the project in his machine and imports it, running rails server fails with MigrationException and asks him to run rake db:migrate.

Running rake db:migrate fails after a few migrations, on nonexisting db column.

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such column: spree_calculators.deleted_at: SELECT  "spree_calculators".* FROM "spree_calculators" WHERE "spree_calculators"."deleted_at" IS NULL  ORDER BY "spree_calculators"."id" ASC LIMIT 1000C:in `find_each'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:15:in `migrate_preferences'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:4:in `up'
C:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: spree_calculators.deleted_at: SELECT  "spree_calculators".* FROM "spree_calculators" WHERE "spree_calculators"."deleted_at" IS NULL  ORDER BY "spree_calculators"."id" ASC LIMIT 1000
C:in `find_each'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:15:in `migrate_preferences'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:4:in `up'
C:in `migrate'
SQLite3::SQLException: no such column: spree_calculators.deleted_at
C:in `find_each'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:15:in `migrate_preferences'
C:/Users/User/xylino/xylino_serena/db/migrate/20151011115236_migrate_old_preferences.spree.rb:4:in `up'
C:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

After that, running rails server again is succesful, but no products or other items can be seen in his sample page, like so:

There has to be something wrong with the database. Parts or all of it are inaccessible, possibly due to security issues because we're sharing the db, but I cannot find a solution. Or maybe it's just a botched migration problem

Any ideas?


Answer:

Rails migrations can sometimes get out-of-date with your live environment. This can happen if you have a separate database team that updates your production environment and forgets to make a migration for it. It can also happen if you update your migrations, forget to re-run them, or somehow get in an inconsistent state.

The best way to do this, is for a new developer on a project to run rake db:schema:load. This will load the database structure from your db/schema.rb file, which will have everything as up-to-date as possible. Afterwards, you can run rake db:migrate just to verify everything is migrated.

However, after that, you will have the structure of the database, but not the content of the database. So say you have a users table with dimitris@example.com as a user. Your colleague will have a users table with no users in it.

To fix that, you can edit the db/seeds.rb file. In there, you can do stuff like:

User.create(name: 'Dimitris Sfounis', email: 'dimitris@example.com', password: 'password123')
User.create(name: 'Some Colleague', email: 'colleague@example.com', password: 'password123')
Product.create(name: 'Ruby on Rails Tote', price: 15.99)
Product.create(name: 'Ruby on Rails Bag', price: 22.99)

The idea here is that you create demo data, enough to get up and running and testing stuff in a brand new and empty database. With that in place, rake db:seed will provide enough data to run the app.

If that is not good enough, and you want exact copies of the database for all the developers, you could upload your SQLite database and have each of them download a new copy when they pull the database down. However, this is tough to manage, because each time someone updates the master branch with a new migration, you'll need to update the SQLite file. For other databases, you can dump and restore with pg_dump (Postgres) or mysqldump (MySQL).

Question:

I have a Rails app (a Spree Commerce store) running on Digital Ocean and deployed through Cloud 66.

I would like to SSH into my server, run a rails console, and adjust some Spree config settings. When I try to do this I get a permissions error:

Errno::EACCES: Permission denied @ dir_s_mkdir - /var/deploy/my-app/web_head/releases/20150220220517/tmp/cache/29B

According to the Spree Developer Guide's page on preferences, this is because preferences are cached into memory to improve performance. The problem (I think) is that my user doesn't have write access to the tmp/cache directory, and it is my user that is running the rails console.

If I ls -l on the $STACK_PATH/tmp/cache directory I get the following:

> lrwxrwxrwx 1 nginx nginx 43 Feb 20 22:05
> tmp/cache ->
> /var/deploy/my-app/web_head/shared/cache

I figure I need to give my user write access to the directory, like the nginx user has. I tried adding myself to the nginx user group, but that didn't seem to have any effect. What can I do to prevent this permissions error?


Answer:

Ok, I figured it out based on this question and answer on Cloud 66's support forum.

I changed the group owner of the cache folder to app_writers, a group that my user is a part of. The Cloud 66 way to do this is with a deploy hook. Here's the yml file that worked for me:

production:
    after_rails:
        command: chown nginx:app_writers /var/deploy/my-app/web_head/current/tmp/cache && chmod -R 775 /var/deploy/my-app/web_head/current/tmp/cache
        target: rails
        run_on: all_servers
        sudo: true

Question:

I really want to deploy an app and had been following railstutorial by Michael Hartl. Now, I'm about to deploy my first app in Digital Ocean but I keep on running on to a lot of problems. Anyway, most of it was already done except on this big one.

I followed the this blog by Hoang Pham and a tutorial by [Andrew Gertig][3].

Anyways, this is my first entry here. Let me say my thanks in advance.Everytime I do, $ cap deploy:cold, on my local machine I always get this error.

failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test'" on 128.199.74.8

And I also notice this one, that's why I did gem uninstall bundler and gem install bundler again in the VPS

[128.199.74.8] executing command  ** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler  **

[out :: 128.199.74.8] ** [out :: 128.199.74.8] troubleshooting

complete log:

    triggering load callbacks
  * 2015-01-23 20:59:18 executing `deploy:cold'
  * 2015-01-23 20:59:18 executing `deploy:update'
 ** transaction: start
  * 2015-01-23 20:59:18 executing `deploy:update_code'
    triggering before callbacks for `deploy:update_code'
  * 2015-01-23 20:59:18 executing `sidekiq:quiet'
  * executing "if [ -d /home/deployer/apps/tiangge/current ] && [ -f /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ] && kill -0 `cat /home/deployer/apps/tiangge/shared/pids/sidekiq.pid`> /dev/null 2>&1; then cd /home/deployer/apps/tiangge/current && bundle exec sidekiqctl quiet /home/deployer/apps/tiangge/shared/pids/sidekiq.pid ; else echo 'Sidekiq is not running'; fi"
    servers: ["128.199.74.8"]
deployer@128.199.74.8's password: 
    [128.199.74.8] executing command
 ** [out :: 128.199.74.8] Sidekiq is not running
 ** [out :: 128.199.74.8] 
    command finished in 1328ms
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@bitbucket.org:bryanbenjamin/tiangge.git master"
    command finished in 4069ms
  * executing "if [ -d /home/deployer/apps/tiangge/shared/cached-copy ]; then cd /home/deployer/apps/tiangge/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard d87bdfba0860752edddcf6e8c021c1468367aa03 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:bryanbenjamin/tiangge.git /home/deployer/apps/tiangge/shared/cached-copy && cd /home/deployer/apps/tiangge/shared/cached-copy && git checkout -q -b deploy d87bdfba0860752edddcf6e8c021c1468367aa03; fi"
    servers: ["128.199.74.8"]
    [128.199.74.8] executing command
    command finished in 10461ms
    copying the cached version to /home/deployer/apps/tiangge/releases/20150123165947
  * executing "cp -RPp /home/deployer/apps/tiangge/shared/cached-copy /home/deployer/apps/tiangge/releases/20150123165947 && (echo d87bdfba0860752edddcf6e8c021c1468367aa03 > /home/deployer/apps/tiangge/releases/20150123165947/REVISION)"
    servers: ["128.199.74.8"]
    [128.199.74.8] executing command
    command finished in 1416ms
  * 2015-01-23 20:59:49 executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * 2015-01-23 20:59:49 executing `deploy:assets:symlink'
  * executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947/public/assets && mkdir -p /home/deployer/apps/tiangge/releases/20150123165947/public && mkdir -p /home/deployer/apps/tiangge/shared/assets && ln -s /home/deployer/apps/tiangge/shared/assets /home/deployer/apps/tiangge/releases/20150123165947/public/assets"
    servers: ["128.199.74.8"]
    [128.199.74.8] executing command
    command finished in 1290ms
  * 2015-01-23 20:59:50 executing `bundle:install'
  * executing "cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test"
    servers: ["128.199.74.8"]
    [128.199.74.8] executing command
 ** [out :: 128.199.74.8] Unfortunately, a fatal error has occurred. Please see the Bundler
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in ``'
 ** [out :: 128.199.74.8] :
 ** [out :: 128.199.74.8] Cannot allocate memory - git clone 'git://github.com/spree/spree_auth_devise.git' "/home/deployer/apps/tiangge/shared/bundle/ruby/2.1.0/cache/bundler/git/spree_auth_devise-68351354588ecb7fa5d7bc278ebd86436a50d33d" --bare --no-hardlinks --quiet
 ** [out :: 128.199.74.8] (
 ** [out :: 128.199.74.8] Errno::ENOMEM
 ** [out :: 128.199.74.8] )
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `block in git'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `call'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/shared_helpers.rb:62:in `with_clean_git_env'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:114:in `git'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:108:in `block in git_retry'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `call'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:38:in `run'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/retry.rb:28:in `attempt'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:107:in `git_retry'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git/git_proxy.rb:73:in `checkout'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/source/git.rb:149:in `specs'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/lazy_specification.rb:53:in `__materialize__'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:88:in `block in materialize'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `map!'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in `materialize'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:132:in `specs'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/definition.rb:121:in `resolve_remotely!'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:79:in `run'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/installer.rb:18:in `install'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli/install.rb:79:in `run'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:145:in `install'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/command.rb:27:in `run'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor.rb:363:in `dispatch'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/vendor/thor/base.rb:440:in `start'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/cli.rb:9:in `start'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:20:in `block in <top (required)>'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.12/bin/bundle:18:in `<top (required)>'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `load'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/bundle:23:in `<main>'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] 
 ** [out :: 128.199.74.8] from /home/deployer/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
 ** [out :: 128.199.74.8] 
    command finished in 56236ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/tiangge/releases/20150123165947; true"
    servers: ["128.199.74.8"]
    [128.199.74.8] executing command
    command finished in 1335ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /home/deployer/apps/tiangge/releases/20150123165947 && bundle install --gemfile /home/deployer/apps/tiangge/releases/20150123165947/Gemfile --path /home/deployer/apps/tiangge/shared/bundle --deployment --quiet --without development test'" on 128.199.74.8

deploy.rb

require "bundler/capistrano"
require "rvm/capistrano"
require 'capistrano/sidekiq'


server "128.199.74.8", :web, :app, :db, primary: true

set :application, "tiangge"
set :user, "deployer"
set :port, 6000
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@bitbucket.org:bryanbenjamin/tiangge.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

namespace :deploy do
  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

  task :setup_config, roles: :app do
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
    run "mkdir -p #{shared_path}/config"
    put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
    puts "Now edit #{shared_path}/config/database.yml and add your username and password"
  end
  after "deploy:setup", "deploy:setup_config"

  task :symlink_config, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "deploy:symlink_config"

  desc "Make sure local git is in sync with remote."
  task :check_revision, roles: :web do
    unless `git rev-parse HEAD` == `git rev-parse origin/master`
      puts "WARNING: HEAD is not the same as origin/master"
      puts "Run `git push` to sync changes."
      exit
    end
  end
  before "deploy", "deploy:check_revision"
end

Steps that I've done:

-reinstalled bundler and -tried set :rvm_bin_path, "/usr/share/ruby-rvm/bin" in deploy.rb

and some few things

Gemfile:

source 'https://rubygems.org'
ruby '2.1.3'

gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc

gem 'spring',        group: :development

gem 'unicorn'
gem 'capistrano'
gem 'rvm-capistrano'
gem 'dotenv-rails'
gem 'capistrano-sidekiq'


gem 'spree', '2.4.2'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-4-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-4-stable'

Answer:

You've got a Cannot allocate memory error. That means not enough RAM for bundler on your deploying machine.

You can add swap partition to do this, or create a DO droplet with bigger RAM space.

Good tutorial about adding a swap to DO droplet https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04

Question:

I'm using a forked repository of spree-commerce for my project. So far, I was working and merging my changes to origin/2-3-stable and everything was peachy. Problem is, SpreeCommerce release a new version (2-4) and created a new branch for it (2-4-stable): merging my work into the newly created 2-4-stable branch means not only merging my own changes but also all the changes and conflicts between the two versions.

Iv'e tried creating a new branch based on 2-3 and cherry-pick my specific commits, but when I try merging it with 2-4 I get lot's of conflicts not related to these commits at all.

Is there anyway I can merge only my commits into the new branch without needing to resolve unrelated conflicts?


Answer:

You could rebase the upstream 2.4 branch onto your branch, i.e.:

git rebase origin/2-4-stable

Or, if your changes are in a few commits, you could checkout a new branch off 2.4 (not 2.3 as you did) and cherry pick your commits into that:

git checkout -b my-branch-on-top-of-2-4 origin/2-4-stable
git cherry-pick COMMIT
...

Question:

Background: Try to push spree to heroku. It work ok in localhost:3000 but no luck in heroku.

After push heroku master, it's was no error. But when open heroku it's display Application Error.

Can anyone help get rid the "wrong number of arguments"

When heroku open

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

In the heroku logs, there is timeout as follow

Starting process with command `bundle exec unicorn -p 56138 -c ./config/unicorn.rb`
2016-08-18T05:52:21.426098+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/unicorn- 5.1.0/lib/unicorn/configurator.rb:196:in `timeout': wrong number of arguments (0 for 1) (ArgumentError)

Answer:

Error happened from follow someone blog code here

worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
  puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
  Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
  ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
  puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
  ActiveRecord::Base.establish_connection
end

Which has error from second line

timeout

removed that timeout then it worked.

Question:

I have created a spree site with rails. However the admin wont display mail or image settings? I was wondering if anyone could give me any guidance as to why and how to resolve?

Thanks

Gemfile with relevant spree info is below:

gem 'spree', '2.3.2'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-3-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-3-stable'
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend', branch: '2-3-stable'

gem 'aws-sdk'

Answer:

Spree has extracted the mail settings out into a gem now I believe. It now works by reading your regular rails action mailer settings, usually set in an initializer or environment file.

If you want the legacy mail settings back, you can checkout https://github.com/spree-contrib/spree_mail_settings