Skip to content

Don't create the `wallabag` default user

Currently, because we are running wallabag:install, a default user (wallabag) with a default password (wallabag) gets automagically created. That's not great for two reasons:

  • because the user needs to be then removed for security reasons (an unused user account with a default password... not great!)
  • and because when restarting the container, we get error messages (see below); errors are being ignored and Wallabag runs ok, but that's still not great.

Solution options:

  • wait untill relevant migrations are in master branch of wallabag and then remove wallabag:install invocation;
    • this would most probably happen only when the 2.4 branch gets merged into master;
  • switch to 2.4 branch and remove wallabag:install invocation;
  • manually pull the relevant migrations from the 2.4 branch and apply them, and remove wallabag:install invocation;
  • in entrypoint.sh check if the database is empty, and only then run wallabag:install, removing the wallabag user afterwards
    • far from elegant.

Error messages:

wallabag_1        | Step 3 of 4: Administration setup.
wallabag_1        | ----------------------------------
wallabag_1        | 
wallabag_1        | 
wallabag_1        |                                                                                
wallabag_1        |   [Doctrine\DBAL\Exception\UniqueConstraintViolationException]                 
wallabag_1        |   An exception occurred while executing 'INSERT INTO "wallabag_user" (usernam  
wallabag_1        |   e, username_canonical, email, email_canonical, enabled, salt, password, las  
wallabag_1        |   t_login, confirmation_token, password_requested_at, roles, id, name, dn, cr  
wallabag_1        |   eated_at, updated_at, authCode, twoFactorAuthentication, trusted) VALUES (?  
wallabag_1        |   , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["wall  
wallabag_1        |   abag", "wallabag", "", "", 1, "tRfuh2hltig0Jnkwhtkr\/9GjwuCDp5j68aSqdm0dw4I  
wallabag_1        |   ", "QmylEeeTkc\/Xma9GjYaDsR73vU5n8oTZf45unWG8KAy8789TaKr0Huq4QypM7lXBxYwlgw  
wallabag_1        |   MbzHaqUZTIJueaCg==", null, null, null, "a:2:{i:0;s:9:\"ROLE_USER\";i:1;s:16  
wallabag_1        |   :\"ROLE_SUPER_ADMIN\";}", 3, null, null, "2019-04-20 15:21:11", "2019-04-20  
wallabag_1        |    15:21:11", null, 0, null]:                                                  
wallabag_1        |                                                                                
wallabag_1        |   SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates u  
wallabag_1        |   nique constraint "uniq_1d63e7e592fc23a8"                                     
wallabag_1        |   DETAIL:  Key (username_canonical)=(wallabag) already exists.                 
wallabag_1        |                                                                                
wallabag_1        | 
wallabag_1        |                                                                                
wallabag_1        |   [Doctrine\DBAL\Driver\PDOException]                                          
wallabag_1        |   SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates u  
wallabag_1        |   nique constraint "uniq_1d63e7e592fc23a8"                                     
wallabag_1        |   DETAIL:  Key (username_canonical)=(wallabag) already exists.                 
wallabag_1        |                                                                                
wallabag_1        | 
wallabag_1        |                                                                                
wallabag_1        |   [PDOException]                                                               
wallabag_1        |   SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates u  
wallabag_1        |   nique constraint "uniq_1d63e7e592fc23a8"                                     
wallabag_1        |   DETAIL:  Key (username_canonical)=(wallabag) already exists.  
Edited by Michał Woźniak