nuxsmin / docker-syspass

Docker stuff for running sysPass on Docker
GNU General Public License v3.0
39 stars 21 forks source link

Installation error #5

Closed A1CY0N closed 7 years ago

A1CY0N commented 7 years ago

I have this message when installing syspass :

SQLSTATE[HY000] [1130] Host 'syspass-app.dockercompose_default' is not allowed to connect to this MySQL server

What can I do ?

nuxsmin commented 7 years ago

Did you set up sysPass using Docker compose?. Both containers should be in the same network.

A1CY0N commented 7 years ago

Yes, of course. Here is my docker-compose file :

version: '2'

services:

  nginx-proxy:
     restart: always
     image: jwilder/nginx-proxy
     ports:
       - "80:80"
       - "443:443"
     volumes:
       - /srv/docker/nginx/certs:/etc/nginx/certs:ro
       - /etc/nginx/vhost.d
       - /usr/share/nginx/html
       - /var/run/docker.sock:/tmp/docker.sock:ro

  nginx-proxy-companion:
     image: jrcs/letsencrypt-nginx-proxy-companion
     volumes:
       - /srv/docker/nginx/certs:/etc/nginx/certs:rw
       - /var/run/docker.sock:/var/run/docker.sock
     volumes_from:
       - nginx-proxy

  codiad:
     container_name: codiad
     image: wernight/codiad
     environment:
       - VIRTUAL_HOST=test1.toto.fr
       - LETSENCRYPT_HOST=test1.toto.fr
       - LETSENCRYPT_EMAIL=test@gmail.fr

  app:
    container_name: syspass-app
    image: nuxsmin/docker-syspass:latest
    restart: always
    ports:
      - "800:80"
      - "444:443"
    links:
      - db
    environment:
      - VIRTUAL_HOST=test2.toto.fr
      - LETSENCRYPT_HOST=test2.toto.fr
      - LETSENCRYPT_EMAIL=test@gmail.fr
    volumes:
      - /var/www/html/sysPass/config
      - /var/www/html/sysPass/backup
  db:
    container_name: syspass-db
    restart: always
    image: nuxsmin/docker-syspass:mysql
    ports:
      - "3306"
    environment:
      - DB_REMOTE_HOST=test2.toto.fr
      - DB_REMOTE_ROOT_PASS=syspass
      - MYSQL_PASSWORD=syspass
      - MYSQL_DATABASE=syspass
    volumes:
      - /var/lib/mysql
nuxsmin commented 7 years ago

So you set the db remote host to test2.toto.fr but the sysPass app host is named syspass-app, so MySQL won't let it logging in.

Are you setting nginx in front of an Apache server?. I would set nginx as the front-end server by using fast CGI for serving PHP scripts

A1CY0N commented 7 years ago

I need to name the syspass container test2.toto.fr or I need to set the DB_REMOTE_HOST environment variable to syspass-app ?

A1CY0N commented 7 years ago

I try this docker-compose but it does'nt work :

version: '2'

services:

  nginx-proxy:
     restart: always
     image: jwilder/nginx-proxy
     ports:
       - "80:80"
       - "443:443"
     volumes:
       - /srv/docker/nginx/certs:/etc/nginx/certs:ro
       - /etc/nginx/vhost.d
       - /usr/share/nginx/html
       - /var/run/docker.sock:/tmp/docker.sock:ro

  nginx-proxy-companion:
     image: jrcs/letsencrypt-nginx-proxy-companion
     volumes:
       - /srv/docker/nginx/certs:/etc/nginx/certs:rw
       - /var/run/docker.sock:/var/run/docker.sock
     volumes_from:
       - nginx-proxy

  codiad:
     container_name: codiad
     image: wernight/codiad
     environment:
       - VIRTUAL_HOST=test1.toto.fr
       - LETSENCRYPT_HOST=test1.toto.fr
       - LETSENCRYPT_EMAIL=test@gmail.fr

  app:
    container_name: syspass-app
    image: nuxsmin/docker-syspass:latest
    restart: always
    ports:
      - "800:80"
      - "444:443"
    links:
      - db
    environment:
      - VIRTUAL_HOST=test2.toto.fr
      - LETSENCRYPT_HOST=test2.toto.fr
      - LETSENCRYPT_EMAIL=test@gmail.fr
    volumes:
      - /var/www/html/sysPass/config
      - /var/www/html/sysPass/backup
  db:
    container_name: syspass-db
    restart: always
    image: nuxsmin/docker-syspass:mysql
    ports:
      - "3306"
    environment:
      - DB_REMOTE_HOST=syspass-app
      - DB_REMOTE_ROOT_PASS=syspass
      - MYSQL_PASSWORD=syspass
      - MYSQL_DATABASE=syspass
    volumes:
      - /var/lib/mysql
nuxsmin commented 7 years ago

Umm, you need to set the network suffix too (domain name) as in the original compose file:

https://github.com/nuxsmin/docker-syspass/blob/master/docker-compose.yml

    environment:
      - DB_REMOTE_HOST=syspass-app.syspass_default
      - DB_REMOTE_ROOT_PASS=syspass
A1CY0N commented 7 years ago

I still have the same error even after trying to change "syspass-app.syspass_default" to "syspass-app.dockercompose_default".

DB access user : root DB access password : syspass Syspass db name : syspass syspassDatabase server : syspass-db

nuxsmin commented 7 years ago

Please, could you log into syspass-db and query for the DB users?

docker exec -it syspass-db mysql -e "select user,host from mysql.user;"
A1CY0N commented 7 years ago

http://i.imgur.com/AmmbKDW.png

nuxsmin commented 7 years ago

could you ping from the db container to sysPass one using its hostname?