thewca / worldcubeassociation.org

All of the code that runs on worldcubeassociation.org
https://www.worldcubeassociation.org/
GNU General Public License v3.0
322 stars 175 forks source link

Banned competitors page bugs #9652

Closed danieljames-dj closed 1 month ago

danieljames-dj commented 1 month ago

This issue is completely in React side.

There are two bugs in Banned Competitors page:

  1. 'Ban new competitor' button is not showing if the list is empty.
  2. 'Ban new competitor' button is showing twice if the list is not empty.
dunkOnIT commented 1 month ago

We might also want to move the button to the top of the list, instead of having it at the bottom? As the list can be quite long

danieljames-dj commented 1 month ago

Yes, that looks like a good suggestion. That can also be implemented.

Whoever is interested to work on this, you can find this page by logging in as WDC Leader and going to WDC Panel.

darshanvss commented 1 month ago

How do I login as a WDC Leader in my local setup

maxidragon commented 1 month ago

How do I login as a WDC Leader in my local setup

If you've imported the developer database dump onto your machine, you can use 2020LONG05 and the password wca.

darshanvss commented 1 month ago

When I am trying to run docker compose up I am getting the following error:

Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306: bind: address already in use,

So I have changed the ports in docker-compose to as follows:

`ports:

on running docker compose build and docker compose up again. That is now running, but i am not able to see anything on localhost:3000. Looking at the logs, I found this,

rails | A server is already running. Check /app/tmp/pids/server.pid. rails | Exiting

I deleted all the containers and build it again to be sure, but I still am getting this issue. Can you share any resource on how to fix this? I am new to it so I am not familiar with where to look for regarding WCA docs

danieljames-dj commented 1 month ago

@darshanvss can you try deleting /app/tmp/pids/server.pid and restart the docker?

darshanvss commented 1 month ago

@danieljames-dj I have tried deleting it before the server starts, in the last line of dockerfile,

CMD ["sh", "-c", "rm -f /rails/tmp/pids/server.pid && ./bin/bundle exec unicorn -c /rails/config/unicorn.rb"]

but it is also resulting in the same error

gregorbg commented 1 month ago

Hey! Sorry to hear you're having trouble with the containers.

  1. The initial error about ports being in use likely happens because your machine is already running some other form of database software. Those typically bind to 3306 on the host machine, so if you have a MySQL server (or similar) already running that is unrelated to our web project, 3306 will be taken. Unfortunately, there is no way (at least not to our knowledge) to tell Docker "please map this internal port to 3306 on the host machine or fall back to 3307 when 3306 is taken". So your manual solution seems appropriate.
  2. The PID error is more mysterious. In general, you don't have to delete tmp/pids folder before every boot. The problem only occurs when Docker doesn't shut down the containers cleanly, and when that happens you can rm -rf [folder to your project Git clone]/tmp/pids completely.

Note that your code snippet boots Unicorn, which is not the server we're using for development. If you try to run Unicorn inside the Dockerfile.dev, you will run into problems because the docker-compose.yml command also runs a WEBrick-based dev server and these two might indeed lock each other out in terms of PID files.

Please try shutting down all Docker containers, then removing the tmp/pids folder entirely, then run the Docker setup without any modifications (except maybe the port mapping mentioned above, that one is okay).

If the problem persists, please look into the actual contents of the server.pid file and see what PID it is pointing to. The Docker Compose output will log all server instances that are booted, and will also log which PIDs they're bound to, similar to this: image

Using that output may help us to debug the issue further.

darshanvss commented 1 month ago

@gregorbg After removing /tmp/pids entirely and running docker setup is working(did not work with default port). Now the App is running 👍 .

When I opened the rankings, I am seeing an empty table. Is that expected outcome or values from test database be populated? I have gone through the Quickstart guide and it has mentioned bin/rake db:reset for a test db setup. I see this being run under docker-compose.yml if ! [[ "mysqlshow --user=root --host=wca_db wca_development" =~ "Tables" ]] ; then echo "Populating development db, this will take a while" && bin/rake db:reset ; .

On searching the logs for the echo msg, I have not found it. I have downloaded WCA developer DB dump zip as @maxidragon has mentioned in a previous comment, but I am not sure how to proceed from here.

maxidragon commented 1 month ago

On searching the logs for the echo msg, I have not found it. I have downloaded WCA developer DB dump zip as @maxidragon has mentioned in a previous comment, but I am not sure how to proceed from here.

You can run bin/rake db:load:development inside the Docker container. This will download and import the developer DB dump onto your machine (it can take about 10-15 minutes to complete).

darshanvss commented 1 month ago

@maxidragon I have run docker exec -it rails bin/rake db:load:development, This is the output logs:

warning: parser/current is loading parser/ruby33, which recognizes 3.3.2-compliant syntax, but you are running 3.3.0.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running via Spring preloader in process 1654
Downloading https://s3.us-west-2.amazonaws.com/assets.worldcubeassociation.org/export/developer/wca-developer-database-dump.zip...  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  436M  100  436M    0     0  1891k      0  0:03:56  0:03:56 --:--:-- 9736k
done in 236.58s
Unzipping dump.zip...Archive:  ./dump.zip
  inflating: wca-developer-database-dump.sql  
done in 27.28s
Clobbering contents of 'wca_development' with ./dump.zip ...Dropped database 'wca_development'
Created database 'wca_development'
ERROR at line 1 in file: 'wca-developer-database-dump.sql': Unknown command '\-'.

And it is stuck at this error line.

When trying to load the rankings page, I am getting a "ActiveRecord::PendingMigrationError Migrations are pending. To resolve this issue, run: bin/rails db:migrate"

On running docker exec -it rails bin/rails db:migrate I am getting this output

warning: parser/current is loading parser/ruby33, which recognizes 3.3.2-compliant syntax, but you are running 3.3.0.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running via Spring preloader in process 2475
rake aborted!
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Active Record release the migration was written for: (StandardError)

  class RenameDrupalIndicesToBeUnique < ActiveRecord::Migration[7.1]
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:606:in `inherited'
/app/db/migrate/20150501004846_rename_drupal_indices_to_be_unique.rb:3:in `<top (required)>'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1188:in `load'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1188:in `load_migration'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1182:in `migration'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1178:in `disable_ddl_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1587:in `use_transaction?'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1534:in `rescue in execute_migration_in_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1522:in `execute_migration_in_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1503:in `each'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1503:in `migrate_without_lock'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1448:in `block in migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1600:in `with_advisory_lock'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1448:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1274:in `up'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1249:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:243:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'

