Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup fails with unable to find /root/.my.cnf #153

Closed
m-strasser opened this issue Mar 12, 2019 · 3 comments
Closed

Startup fails with unable to find /root/.my.cnf #153

m-strasser opened this issue Mar 12, 2019 · 3 comments

Comments

@m-strasser
Copy link

I'm trying to set up the wallabag docker container on a Raspberry Pi 3 running Raspbian.

I cloned the repository, built the image from the Dockerfile and exchanged the images in the docker-compose.yml accordingly (wallabag_rpi and rpi-mariadb):

version: '3'
services:
  wallabag:
    image: wallabag_rpi
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql                                   
      - SYMFONY__ENV__DATABASE_HOST=db
      - SYMFONY__ENV__DATABASE_PORT=3306
      - SYMFONY__ENV__DATABASE_NAME=wallabag                                      
      - SYMFONY__ENV__DATABASE_USER=wallabag                                      
      - SYMFONY__ENV__DATABASE_PASSWORD=mydbpassword          
      - SYMFONY__ENV__DATABASE_CHARSET=utf8mb4                                    
      - SYMFONY__ENV__MAILER_HOST=127.0.0.1                                       
      - SYMFONY__ENV__MAILER_USER=~
      - SYMFONY__ENV__MAILER_PASSWORD=~
      - [email protected]                          
      - SYMFONY__ENV__DOMAIN_NAME=wallabag.mydomain.com                        
    ports:
      - "8002:80"
    volumes:
      - wallabag:/var/www/wallabag/data
      - wallabag_images:/var/www/wallabag/web/assets/images                       
  db:
    image: monstrenyatko/rpi-mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot                      
    volumes:
      - /opt/wallabag/data:/var/lib/mysql                                         
volumes:
  wallabag:
  wallabag_images:

Starting a wallabag_rpi container then failes with:

Starting provisioner...
 [WARNING]: Found both group and host with same name: localhost
PLAY [localhost] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var 
TASK [Gathering Facts] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] 
TASK [needed dirs] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] => (item=/var/www/wallabag/app) ok: [localhost] => (item=/var/www/wallabag/app/config) ok: [localhost] => (item=/var/www/wallabag/data) ok: [localhost] => (item=/var/www/wallabag/data/assets) ok: [localhost] => (item=/var/www/wallabag/data/db) 
TASK [write parameters.yml] bin dev entrypoint.sh etc home lib media
mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] 
TASK [stat] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var skipping: [localhost] 
TASK [notify install for sqlite] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var skipping: [localhost] 
TASK [wait for db container] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] 
TASK [add mariadb db] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var fatal: [localhost]: 
FAILED! => {"changed": false, "msg": "unable to find /root/.my.cnf. Exception message: (1045, \"Access denied for user 'root'@'172.19.0.2' (using password: YES)\")"} to retry, use: --limit @/etc/ansible/entrypoint.retry 
PLAY RECAP bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var localhost : ok=4 changed=0 unreachable=0 failed=1  
Provisioner finished.
@Zayon
Copy link

Zayon commented Sep 29, 2019

Hi, I had the same issue.

It's the mysql_db ansible module that fails
Try adding POPULATE_DATABASE=false environment variable.
If your database is not already populated, try the manually populate it from the container once the provisioner finish without errors.

Also I see that you have a volume mounted in /var/www/wallabag/data this may prevent git from cloning the wallabag sources in the /var/www/wallabag directory so check that you have everything in the /var/www/wallabag directory.

@nickyeoman
Copy link

I also had the same issue.

In the hopes of saving someone else time, the Ansible script that runs is located here:
entrypoint.yml

for some reason when Ansible tries to connect to the db host, mariadb closes the connetion:
[Warning] Aborted connection 8 to db: 'unconnected' user: 'unauthenticated' host: '192.168.0.4' (This connection closed normally without authentication)

even though when you connect to the container:
docker exec -it dcebf5dcbda1 sh

you can connect to the database just fine:
mysql -h $SYMFONY__ENV__DATABASE_HOST -u root -p$MYSQL_ROOT_PASSWORD

But if I manually run the playbook:
ansible-playbook -i /etc/ansible/hosts /etc/ansible/entrypoint.yml -c local "$@"

I get the warning:
[WARNING]: Found both group and host with same name: localhost

But the playbook successfully completes.

If it doesn't (or if you have defined the mariadb user and database name in your compose file) you can try the POPULATE_DATABASE=false and then run php bin/console wallabag:install --env=prod -n from the /var/www/wallabag directory.

I think (untested) if you ran ansible-playbook -i ${HOSTNAME}, /etc/ansible/entrypoint.yml -c local "$@" instead of using an inventory and there was a check for if {{ database_name }} exists - name: add mariadb db in the playbook, it might work a little better. But I'm not sure how to stop mariadb from closing the connection.

hope this helps.

@j0k3r
Copy link
Member

j0k3r commented Nov 30, 2022

Ansible has been replaced by shell script few days ago #307, so I'm closing that issue.

@j0k3r j0k3r closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants