Skip to content

Commit

Permalink
FIX The data files llx_accounting_account_* must not be loaded at
Browse files Browse the repository at this point in the history
install.
  • Loading branch information
eldy committed Aug 15, 2024
1 parent e6a9a99 commit 0e1e66a
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand All @@ -52,28 +55,42 @@ 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"
links:
- 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:
Expand All @@ -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 |
Expand Down Expand Up @@ -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`.
Expand Down
4 changes: 4 additions & 0 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/15.0.3-php7.4/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/16.0.5-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/17.0.4-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/18.0.5-php8.1/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/19.0.2-php8.2/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions images/develop/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e1e66a

Please sign in to comment.