Caused by:
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Active Record release the migration was written for: (StandardError)

  class RenameDrupalIndicesToBeUnique < ActiveRecord::Migration[7.1]
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:606:in `inherited'
/app/db/migrate/20150501004846_rename_drupal_indices_to_be_unique.rb:3:in `<top (required)>'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1188:in `load'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1188:in `load_migration'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1182:in `migration'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1178:in `disable_ddl_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1587:in `use_transaction?'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1579:in `ddl_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1528:in `execute_migration_in_transaction'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1503:in `each'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1503:in `migrate_without_lock'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1448:in `block in migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1600:in `with_advisory_lock'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1448:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1274:in `up'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:1249:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:243:in `migrate'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

But it did not resolve the ActiveRecord::PendingMigrationError

dunkOnIT commented 1 month ago

The ActiveRecord error you're experiencing should resolve upon a successful db import. I have 2 suggestions for getting the import to work:

darshanvss commented 1 month ago

I have left it running and after about 2 hours I am getting this result.

ERROR 2006 (HY000) at line 22370373 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370379 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370380 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370381 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370382 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370383 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370385 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370386 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370387 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370388 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370389 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370390 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2006 (HY000) at line 22370391 in file: 'wca-developer-database-dump.sql': Server has gone away
ERROR 2005 (HY000): Unknown server host 'wca_db' (-2)
ERROR 2005 (HY000): Unknown server host 'wca_db' (-2)
ERROR 2005 (HY000): Unknown server host 'wca_db' (-2)
ERROR 2005 (HY000): Unknown server host 'wca_db' (-2)
ERROR 2005 (HY000): Unknown server host 'wca_db' (-2)
done in 7139.18s
rake aborted!
ActiveRecord::DatabaseConnectionError: There is an issue connecting with your hostname: wca_db. (ActiveRecord::DatabaseConnectionError)

Please check your database configuration and ensure there is a valid connection to your database.
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:44:in `rescue in new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:35:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:159:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:167:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1100:in `any_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:181:in `get_full_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:87:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:657:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:246:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_handling.rb:287:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_handling.rb:254:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:618:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/attributes.rb:264:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:563:in `block in load_schema'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:560:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:560:in `load_schema'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:441:in `attribute_types'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/attribute_methods.rb:256:in `_has_attribute?'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/inheritance.rb:61:in `new'
/app/lib/tasks/db.rake:98:in `block (5 levels) in <top (required)>'
/app/lib/tasks/db.rake:58:in `block (4 levels) in <top (required)>'
/app/lib/tasks/db.rake:57:in `block (3 levels) in <top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'

Caused by:
Mysql2::Error::ConnectionError: Unknown server host 'wca_db' (-2) (Mysql2::Error::ConnectionError)
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:97:in `connect'
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:97:in `initialize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:36:in `new'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:36:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:159:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:167:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1100:in `any_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:181:in `get_full_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:87:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:657:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:246:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_handling.rb:287:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_handling.rb:254:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:618:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/attributes.rb:264:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:563:in `block in load_schema'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:560:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:560:in `load_schema'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/model_schema.rb:441:in `attribute_types'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/attribute_methods.rb:256:in `_has_attribute?'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/inheritance.rb:61:in `new'
/app/lib/tasks/db.rake:98:in `block (5 levels) in <top (required)>'
/app/lib/tasks/db.rake:58:in `block (4 levels) in <top (required)>'
/app/lib/tasks/db.rake:57:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/command_wrapper.rb:40:in `load'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/command_wrapper.rb:40:in `call'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:226:in `block in serve'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in `fork'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in `serve'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:153:in `block in run'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:147:in `run'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application/boot.rb:25:in `<top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'
Tasks: TOP => db:load:development

