Open rbeason opened 2 years ago
https://github.com/instructure/canvas-lms/wiki/Production-Start
Once your database is configured, and assets are installed, we need to actually fill the database with tables and initial data. You can do this by running our rake migration and initialization tasks from your application's root:
sysadmin@appserver:/var/canvas$ RAILS_ENV=production bundle exec rake db:initial_setup Note (2022-Aug-04): A few issues exist in the initial setup script that can be worked around using the following commands:
sysadmin@appserver:/var/canvas$ mv db/migrate/20210823222355_change_immersive_reader_allowed_on_to_on.rb . sysadmin@appserver:/var/canvas$ mv db/migrate/20210812210129_add_singleton_column.rb db/migrate/20111111214311_add_singleton_column.rb sysadmin@appserver:/var/canvas$ RAILS_ENV=production bundle exec rake db:initial_setup sysadmin@appserver:/var/canvas$ mv 20210823222355_change_immersive_reader_allowed_on_to_on.rb db/migrate/. sysadmin@appserver:/var/canvas$ RAILS_ENV=production bundle exec rake db:migrate
Summary: initial_setup rake aborted, StandardError
Steps to reproduce:
1.run the command RAILS_ENV=production bundle exec rake db:initial_setup
Command Output:
undefined method
id' for nil:NilClass /var/canvas/lib/data_fixup/change_immersive_reader_allowed_on_to_on.rb:24:in
run' /var/canvas/db/migrate/20210823222355_change_immersive_reader_allowed_on_to_on.rb:24:inup' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:830:in
up' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:870:inpublic_send' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:870:in
exec_migration' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:851:inblock (2 levels) in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:850:in
block in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:inwith_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:849:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-inst-jobs-4.0.12/lib/switchman_inst_jobs/active_record/migration.rb:16:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:663:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1037:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1329:in
block in execute_migration_in_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1380:inblock in ddl_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in
block in transaction' /var/canvas/config/initializers/active_record.rb:2184:inblock in within_new_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in
block (2 levels) in synchronize' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:inhandle_interrupt' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in
block in synchronize' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:inhandle_interrupt' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in
synchronize' /var/canvas/config/initializers/active_record.rb:2182:inwithin_new_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in
transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/transactions.rb:209:intransaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/base.rb:35:in
block in transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:inunguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/base.rb:35:in
transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1380:inddl_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1328:in
execute_migration_in_transaction' /var/canvas/config/initializers/active_record.rb:1648:inexecute_migration_in_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1302:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1302:inmigrate_without_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1251:in
block in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1401:inblock in with_advisory_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/migration.rb:40:in
block in with_advisory_lock_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:inwith_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/migration.rb:40:in
with_advisory_lock_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1397:inwith_advisory_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1251:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1086:inup' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1061:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/tasks/database_tasks.rb:237:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:8:in
block in <top (required)>' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:inblock (6 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:inblock (5 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:in
unguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:83:inblock (4 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:206:in
block (2 levels) in with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:62:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:474:in
activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:205:inblock in with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/relation/delegation.rb:88:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/relation/delegation.rb:88:ineach' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:201:in
with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:79:inblock (3 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:in
unguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:77:inblock (2 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/guardrail-3.0.2/lib/guard_rail.rb:11:in
block in activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_handling.rb:388:inwith_role_and_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_handling.rb:175:in
connected_to' /var/canvas/vendor/bundle/ruby/2.7.0/gems/guardrail-3.0.2/lib/guard_rail.rb:11:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/guard_rail.rb:13:in
activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-inst-jobs-4.0.12/lib/switchman_inst_jobs/guard_rail.rb:8:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:76:in
block in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/sentry-ruby-core-5.1.0/lib/sentry/rake.rb:26:inexecute' /var/canvas/lib/tasks/db_load_data.rake:224:in
block (2 levels) in <top (required)>' /var/canvas/vendor/bundle/ruby/2.7.0/gems/sentry-ruby-core-5.1.0/lib/sentry/rake.rb:26:inexecute' /var/canvas/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in
<top (required)>'Caused by: NoMethodError: undefined method
id' for nil:NilClass /var/canvas/lib/data_fixup/change_immersive_reader_allowed_on_to_on.rb:24:in
run' /var/canvas/db/migrate/20210823222355_change_immersive_reader_allowed_on_to_on.rb:24:inup' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:830:in
up' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:870:inpublic_send' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:870:in
exec_migration' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:851:inblock (2 levels) in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:850:in
block in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:inwith_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:849:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-inst-jobs-4.0.12/lib/switchman_inst_jobs/active_record/migration.rb:16:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:663:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1037:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1329:in
block in execute_migration_in_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1380:inblock in ddl_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in
block in transaction' /var/canvas/config/initializers/active_record.rb:2184:inblock in within_new_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in
block (2 levels) in synchronize' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:inhandle_interrupt' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in
block in synchronize' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:inhandle_interrupt' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in
synchronize' /var/canvas/config/initializers/active_record.rb:2182:inwithin_new_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in
transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/transactions.rb:209:intransaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/base.rb:35:in
block in transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:inunguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/base.rb:35:in
transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1380:inddl_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1328:in
execute_migration_in_transaction' /var/canvas/config/initializers/active_record.rb:1648:inexecute_migration_in_transaction' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1302:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1302:inmigrate_without_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1251:in
block in migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1401:inblock in with_advisory_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/migration.rb:40:in
block in with_advisory_lock_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:inwith_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/active_record/migration.rb:40:in
with_advisory_lock_connection' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1397:inwith_advisory_lock' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1251:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1086:inup' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/migration.rb:1061:in
migrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/tasks/database_tasks.rb:237:inmigrate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:8:in
block in <top (required)>' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:inblock (6 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:84:inblock (5 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:in
unguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:83:inblock (4 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:206:in
block (2 levels) in with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:62:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:474:in
activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:205:inblock in with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/relation/delegation.rb:88:in
each' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/relation/delegation.rb:88:ineach' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/shard.rb:201:in
with_each_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:79:inblock (3 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/database_server.rb:153:in
unguard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:77:inblock (2 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/guardrail-3.0.2/lib/guard_rail.rb:11:in
block in activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_handling.rb:388:inwith_role_and_shard' /var/canvas/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.6/lib/active_record/connection_handling.rb:175:in
connected_to' /var/canvas/vendor/bundle/ruby/2.7.0/gems/guardrail-3.0.2/lib/guard_rail.rb:11:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/switchman/guard_rail.rb:13:in
activate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-inst-jobs-4.0.12/lib/switchman_inst_jobs/guard_rail.rb:8:inactivate' /var/canvas/vendor/bundle/ruby/2.7.0/gems/switchman-3.1.3/lib/tasks/switchman.rake:76:in
block in shardify_task' /var/canvas/vendor/bundle/ruby/2.7.0/gems/sentry-ruby-core-5.1.0/lib/sentry/rake.rb:26:inexecute' /var/canvas/lib/tasks/db_load_data.rake:224:in
block (2 levels) in <top (required)>' /var/canvas/vendor/bundle/ruby/2.7.0/gems/sentry-ruby-core-5.1.0/lib/sentry/rake.rb:26:inexecute' /var/canvas/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in
<top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)