espocrm / espocrm-docker

Official Docker Image for EspoCRM
https://hub.docker.com/r/espocrm/espocrm
GNU Affero General Public License v3.0
56 stars 34 forks source link

External database #5

Closed vp-lab closed 2 years ago

vp-lab commented 2 years ago

Hello,

We want to migrate our espocrm from standard installation to docker version but I have some questions about this [the default docker-compose it's working fine with mysql container].

  1. How can I connect to another mysql server? [not container]
  2. Atm in the current server we have a folder mounted from the main storage [/var/www/html/epsocrm/data/upload] How can I mount this folder directly into the container because we have lots (30k+ documents).

With this config I'm getting Error 500.

version: '3.1'

services:
  espocrm:
    container_name: espocrm
    image: espocrm/espocrm
    environment:
      ESPOCRM_DATABASE_HOST: 192.168.3.107
      ESPOCRM_DATABASE_NAME: crm
      ESPOCRM_DATABASE_USER: crm
      ESPOCRM_DATABASE_PASSWORD: 123456
      ESPOCRM_ADMIN_USERNAME: admin
      ESPOCRM_ADMIN_PASSWORD: password
      ESPOCRM_SITE_URL: "http://localhost:8080"
    restart: always
    ports:
      - 8282:80
    volumes:
     - ./data:/var/www/html
     - ./docs:/var/www/html/epsocrm/data/upload

  espocrm-daemon:
    image: espocrm/espocrm
    volumes:
     - ./data:/var/www/html
    restart: always
    entrypoint: docker-daemon.sh

volumes:
  espocrm:

Thank you.

tmachyshyn commented 2 years ago

Hello,

  1. All depends on your MySQL server location. Is it on the same machine? If not, you have to make changes in your MySQL server, because by default it allows connection from the localhost only.
  2. What is the result of mapping the ./docs:/var/www/html/epsocrm/data/upload?
vp-lab commented 2 years ago
  1. The MySQL server it's on another server [not on the same one with docker] and I can connect with another docker container to the MySQL. With the config I posted on the first post I should connect to the database or I'm missing something?
  2. We use a NFS share which it's on our cluster storage to store all of documents. Now I need to bind it to the upload folder for the EspoCRM. I'm getting this error when I tried to connect to MySQL server [not the container of MySQL] Screenshot from 2021-08-13 20-45-54
vp-lab commented 2 years ago

Hello,

I'm connected to the database and I can see all files, all users, etc. Users can't connect with the password they know but with the admin user I can connect only with the password in the database not the one in the docker-compose.yml I posted below.

version: '3.1'

services:
  espocrm:
    container_name: espocrm
    image: espocrm/espocrm
    environment:
      ESPOCRM_DATABASE_HOST: 192.168.3.107
      ESPOCRM_DATABASE_NAME: crm_v1
      ESPOCRM_DATABASE_USER: crm1
      ESPOCRM_DATABASE_PASSWORD: crm123
      ESPOCRM_ADMIN_USERNAME: admin
      ESPOCRM_ADMIN_PASSWORD: admin
      ESPOCRM_SITE_URL: "http://localhost:8080"
    restart: always
    ports:
      - 8585:80
    volumes:
     - ./data:/var/www/html
     - /home/xxxx/files:/var/www/html/data/upload

  espocrm-daemon:
    image: espocrm/espocrm
    volumes:
     - ./data:/var/www/html
    restart: always
    entrypoint: docker-daemon.sh

volumes:
  espocrm:

I'm missing something about the configuration?

Thank you.

tmachyshyn commented 2 years ago

Hello,

The option ESPOCRM_ADMIN_PASSWORD is using only for init installation. Once you change this password, it will not equals defined in docker-compose.yaml. Your situation sounds like you have enabled the LDAP authorization in Administration > Authentication. If so, please change it to Espo method.

vp-lab commented 2 years ago

Where are password stored, on the database? Or in another folder/file on the folder espocrm?

I'm able to see all documents, users, emails, but users can't login with the password they have on the espocrm normal installer [not docker]. The authentification it's on epso.

tmachyshyn commented 2 years ago

The password is encrypted and stored in the database. To see all available users, please go to Administration > Users.

vp-lab commented 2 years ago

Let's start over maybe I'm missing something.

  1. Create docker-compose.yml with the below config.
    
    version: '3.1'

services: espocrm: container_name: espocrm image: espocrm/espocrm:latest environment: ESPOCRM_DATABASE_HOST: 192.168.3.107 ESPOCRM_DATABASE_NAME: crm_v1 ESPOCRM_DATABASE_USER: crm1 ESPOCRM_DATABASE_PASSWORD: crm123 ESPOCRM_ADMIN_USERNAME: admin ESPOCRM_ADMIN_PASSWORD: admin ESPOCRM_SITE_URL: "http://192.168.3.87:8585" restart: always ports:

volumes: espocrm:

2. Create the **data** folder where all persistent files are stored.
3. Run **docker-compose up [for the logs]** to start the container
[I get this error on logs when I start the first time the container]

espocrm | Run "install" action. espocrm-daemon | Could not open input file: /var/www/html/daemon.php espocrm | Start EspoCRM installation espocrm | End EspoCRM installation

4. After the container started I can login with the credentials for **admin** from **docker-compose.yml**

ESPOCRM_ADMIN_USERNAME: admin ESPOCRM_ADMIN_PASSWORD: admin


5. The authentification it's **Espo** selected.
![auth_espo](https://user-images.githubusercontent.com/18114871/130922418-00e9de6b-ecf8-4a0c-9e92-15067a84e732.png)
6. I can see all the **users** but they can't login with the **password** they **known**.
![users_espo](https://user-images.githubusercontent.com/18114871/130922451-f78076ea-b081-4cd2-a614-f2a26432098f.png)

The database it's connected because I can see all the documents, users, calendar, emails.
I don't understand why users can't login with the password from DB. [if i change the password for user they can login]

Thank you.
tmachyshyn commented 2 years ago

Now, I understand your problem. You made installation on existing database with data inside. In this case, you have to manually change the users passwords, because each time when you make a fresh installation a new password salt is generated.

vp-lab commented 2 years ago

Yes it's from password salt, and I change the local config in docker with my config from normal installation and it's working fine now. One more question. The upgrade button from administration it's working if it's installed in docker container? It's doing something if some of my administrator upload a new zip?

tmachyshyn commented 2 years ago

You can upgrade EspoCRM by the upgrade button from an administration panel or via docker. The recommended way is via docker.