Optimized espocrm websocket and docker-compose

This commit is contained in:
2025-04-25 12:51:28 +02:00
parent edf2be504c
commit 4e04f882e5
5 changed files with 61 additions and 21 deletions

View File

@@ -6,15 +6,20 @@ services:
image: espocrm/espocrm:{{ applications.espocrm.version }}
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
environment:
- DATABASE_HOST={{ database_host }}
- DATABASE_PORT={{ database_port }}
- DATABASE_NAME={{ database_name }}
- DATABASE_USER={{ database_username }}
- DATABASE_PASSWORD={{ database_password }}
- CRON=disable # cron handled by separate service
command: apache2-foreground
# --- DB connection ----------------------------------------------------
- ESPOCRM_DATABASE_PLATFORM=Mysql # EspoCRM expects Mysql even for MariaDB
- ESPOCRM_DATABASE_HOST={{ database_host }}
- ESPOCRM_DATABASE_PORT={{ database_port }}
- ESPOCRM_DATABASE_NAME={{ database_name }}
- ESPOCRM_DATABASE_USER={{ database_username }}
- ESPOCRM_DATABASE_PASSWORD={{ database_password }}
# --- initial admin & site URL ----------------------------------------
- ESPOCRM_ADMIN_USERNAME={{ applications[application_id].credentials.admin.username }}
- ESPOCRM_ADMIN_PASSWORD={{ applications[application_id].credentials.admin.password }}
- ESPOCRM_SITE_URL={{ web_protocol }}://{{ domains[application_id] }}
command: "php-fpm"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/" ]
test: ["CMD", "curl", "-f", "http://localhost/"]
ports:
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
{% include 'templates/docker/container/depends-on-database.yml.j2' %}
@@ -22,18 +27,34 @@ services:
volumes:
- data:/var/www/html
cron:
daemon: # ↔ was “espocrm-daemon” in the example
image: espocrm/espocrm:{{ applications.espocrm.version }}
command: /usr/local/bin/cron.sh
restart: unless-stopped
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
entrypoint: docker-daemon.sh
{% include 'templates/docker/container/depends-on-database.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %}
volumes:
- data:/var/www/html
restart: unless-stopped
websocket: # ↔ was “espocrm-websocket” in the example
image: espocrm/espocrm:{{ applications.espocrm.version }}
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
environment:
- ESPOCRM_CONFIG_USE_WEB_SOCKET=true
- ESPOCRM_CONFIG_WEB_SOCKET_URL=ws://{{ domains[application_id] }}/ws
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN=tcp://*:7777
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN=tcp://websocket:7777
entrypoint: docker-websocket.sh
{% include 'templates/docker/container/depends-on-database.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %}
healthcheck:
test: ["CMD", "pgrep", "cron"]
volumes:
- data:/var/www/html
restart: unless-stopped
ports:
- "{{ ports.localhost.websocket[application_id] | default('127.0.0.1:8081') }}:8080"
{% include 'templates/docker/compose/volumes.yml.j2' %}
data:
{% include 'templates/docker/compose/networks.yml.j2' %}
{% include 'templates/docker/compose/networks.yml.j2' %}

View File

@@ -1,10 +1,16 @@
# EspoCRM environment
# Database connection
DATABASE_HOST={{ database_host }}
DATABASE_PORT={{ database_port }}
DATABASE_NAME={{ database_name }}
DATABASE_USER={{ database_username }}
DATABASE_PASSWORD={{ database_password }}
ESPOCRM_DATABASE_HOST={{ database_host }}
ESPOCRM_DATABASE_PORT={{ database_port }}
ESPOCRM_DATABASE_NAME={{ database_name }}
ESPOCRM_DATABASE_USER={{ database_username }}
ESPOCRM_DATABASE_PASSWORD={{ database_password }}
# Cron toggle
CRON_DISABLED=true
ESPOCRM_ADMIN_USERNAME: admin
ESPOCRM_ADMIN_PASSWORD: password
ESPOCRM_SITE_URL: "http://localhost:8080"
# SMTP settings (example)
SMTP_HOST={{ system_email.host }}