DigitalNZ / supplejack_installation

Supplejack Stack Application Template
http://digitalnz.github.io/supplejack/start/install-setup.html
GNU General Public License v3.0
2 stars 1 forks source link

Application template role in Production install #3

Closed telezoic closed 6 years ago

telezoic commented 7 years ago

Hi folks, my apologies if this isn't the right place for my question.

I'm working through the production install documentation at http://digitalnz.github.io/supplejack/start/production-install.html. I've installed all the dependencies on a RHEL 7 server, and now at step 2 I'm directed to 'refer' to the application template. By 'refer' I'm thinking maybe I need to execute the processes in the template? In the Development set-up I see we run the the application template, but there are no explicit instructions to do this for the Production Install. I'm thinking there's no 'initialization' otherwise, just some bundle commands and then rails console errors. Any tips you could share with me would be enthusiastically, and gratefully received :)

Thanks,

D

hapiben commented 7 years ago

Hi @telezoic,

Apologies for my late response. For productionising SJ, the setup depends. The template purpose is mainly for the development environment to get started with SJ quickly.

We're using capistrano to deploy SJ on both staging and production servers. Unfortunately, capistrano is not part of any SJ apps because we moved them to a single internal capistrano config.

In your manager, worker and api, you need to add capistrano gem to properly deploy the app to your servers.

group :development do
  gem "capistrano", "~> 3.9"
end

and run bundle exec cap install on all apps. Have a look into the official capistrano README.

Basically, capistrano will clone the projects and upload it to your servers by using cap commands.

Once you have all the code, you can start referencing them to your web server, either Apache or Nginx.

If you have questions, please let me know. I'll reply as soon as I can.

Ben

telezoic commented 7 years ago

Hi Ben, Thanks for this. I'm working through the development setup docs, and I've added the capistrano gem to the apps and bundle exec cap install goes well

But before I get there, I get an error that looks like it comes from the last stage of the application template at:

