TracksApp / tracks

Tracks is a GTD™ web application, built with Ruby on Rails
https://www.getontracks.org/
GNU General Public License v2.0
1.18k stars 538 forks source link

Access denied for user 'tracks'@'172.17.0.3' #2843

Open john2exonets opened 2 years ago

john2exonets commented 2 years ago

Trying to use the Containerized version of Tracks 2.6.1, but getting the "We're sorry, but something went wrong" error when I try to access the app from a browser for the first time. A 'docker logs tracks' dump show the following error:

I, [2022-10-05T23:08:24.718345 #9]  INFO -- : [736d9929-6860-49ca-bb67-fd48592595bc] Started GET "/login" for 172.17.0.1 at 2022-10-05 23:08:24 +0000
I, [2022-10-05T23:08:24.732359 #9]  INFO -- : [736d9929-6860-49ca-bb67-fd48592595bc] Processing by LoginController#login as HTML
I, [2022-10-05T23:08:24.753607 #9]  INFO -- : [736d9929-6860-49ca-bb67-fd48592595bc] Completed 500 Internal Server Error in 21ms (Allocations: 565)
F, [2022-10-05T23:08:24.755115 #9] FATAL -- : [736d9929-6860-49ca-bb67-fd48592595bc]
[736d9929-6860-49ca-bb67-fd48592595bc] Mysql2::Error::ConnectionError (Access denied for user 'tracks'@'172.17.0.3' (using password: YES)):
[736d9929-6860-49ca-bb67-fd48592595bc]
[736d9929-6860-49ca-bb67-fd48592595bc] app/models/user.rb:146:in `no_users_yet?'
[736d9929-6860-49ca-bb67-fd48592595bc] app/controllers/login_controller.rb:25:in `login'

Since Tracks is inside another container, MySQL seems to be having problems with the 'tracks' user. I have tried 'tracks'@'localhost', 'tracks'@'172.17.0.2', & 'tracks'@'172.17.0.3'....none of those seem to work.

What am I doing wrong? I installed my MySQL and Tracks containers using the installation document from this repo.

ZeiP commented 2 years ago

Are you installing using the ”Docker installation using a separate container” instructions? If so, you're probably right – the SQL user needs to be created allowing all hosts to connect! The correct SQL query for creating the user would be mysql> GRANT ALL PRIVILEGES ON tracks.* TO yourmysqluser@'%' IDENTIFIED BY 'password-goes-here' WITH GRANT OPTION;

john2exonets commented 2 years ago

This doesn't work.....still get the same error!!

MariaDB [mysql]> select * from user where user = 'tracks';
+------+--------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+---------+--------------+--------------------+
| Host | User   | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | Delete_history_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin                | authentication_string                     | password_expired | is_role | default_role | max_statement_time |
+------+--------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+---------+--------------+--------------------+
| %    | tracks | *192075E51AD8FAB8349335869018443202C4232E | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      | N                   |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password | *192075E51AD8FAB8349335869018443202C4232E | N                | N       |              |           0.000000 |
+------+--------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+---------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+---------+--------------+--------------------+
1 row in set (0.001 sec)
PS C:\Users\john\ToDo\MYSQL> docker logs tracks
=> Booting Puma
=> Rails 6.0.5.1 application starting in production
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (ruby 2.7.6-p219) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 9
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
I, [2022-10-07T01:41:58.770060 #9]  INFO -- : [640f8f9c-7080-4ef3-a719-fea75fc65c6d] Started GET "/" for 172.17.0.1 at 2022-10-07 01:41:58 +0000
I, [2022-10-07T01:41:58.771701 #9]  INFO -- : [640f8f9c-7080-4ef3-a719-fea75fc65c6d] Processing by TodosController#index as HTML
I, [2022-10-07T01:41:58.773994 #9]  INFO -- : [640f8f9c-7080-4ef3-a719-fea75fc65c6d] Redirected to http://localhost:3000/login
I, [2022-10-07T01:41:58.774158 #9]  INFO -- : [640f8f9c-7080-4ef3-a719-fea75fc65c6d] Filter chain halted as :login_or_feed_token_required rendered or redirected
I, [2022-10-07T01:41:58.774400 #9]  INFO -- : [640f8f9c-7080-4ef3-a719-fea75fc65c6d] Completed 302 Found in 2ms (Allocations: 681)
I, [2022-10-07T01:41:58.777375 #9]  INFO -- : [5a167e05-20f9-4f24-8b94-a10b4cc3b6be] Started GET "/login" for 172.17.0.1 at 2022-10-07 01:41:58 +0000
I, [2022-10-07T01:41:58.777813 #9]  INFO -- : [5a167e05-20f9-4f24-8b94-a10b4cc3b6be] Processing by LoginController#login as HTML
I, [2022-10-07T01:41:58.779397 #9]  INFO -- : [5a167e05-20f9-4f24-8b94-a10b4cc3b6be] Completed 500 Internal Server Error in 2ms (Allocations: 878)
F, [2022-10-07T01:41:58.779809 #9] FATAL -- : [5a167e05-20f9-4f24-8b94-a10b4cc3b6be]
[5a167e05-20f9-4f24-8b94-a10b4cc3b6be] Mysql2::Error::ConnectionError (Access denied for user 'tracks'@'172.17.0.3' (using password: YES)):
[5a167e05-20f9-4f24-8b94-a10b4cc3b6be]
[5a167e05-20f9-4f24-8b94-a10b4cc3b6be] app/models/user.rb:146:in `no_users_yet?'
[5a167e05-20f9-4f24-8b94-a10b4cc3b6be] app/controllers/login_controller.rb:25:in `login'
ZeiP commented 2 years ago

Did you check that logging in directly to the MySQL container works using, for example docker exec -it mariadb mysql -utracks -p

john2exonets commented 2 years ago

I could not find any logs or errors in the Mariadb container:

C:\Users\john\ToDo\MYSQL>docker exec -it tracks-db mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.9.3-MariaDB-1:10.9.3+maria~ubu2204 mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show variables like 'log_error';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_error     |       |
+---------------+-------+
1 row in set (0.005 sec)
PS C:\Users\john\ToDo\MYSQL> docker exec -it tracks-db /bin/bash
root@4decc5c2063f:/# ll /var/log/mysql/
total 8
drwxr-s--- 2 mysql adm  4096 Oct  5 18:21 ./
drwxr-xr-x 1 root  root 4096 Oct  5 18:21 ../
root@4decc5c2063f:/#