And in the localhost:3000, this is the output

image

I have tried deleting all the comtainers and starting again, it was resulting in this again. Does it have anything to do with the port number change to 3307?

dunkOnIT commented 1 month ago

This looks like the database is either down or not accessible. Could you check Docker Desktop and see if

If the db is down when this happens, it may be because it can't access the 4gb of RAM it needs - in which case, you need to increase your resource allocation in Docker (see my previous comment).

If resource allocation isn't the issue, then it is probably related to the port number change.

darshanvss commented 1 month ago

i have run sudo docker compose exec wca_on_rails bash -c "RAILS_ENV=test bin/rake db:reset && RAILS_ENV=test bin/rake assets:precompile && bin/rspec"

this is the output

warning: parser/current is loading parser/ruby33, which recognizes 3.3.2-compliant syntax, but you are running 3.3.0.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running via Spring preloader in process 511
rake aborted!
ActiveRecord::DatabaseConnectionError: There is an issue connecting to your database with your username/password, username: root. (ActiveRecord::DatabaseConnectionError)

Please check your database configuration to ensure the username/password are valid.
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:42:in `rescue in new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:35:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:159:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:167:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1100:in `any_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:181:in `get_full_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:87:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:657:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:606:in `block in check_current_protected_environment!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:518:in `with_temporary_pool'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:605:in `check_current_protected_environment!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:69:in `block in check_protected_environments!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:68:in `each'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:68:in `check_protected_environments!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/railties/databases.rake:19:in `block (2 levels) in <top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'

Caused by:
Mysql2::Error::ConnectionError: Access denied for user 'root'@'rails.wca-main' (using password: YES) (Mysql2::Error::ConnectionError)
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:97:in `connect'
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:97:in `initialize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:36:in `new'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:36:in `new_client'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:159:in `connect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:167:in `reconnect'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block in reconnect!'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `reconnect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:788:in `verify!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:795:in `connect!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1001:in `block in with_raw_connection'
/usr/local/bundle/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1113:in `valid_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1100:in `any_raw_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/mysql2_adapter.rb:181:in `get_full_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:87:in `get_database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:374:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:70:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/schema_cache.rb:200:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:871:in `database_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:657:in `check_version'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:678:in `new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:723:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:702:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:654:in `acquire_connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `checkout'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:182:in `connection'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:606:in `block in check_current_protected_environment!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:518:in `with_temporary_pool'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:605:in `check_current_protected_environment!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:69:in `block in check_protected_environments!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:68:in `each'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/tasks/database_tasks.rb:68:in `check_protected_environments!'
/usr/local/bundle/gems/activerecord-7.1.3.4/lib/active_record/railties/databases.rake:19:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/command_wrapper.rb:40:in `load'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/command_wrapper.rb:40:in `call'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:226:in `block in serve'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in `fork'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:190:in `serve'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:153:in `block in run'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application.rb:147:in `run'
/usr/local/bundle/gems/spring-4.2.1/lib/spring/application/boot.rb:25:in `<top (required)>'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/local/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
-e:1:in `<main>'
Tasks: TOP => db:reset => db:drop => db:check_protected_environments
darshanvss commented 1 month ago

I have increase the docker memory limit initially from 4 to 5gb, I have tried again with 8gb, this is the result:

Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running via Spring preloader in process 431
Downloading https://s3.us-west-2.amazonaws.com/assets.worldcubeassociation.org/export/developer/wca-developer-database-dump.zip...  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  438M  100  438M    0     0  7211k      0  0:01:02  0:01:02 --:--:-- 10.1M
done in 62.26s
Unzipping dump.zip...Archive:  ./dump.zip
  inflating: wca-developer-database-dump.sql  
done in 29.84s
Clobbering contents of 'wca_development' with ./dump.zip ...Dropped database 'wca_development'
Created database 'wca_development'
ERROR at line 1 in file: 'wca-developer-database-dump.sql': Unknown command '\-'.
done in 1009.40s
Setting all user passwords to 'wca'...done in 29.15s

However when I am opening the Rankings page, this is what I am getting :

image

I am able to see the users being populated in the background, but this error is coming up

FinnIckler commented 1 month ago

that is an error coming from webpack. look at your console output for more info

darshanvss commented 1 month ago

@FinnIckler I have stopped the containers and started them again, that seems to fix the Issue. I am no longer getting this compilation problem

darshanvss commented 1 month ago

How do I prevent changing the formatting of the code for easier reviewing? I am using prettier. I was not able to prevent it. Is there any linting option that I can run before raising a PR?

danieljames-dj commented 1 month ago

Thanks a lot for working on this, @darshanvss. Not sure if your question is still relevant as the code is merged - but the answer is that you can prevent prettier by disabling it. For linting you can use eslint, which will do the formatting as well. Hope this helps.

I'm closing this bug as the code is now merged.