file 'db/seeds.rb', code, force: true
rake 'db:seed --trace'
gsub_file('db/seeds.rb', /^\"|puts\s(.*)\s/, '', verbose: false)

The error:

         run    bundle exec rake db:seed from "/data/sites/supplejack_worker"
I, [2017-09-21T12:01:09.568531 #41407]  INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
         run    bundle exec rails server -p3002 > /dev/null 2>&1 & from "/data/sites/supplejack_worker"
         run    bundle exec sidekiq > /dev/null 2>&1 & from "/data/sites/supplejack_worker"
       route    get 'welcome', to: 'application#welcome'
       force    app/controllers/application_controller.rb
      create    app/views/application/welcome.html.erb
         run    bundle exec rails server -p3000 > /dev/null 2>&1 & from "."
       force    db/seeds.rb
        rake    db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
NoMethodError: undefined method `record_class' for #<Rails::Application::Configuration:0x0056335c0df008>

It looks like the api seed data populates, however as I can see it with:

irb(main):001:0>` SupplejackApi::User.find_by_api_key("_pY8kpGk_GU2QgMHfYFj")
  MOPED: 127.0.0.1:27017 COMMAND      database=admin command={:ismaster=>1} runtime: 2.9070ms
  MOPED: 127.0.0.1:27017 QUERY        database=supplejack_api_development collection=users selector={"$query"=>{"authentication_token"=>"_pY8kpGk_GU2QgMHfYFj"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.6221ms
=> #<SupplejackApi::User _id: 59b04ef76ff8212105000000, created_at: 2017-09-06 19:39:35 UTC, updated_at: 2017-09-06 19:39:35 UTC, email: "test@example.com", encrypted_password: nil, name: "Test User", username: nil, sign_in_count: nil, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: "_pY8kpGk_GU2QgMHfYFj", daily_requests: 0, monthly_requests: 0, max_requests: 10000, role: "admin", daily_activity: nil, daily_activity_stored: true>

But then further attempts to create other API keys fail:

irb(main):003:0> SupplejackApi::User.create(email: 'bcdluser@viu.ca', name: 'bcdl', username: 'bcdluser')
NoMethodError: undefined method `record_class' for #<Rails::Application::Configuration:0x00556d0413cdf8>

I was hoping you might have some insights/suggestions on this :)

Thanks again,

D.

hapiben commented 7 years ago

Hi Dan,

There's a couple of changes in the SJ engine. This is the latest Git SHA 8913320. Can you verify that you're using the latest HEAD of SJ API engine gem?

There's a couple of changes, but the record_class is something that was added recently.

Setup a custom record model from your API. Although this is something optional, it would be great to get the latest changes so I can replicate the issue on my end.

Cheers, Ben

telezoic commented 7 years ago

Thanks Ben! I'm using a forked application_template.rb that is pulling from the most recent commit to master: gem 'supplejack_api', git: 'https://github.com/digitalnz/supplejack_api.git' git rev-parse HEAD ea063887a56cbdee59eeb3bcc56a83a96b734eed I see, however, there are newer versions on the branches, I have not tried any of these . . .

Here's a fuller trace of the error:

   run    bundle exec rake db:seed from "/data/sites/supplejack_worker"
I, [2017-09-25T13:31:08.859443 #58042]  INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
         run    bundle exec rails server -p3002 > /dev/null 2>&1 & from "/data/sites/supplejack_worker"
         run    bundle exec sidekiq > /dev/null 2>&1 & from "/data/sites/supplejack_worker"
       route    get 'welcome', to: 'application#welcome'
       force    app/controllers/application_controller.rb
      create    app/views/application/welcome.html.erb
         run    bundle exec rails server -p3000 > /dev/null 2>&1 & from "."
       force    db/seeds.rb
        rake    db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
NoMethodError: undefined method `record_class' for #<Rails::Application::Configuration:0x0055dbaadcfe20>
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.1.7/lib/rails/railtie/configuration.rb:95:in `method_missing'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/concerns/user_set.rb:10:in `block in <module:UserSet>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/concern.rb:120:in `class_eval'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/concern.rb:120:in `append_features'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/user_set.rb:15:in `include'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/user_set.rb:15:in `<class:UserSet>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/user_set.rb:10:in `<module:SupplejackApi>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/user_set.rb:9:in `<top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443:in `block in load_file'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:633:in `new_constants_in'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:442:in `load_file'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:342:in `require_or_load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:480:in `load_missing_constant'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:180:in `const_missing'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/inflector/methods.rb:240:in `const_get'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/inflector/methods.rb:240:in `block in constantize'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/inflector/methods.rb:236:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/inflector/methods.rb:236:in `inject'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/inflector/methods.rb:236:in `constantize'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/metadata.rb:575:in `klass'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/referenced/many.rb:563:in `criteria'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/metadata.rb:181:in `criteria'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/builders/referenced/many.rb:20:in `build'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:43:in `create_relation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:26:in `__build__'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:104:in `block (2 levels) in get_relation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/threaded/lifecycle.rb:125:in `_loading'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:100:in `block in get_relation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/threaded/lifecycle.rb:84:in `_building'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:99:in `get_relation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:187:in `block in getter'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/validatable.rb:73:in `block in read_attribute_for_validation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/relations/accessors.rb:140:in `without_autobuild'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/validatable.rb:73:in `read_attribute_for_validation'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validator.rb:165:in `block in validate'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validator.rb:164:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validator.rb:164:in `validate'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:447:in `public_send'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:447:in `block in make_lambda'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:184:in `block in simple'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:185:in `block in simple'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:86:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/interceptable.rb:138:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validations.rb:376:in `run_validations!'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validations/callbacks.rb:111:in `block in run_validations!'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:113:in `call'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:166:in `block in halting'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:166:in `block in halting'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:86:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/interceptable.rb:138:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validations/callbacks.rb:111:in `run_validations!'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validations.rb:317:in `valid?'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/validatable.rb:97:in `valid?'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-4.1.7/lib/active_model/validations.rb:352:in `invalid?'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:114:in `prepare_insert'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:23:in `insert'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/savable.rb:23:in `save'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:148:in `block in create'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/threaded/lifecycle.rb:156:in `_creating'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:143:in `create'
/data/sites/supplejack_api/db/seeds.rb:2:in `<top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `block in load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.1.7/lib/rails/engine.rb:543:in `load_seed'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.7/lib/active_record/tasks/database_tasks.rb:184:in `load_seed'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.7/lib/active_record/railties/databases.rake:174:in `block (2 levels) in <top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `block in execute'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `execute'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:181:in `invoke'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:153:in `invoke_task'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `block (2 levels) in top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `block in top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:118:in `run_with_threads'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:103:in `top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:81:in `block in run'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:179:in `standard_exception_handling'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:78:in `run'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/bin/rake:23:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/bin/rake:23:in `<main>'
Tasks: TOP => db:seed

Thanks again, D.

hapiben commented 7 years ago

Hi Dan,

I had a look into this issue and this is something caused by the SJ config changes. It looks like the default config that was added was not getting recognised by the engine.

To fix this temporarily, you can create a file called supplejack_api.rb under your config/initializers folder. Put the following snippet.

SupplejackApi.setup do |config|
  config.record_class = SupplejackApi::Record
  config.preview_record_class = SupplejackApi::PreviewRecord
end

And try running the db:seed again. I'll report this issue to the team.

Thanks, Ben

telezoic commented 7 years ago

Thanks Ben. I have added the above file and ran db:seed This fix lets me create a new API user. Which is great! the rake db:seed still aborts, however, but at a later point in the process. Below is the full trace:

[bcdluser@eln-sj1 supplejack_api]$ rake db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
NoMethodError: undefined method `name' for #<SupplejackApi::Fragment:0x00557f6b2d0498>
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/attributes/dynamic.rb:136:in `method_missing'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/support/fragment_helpers.rb:81:in `public_send'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/supplejack_api-ea063887a56c/app/models/supplejack_api/support/fragment_helpers.rb:81:in `method_missing'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/data_extractor.rb:17:in `value_for'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/field_factory.rb:39:in `extract_value'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/field_factory.rb:75:in `populate_document'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:111:in `block in prepare_full_update'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:110:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:110:in `prepare_full_update'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:25:in `block in add'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:25:in `map'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/indexer.rb:25:in `add'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/session.rb:91:in `index'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot-2.2.7/lib/sunspot.rb:184:in `index'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot_rails-2.2.7/lib/sunspot/rails/searchable.rb:434:in `solr_index'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot_rails-2.2.7/lib/sunspot/rails/searchable.rb:551:in `perform_index_tasks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:424:in `block in make_lambda'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/callbacks.rb:86:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/interceptable.rb:138:in `run_callbacks'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:115:in `prepare_insert'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/creatable.rb:23:in `insert'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/savable.rb:23:in `save'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mongoid-4.0.0/lib/mongoid/persistable/savable.rb:44:in `save!'
/data/sites/supplejack_api/db/seeds.rb:25:in `<top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `block in load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.1.7/lib/rails/engine.rb:543:in `load_seed'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.7/lib/active_record/tasks/database_tasks.rb:184:in `load_seed'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.7/lib/active_record/railties/databases.rake:174:in `block (2 levels) in <top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `block in execute'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:251:in `execute'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/task.rb:181:in `invoke'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:153:in `invoke_task'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `block (2 levels) in top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `each'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:109:in `block in top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:118:in `run_with_threads'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:103:in `top_level'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:81:in `block in run'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:179:in `standard_exception_handling'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/lib/rake/application.rb:78:in `run'
/home/bcdluser/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/bcdluser/.rbenv/versions/2.3.1/bin/rake:23:in `load'
/home/bcdluser/.rbenv/versions/2.3.1/bin/rake:23:in `<main>'
Tasks: TOP => db:seed

it looks like /data/sites/supplejack_api/db/seeds.rb:25 is the command record.save! I'm not sure if there's a temporary fix I can apply like the one you offered above?

Thanks again,

D.

hapiben commented 7 years ago

Hi @telezoic Sorry for the late response.

The issue was the Fragment class needs to be a RecordFragment class.

I've updated the template to reflect the changes.

https://github.com/DigitalNZ/supplejack_installation/blob/master/supplejack_api_template.rb#L245

Cheers, Ben

telezoic commented 6 years ago

Hi @hapiben,

I've come back to this after a long absence with a fresh forks. When I run the template, I correct the following:

[!] There was an error parsing `Gemfile`: syntax error, unexpected tIDENTIFIER, expecting end-    of-input - gem 'whenever', '~> 0.9'
         ^. Bundler cannot continue.

 #  from /data/sites/supplejcak_api/Gemfile:60
 #  -------------------------------------------
 #  gem 'mongoid_auto_increment
 >  gem 'whenever', '~> 0.9'

and things pick up again until I get:

Bundler could not find compatible versions for gem "activemodel":
  In snapshot (Gemfile.lock):
    activemodel (= 5.1.4)

  In Gemfile:
    supplejack_api was resolved to 1, which depends on
      active_model_serializers was resolved to 0.1.0, which depends on
        activemodel (~> 4.0)

    rails (~> 5.1.4) was resolved to 5.1.4, which depends on
      activemodel (= 5.1.4)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
        rake    sunspot:solr:start
The git source https://github.com/boost/active_model_serializers.git is not yet checked out. Please run `bundle install` before trying to start your application

I've tried to modify the gemfile/Gemfile.lock to get past this to no avail (by referencing activemodel (~> 4.0), and a bundle install for the boost repo gives me the same errors. Hoping you have some suggestions.

Happy new year,

D

ostigley commented 6 years ago

Hi @telezoic just checking in in @hapiben's absence.

We have recently upgraded the supplejack_api gem to use rails 5. Can I ask which commit you are getting these errors on? The same one you mentioned before? ea063887a56cbdee59eeb3bcc56a83a96b734eed ?

telezoic commented 6 years ago

Thanks Oliver.

I thought I'd start with the most recent commit (that I could see).

I'm running c1f22f3d218ce1290c02f3a591c6819fc15ecb72 with rails 5.1.4.

D.


From: Oliver Stigley notifications@github.com Sent: Wednesday, January 10, 2018 4:37:59 PM To: DigitalNZ/supplejack_installation Cc: Daniel Sifton; Mention Subject: Re: [DigitalNZ/supplejack_installation] Application template role in Production install (#3)

Hi @telezoichttps://github.com/telezoic just checking in in @hapibenhttps://github.com/hapiben's absence.

We have recently upgraded the supplejack_api gem to use rails 5. Can I ask which commit you are getting these errors on? The same one you mentioned before? ea063887a56cbdee59eeb3bcc56a83a96b734eed ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/DigitalNZ/supplejack_installation/issues/3#issuecomment-356785765, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAbI6BJPqLHbMAwp4yknWwyitFjXNZdKks5tJVfngaJpZM4PO99s.

ostigley commented 6 years ago

aha, sorry @telezoic, looks like we updated the supplejack_api gem but not updated this repo. Let me get a story in our backlog for this, and we can hopefully have everything up and running in a week for you.

@dan-dnz flagging this for your attention.

ostigley commented 6 years ago

@telezoic we have updated this repo and the sj_api repo to work better together. If you pull master here, everything should work for you. Let me know if you have any other problems.

Closing this issue.