From 0e1e66ab9de4172908952c561327e15471f09358 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Aug 2024 20:08:42 +0200 Subject: [PATCH] FIX The data files llx_accounting_account_* must not be loaded at install. --- README.md | 23 +++++++++++++++++++++-- docker-run.sh | 4 ++++ images/15.0.3-php7.4/docker-run.sh | 4 ++++ images/16.0.5-php8.1/docker-run.sh | 4 ++++ images/17.0.4-php8.1/docker-run.sh | 4 ++++ images/18.0.5-php8.1/docker-run.sh | 4 ++++ images/19.0.2-php8.2/docker-run.sh | 4 ++++ images/develop/docker-run.sh | 4 ++++ 8 files changed, 49 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8855a0b..13ed2e5 100644 --- a/README.md +++ b/README.md @@ -16,16 +16,19 @@ Docker image for Dolibarr ERP CRM Open source web suite, with auto installer on **Dolibarr versions 14 and lower are no more updated** + ## Supported architectures Linux x86-64 (`amd64`), ARMv7 32-bit (`arm32v7` :warning: MariaDB/Mysql docker images don't support it) and ARMv8 64-bit (`arm64v8`) + ## What is Dolibarr ? Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). > [More information](https://github.com/dolibarr/dolibarr) + ## How to run this image ? This image is based on the [official PHP repository](https://registry.hub.docker.com/_/php/). @@ -52,6 +55,8 @@ services: DOLI_DB_PASSWORD: root DOLI_DB_NAME: dolibarr DOLI_URL_ROOT: 'http://0.0.0.0' + DOLI_ADMIN_LOGIN: 'admin' + DOLI_ADMIN_PASSWORD: 'admin' PHP_INI_DATE_TIMEZONE: 'Europe/Paris' ports: - "80:80" @@ -59,21 +64,33 @@ services: - mariadb ``` -Then run all services `docker-compose up -d`. Now, go to http://0.0.0.0 to access to the new Dolibarr installation. +Then build and run all services (-d is to run in background) +`sudo docker-compose up -d` + +You can check the web and the mariadb containers are up with +`sudo docker-compose ps` + +Now, go to http://0.0.0.0 to access to the new Dolibarr installation, first admin login is admin/admin. + +Note: If you local port 80 is alreayd used on the host, you can replace "80:80" with "xx:80" with xx a free port on the host. You will be +able to access the Dolibarr using the URL http://0.0.0.0:xx -### Other examples + +Other examples: You can find several examples in the `examples` directory, such as: - [Running Dolibarr with a mysql server](./examples/with-mysql/dolibarr-with-mysql.md) - [Running Dolibarr with a Traefik reverse proxy](./examples/with-rp-traefik/dolibarr-with-traefik.md) - [Running Dolibarr with secrets](./examples/with-secrets/dolibarr-with-secrets.md) + ## Upgrading version and migrating DB The `install.lock` file is located inside the container volume `/var/www/documents`. Remove the `install.lock` file and start an updated version container. Ensure that env `DOLI_INSTALL_AUTO` is set to `1`. It will migrate Database to the new version. You can still use the standard way to upgrade through web interface. + ## Early support for PostgreSQL Setting `DOLI_DB_TYPE` to `pgsql` enable Dolibarr to run with a PostgreSQL database. When set to use `pgsql`, Dolibarr must be installed manually on it's first execution: @@ -87,6 +104,7 @@ When setup this way, to upgrade version the use of the web interface is mandator - Upgrade DB; - Add `install.lock` inside the container volume `/var/www/html/documents` (ex `docker-compose exec services-data_dolibarr_1 /bin/bash -c "touch /var/www/html/documents/install.lock"`). + ## Environment variables summary | Variable | Default value | Description | @@ -139,6 +157,7 @@ Environment variables that are compatible with docker secrets: * `DOLI_CRON_USER` => `DOLI_CRON_USER_FILE` * `DOLI_INSTANCE_UNIQUE_ID` => `DOLI_INSTANCE_UNIQUE_ID_FILE` + ## Add post-deployment and before starting scripts It is possible to execute `*.sh`, `*.sql` and/or `*.php` custom file at the end of deployment or before starting Apache by mounting volumes. For scripts executed during deployment mount volume in `/var/www/scripts/docker-init.d`. diff --git a/docker-run.sh b/docker-run.sh index 480c32e..ec09ac0 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/15.0.3-php7.4/docker-run.sh b/images/15.0.3-php7.4/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/15.0.3-php7.4/docker-run.sh +++ b/images/15.0.3-php7.4/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/16.0.5-php8.1/docker-run.sh b/images/16.0.5-php8.1/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/16.0.5-php8.1/docker-run.sh +++ b/images/16.0.5-php8.1/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/17.0.4-php8.1/docker-run.sh b/images/17.0.4-php8.1/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/17.0.4-php8.1/docker-run.sh +++ b/images/17.0.4-php8.1/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/18.0.5-php8.1/docker-run.sh b/images/18.0.5-php8.1/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/18.0.5-php8.1/docker-run.sh +++ b/images/18.0.5-php8.1/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/19.0.2-php8.2/docker-run.sh b/images/19.0.2-php8.2/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/19.0.2-php8.2/docker-run.sh +++ b/images/19.0.2-php8.2/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1 diff --git a/images/develop/docker-run.sh b/images/develop/docker-run.sh index 480c32e..ec09ac0 100755 --- a/images/develop/docker-run.sh +++ b/images/develop/docker-run.sh @@ -175,6 +175,10 @@ function initializeDatabase() done for fileSQL in /var/www/html/install/mysql/data/*.sql; do + if [[ $fileSQL =~ llx_accounting_account_ ]]; then + echo "Do not import data from `basename ${fileSQL}` ..." + continue + fi echo "Importing data from `basename ${fileSQL}` ..." sed -i 's/--.*//g;' ${fileSQL} mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} < ${fileSQL} > /dev/null 2>&1