cachethq / Docker

A Dockerized version of Cachet.
https://cachethq.io
BSD 3-Clause "New" or "Revised" License
415 stars 280 forks source link

Cachet 2.4 - docker-compose #325

Closed cit1zen closed 5 years ago

cit1zen commented 5 years ago

I'm unable to run Cachet 2.4 using docker-compose.

When I use fresh DB image, Cachet will fail with the exception:

cachet_1_99ddaf762e0e | Table chq_sessions does not exist! ...
cachet_1_99ddaf762e0e | Initializing Cachet database ...
postgres_1_cceb3c651c92 | ERROR:  relation "chq_settings" does not exist at character 29
postgres_1_cceb3c651c92 | STATEMENT:  select "name", "value" from "chq_settings"
cachet_1_99ddaf762e0e | 
cachet_1_99ddaf762e0e |                                          
cachet_1_99ddaf762e0e |   Command "app:install" is not defined.  
cachet_1_99ddaf762e0e |                                          
cachet_1_99ddaf762e0e |   Did you mean one of these?             
cachet_1_99ddaf762e0e |       app:name                           
cachet_1_99ddaf762e0e |       app:reset                          
cachet_1_99ddaf762e0e |       app:update                         
cachet_1_99ddaf762e0e |       cachet:install                     
cachet_1_99ddaf762e0e |       migrate:install                    
cachet_1_99ddaf762e0e |                                          
cachet_1_99ddaf762e0e | 

When I use Cachet v2.3.15 to create a DB and then use Cachet 2.4, then I am unable to login into the admin account. Cachet will return 400 with error "CSRF token validation failed.".

Is there something that I am missing? Is there a way how to make Cachet 2.4 work inside the container?

djdefi commented 5 years ago

The upstream 2.4 branch still documents app:install so I am not sure on the correct fix for the 2.4 install at this point

querti commented 5 years ago

@djdefi I found the solution to install Cachet 2.4 on Docker container. Would it be possible to create a separate branch, that I could pull request into? 2.4 has not been officially released, so it would probably do more harm than good to push it into master.

Thanks.

alexcurtin commented 5 years ago

@querti how did you fix this for 2.4 to work?

querti commented 5 years ago

I have changed the command 'php artisan app:install' in entrypoint.sh into 'php artisan cachet:install'

tejaswivinod commented 5 years ago

@querti Hello, Are you able to fix this just by changing 'php artisan cachet:install'. I had to make php artisan cachet:install --no-interaction. But still I get the error of CSRF token validation failed when logging to app with set credentials from setup.

querti commented 5 years ago

@tejaswivinod I'm pretty sure I ran it in interactive mode and simply passed it the desired values by piping it with echo.

tejaswivinod commented 5 years ago

@querti Thanks for the confirmation. I am able to start the cachet, migrations happens successfully. But when I try to login after setup, it throws CSRF token validation failed error. Any leads to the solution? Thanks. I tried seeding demo data, which results into this error


/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php#664
Illuminate\Database\QueryException
SQLSTATE[42803]: Grouping error: 7 ERROR: column "chq_metric_points.created_at" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT to_char(chq_metric_points.created_at, 'YYYY-MM-DD HH2... ^
/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#119
Doctrine\DBAL\Driver\PDOException
SQLSTATE[42803]: Grouping error: 7 ERROR: column "chq_metric_points.created_at" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT to_char(chq_metric_points.created_at, 'YYYY-MM-DD HH2... ^
/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#117``` .                         But that should be another problem.
querti commented 5 years ago

@tejaswivinod Dunno, maybe I didn't get this error because I didn't migrate the database but used the new one.

tejaswivinod commented 5 years ago

@querti above db error is after seeding with demo data by using php artisan cachet:seed . Also, I guess I am able to resolve the validation error by removing all these variables from .env file. mentioned here: https://github.com/CachetHQ/Docker/issues/287. Is that what is expected behavior? I am on branch 2.4.

camilb commented 5 years ago

This config works fine for me: https://github.com/camilb/cachet-docker/commit/8b9bdadf4a63ff5f4be81755e54a67bd69d68bed. Just make sure you set APP_KEY or check docker logs to get the generated key and then set it and restart docker.

djdefi commented 5 years ago

@camilb want to submit a PR here with your fixes?

camilb commented 5 years ago

@djdefi done

Pixcell commented 5 years ago

@tejaswivinod Any progress on fixing this DB issue ?

I got the exact same error on branch 2.4 of docker-compose

jleeh commented 5 years ago

I'm also seeing the same issue as @tejaswivinod when cachet is fetching the metric data on the status page. This is not the demo data, but using the https://github.com/castawaylabs/cachet-monitor in testing locally to push metrics up:

http://localhost/metrics/1

SQLSTATE[42803]: Grouping error: 7 ERROR: column "chq_metric_points.created_at" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT
brakon commented 5 years ago

Worked for me when switching to the 2.4 branch AND then recreating the application (had to delete the images)