instructure / analytics

The official analytics package for Instructure's Canvas LMS.
GNU Affero General Public License v3.0
35 stars 32 forks source link

Error bundle update when install package analytics #23

Open duclm1992 opened 2 months ago

duclm1992 commented 2 months ago

I try to install package analytics into canvas. When I run command Bunble update, I get the following error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /var/canvas/vendor/bundle/ruby/3.1.0/gems/sqlite3-2.0.2/ext/sqlite3
/usr/bin/ruby3.1 -I /usr/lib/ruby/3.1.0 -r ./siteconf20240612-156544-cl4104.rb extconf.rb
Building sqlite3-ruby using packaged sqlite3.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/$(RUBY_BASE_NAME)3.1
        --help
        --download-dependencies
        --with-sqlcipher
        --without-sqlcipher
        --with-sqlcipher-dir
        --without-sqlcipher-dir
        --with-sqlcipher-include
        --without-sqlcipher-include
        --with-sqlcipher-lib
        --without-sqlcipher-lib
        --enable-system-libraries
        --disable-system-libraries
        --with-sqlcipher
        --without-sqlcipher
        --with-sqlcipher-dir
        --without-sqlcipher-dir
        --with-sqlcipher-include
        --without-sqlcipher-include
        --with-sqlcipher-lib
        --without-sqlcipher-lib
/usr/lib/ruby/3.1.0/psych.rb:455:in `parse_stream': undefined method `parse' for #<Psych::Parser:0x00007f2ce6bc2a18
@handler=#<Psych::Handlers::DocumentStream:0x00007f2ce6bc2b30 @stack=[], @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil,
@end_column=nil, @block=#<Proc:0x00007f2ce6bc2a68 /usr/lib/ruby/3.1.0/psych.rb:399>>, @external_encoding=0> (NoMethodError)

      parser.parse yaml, filename
            ^^^^^^
        from /usr/lib/ruby/3.1.0/psych.rb:399:in `parse'
        from /usr/lib/ruby/3.1.0/psych.rb:324:in `safe_load'
        from /usr/lib/ruby/3.1.0/psych.rb:370:in `load'
        from /usr/lib/ruby/3.1.0/psych.rb:671:in `block in load_file'
        from /usr/lib/ruby/3.1.0/psych.rb:670:in `open'
        from /usr/lib/ruby/3.1.0/psych.rb:670:in `load_file'
        from extconf.rb:161:in `mini_portile_config'
        from extconf.rb:157:in `sqlite3_config'
        from extconf.rb:141:in `minimal_recipe'
        from extconf.rb:51:in `configure_packaged_libraries'
        from extconf.rb:17:in `configure'
        from extconf.rb:284:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /var/canvas/vendor/bundle/ruby/3.1.0/gems/sqlite3-2.0.2 for inspection.
Results logged to /var/canvas/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/sqlite3-2.0.2/gem_make.out

  /usr/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run'
  /usr/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /usr/lib/ruby/3.1.0/tempfile.rb:317:in `open'
  /usr/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /usr/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
  /usr/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /usr/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each'
  /usr/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /usr/lib/ruby/3.1.0/rubygems/installer.rb:853:in `build_extensions'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/rubygems_gem_installer.rb:76:in `build_extensions'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/rubygems.rb:205:in `install'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer/gem_installer.rb:54:in `install'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer/parallel_installer.rb:132:in `do_install'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer/parallel_installer.rb:123:in `block in worker_pool'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/worker.rb:62:in `apply_func'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/worker.rb:57:in `block in process_queue'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/worker.rb:54:in `loop'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/worker.rb:54:in `process_queue'
  /var/canvas/vendor/bundle/ruby/3.1.0/gems/bundler-2.5.10/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing sqlite3 (2.0.2), and Bundler cannot continue.

In Gemfile:
  csv_diff was resolved to 1.0.0, which depends on
    sqlite3

I tried searching on internet but couldn't find a fix. Can someone help me? Thank you!

Source code Canvas I git clone from Intructure/Canvas-lms and install follow guide in Production Start.

ccutrer commented 2 months ago

You seem to be missing Gemfile.lock, or have somehow caused it to become unlocked. Canvas is not compatible with sqlite3 >= 2.0. See https://github.com/instructure/canvas-lms/blob/release/2024-07-03.147/Gemfile.lock#L1089

Cody Cutrer Software Engineer Instructure

duclm1992 commented 2 months ago

You seem to be missing Gemfile.lock, or have somehow caused it to become unlocked. Canvas is not compatible with sqlite3 >= 2.0. See https://github.com/instructure/canvas-lms/blob/release/2024-07-03.147/Gemfile.lock#L1089 - we're locked to 1.7.3. Cody Cutrer Software Engineer Instructure

oh, does that mean my system is running sqlite3 version >=2.0? I tried checking the Gemfile.lock file again, and saw that line 565 was left as is sqlite3 (>= 1.4, < 3.0). Is this the problem I'm having?

duclm1992 commented 2 months ago

You seem to be missing Gemfile.lock, or have somehow caused it to become unlocked. Canvas is not compatible with sqlite3 >= 2.0. See https://github.com/instructure/canvas-lms/blob/release/2024-07-03.147/Gemfile.lock#L1089 - we're locked to 1.7.3. Cody Cutrer Software Engineer Instructure

Thank you very much, I fixed that error by specifying gem 'sqlite3', "~> 1.7.3" in Gemfile, and it worked. However, when I then run rake db:migrate I get the following error:

rake aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  password authentication failed for user "ccne"
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/var/canvas/config/application.rb:187:in `block in postgresql_connection'
/var/canvas/config/application.rb:183:in `each'
....
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/querying.rb:22:in `order'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/tasks/switchman.rake:61:in `scope'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/tasks/switchman.rake:108:in `block (3 levels) in shardify_task'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/switchman/database_server.rb:189:in `unguard'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/tasks/switchman.rake:92:in `block (2 levels) in shardify_task'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/guardrail-3.0.3/lib/guard_rail.rb:11:in `block in activate'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/connection_handling.rb:374:in `with_role_and_shard'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.8.4/lib/active_record/connection_handling.rb:156:in `connected_to'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/guardrail-3.0.3/lib/guard_rail.rb:11:in `activate'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/switchman/guard_rail.rb:13:in `activate'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-inst-jobs-4.0.16/lib/switchman_inst_jobs/guard_rail.rb:10:in `activate'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/switchman-3.6.5/lib/tasks/switchman.rake:91:in `block in shardify_task'
/var/canvas/vendor/bundle/ruby/3.1.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Although in the config/database.yml file I configured the following:

production:
  adapter: postgresql
  encoding: utf8
  database: canvas_production
  host: localhost
  username: canvas
  password: ccneadmin
  timeout: 5000
ccutrer commented 2 months ago

Have you set the environment variable RAILS_ENV to production?