diff --git a/dev/build/docker-dev/docker-run.sh b/dev/build/docker-dev/docker-run.sh index a3a1123c1f2..0853964d3fb 100755 --- a/dev/build/docker-dev/docker-run.sh +++ b/dev/build/docker-dev/docker-run.sh @@ -3,19 +3,30 @@ # See README.md to know how to create a Dolibarr env with docker set -ex +if [ "${PHP_INI_DIR}" == "" ]; then + echo + echo This script must not be run directly. It is used by the Dockerfile + echo See README.md + echo + exit +fi + if [ "${HOST_USER_ID}" == "" ]; then - echo "Define HOST_USER_ID to your user ID before starting" + echo "Define HOST_USER_ID to your user ID before starting (example: www-data)" + exit 1 +fi +if [ "${HOST_GROUP_ID}" == "" ]; then + echo "Define HOST_GROUP_ID to your group ID before starting (example: www-data)" exit 1 fi usermod -u "${HOST_USER_ID}" www-data -groupmod -g "${HOST_USER_ID}" www-data +groupmod -g "${HOST_GROUP_ID}" www-data echo "[docker-run] => update '${PHP_INI_DIR}/conf.d/dolibarr-php.ini'" cat < "${PHP_INI_DIR}/conf.d/dolibarr-php.ini" date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC} memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M} -display_errors = Off EOF exec apache2-foreground diff --git a/dev/build/docker/README.md b/dev/build/docker/README.md index 24c2d45f9ed..cc947f065fb 100644 --- a/dev/build/docker/README.md +++ b/dev/build/docker/README.md @@ -1,24 +1,51 @@ -# How to use or run Dolibarr with Docker ? +# How to build and run your local version of Dolibarr, quickly with Docker ? -## For a fast run of a demo of the local version, you can build the docker image from the source repository by running +## For a fast run of a demo of the local version, you can build a docker image pointing to your source repository + +This process using the Dockerfile and docker-compose.yml file is a config file to use to build and run Dolibarr in the +current workspace with Docker. This docker image is intended for **development usage** (See next chapter for a production usage). + +Warning: There is no persistency of database. This process is for dev purpose only. + + +Build the containers: git clone https://github.com/Dolibarr/dolibarr.git dolibarr - cd dolibarr/docker + cd dolibarr/dev/build/docker - sudo docker-compose build + sudo docker-compose build [--no-cache] + or + sudo docker compose build [--no-cache] + + +Launch the containers: sudo -s - export HOST_USER_ID=$(id -u) export HOST_GROUP_ID=$(id -g) export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 '; +} + if (!empty($force_install_message)) { print '

'.$langs->trans($force_install_message).'
'; diff --git a/htdocs/install/install.forced.docker.php b/htdocs/install/install.forced.docker.php deleted file mode 100644 index 9d8aa993207..00000000000 --- a/htdocs/install/install.forced.docker.php +++ /dev/null @@ -1,78 +0,0 @@ - - * Copyright (C) 2024 Yann Le Doaré - * Copyright (C) 2025 Charlene Benke - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** @var boolean $force_install_nophpinfo Hide PHP information */ -$force_install_nophpinfo = true; - -/** @var int $force_install_noedit 1 = Lock and hide environment variables, 2 = Lock all set variables */ -$force_install_noedit = 3; - -/** @var string $force_install_message Information message */ -$force_install_message = 'Welcome to your Dolibarr Docker install'; - -/** @var string $force_install_main_data_root Data root absolute path (documents folder) */ -$force_install_main_data_root = null; - -/** @var boolean $force_install_mainforcehttps Force HTTPS */ -$force_install_mainforcehttps = true; - -/** @var string $force_install_database Database name */ -$force_install_database = getenv('DOLI_DATABASE', true) ?: getenv('DOLI_DATABASE'); - -/** @var string $force_install_type Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */ -$force_install_type = 'mysqli'; - -/** @var string $force_install_dbserver Database server host */ -$force_install_dbserver = getenv('DOLI_DB_SERVER', true) ?: getenv('DOLI_DB_SERVER'); - -/** @var int $force_install_port Database server port */ -$force_install_port = 3306; - -/** @var string $force_install_prefix Database tables prefix */ -$force_install_prefix = 'llx_'; - -/** @var bool $force_install_createdatabase Force database creation */ -$force_install_createdatabase = false; - -/** @var string $force_install_databaselogin Database username */ -$force_install_databaselogin = 'root'; - -/** @var string $force_install_databasepass Database password */ -$force_install_databasepass = getenv('DOLI_ROOT_PASSWORD', true) ?: getenv('DOLI_ROOT_PASSWORD'); - -/** @var bool $force_install_createuser Force database user creation */ -$force_install_createuser = false; - -/** @var string $force_install_databaserootlogin Database root username */ -$force_install_databaserootlogin = 'root'; - -/** @var string $force_install_databaserootpass Database root password */ -$force_install_databaserootpass = getenv('DOLI_ROOT_PASSWORD', true) ?: getenv('DOLI_ROOT_PASSWORD'); - -/** @var string $force_install_dolibarrlogin Dolibarr super-administrator username */ -$force_install_dolibarrlogin = 'admin'; - -/** @var string $force_install_dolibarrpassword Dolibarr super-administrator password */ -$force_install_dolibarrpassword = ''; - -/** @var bool $force_install_lockinstall Force install locking */ -$force_install_lockinstall = true; - -/** @var string $force_install_module Enable module(s) (Comma separated class names list) */ -$force_install_module = ''; diff --git a/htdocs/install/install.forced.sample.php b/htdocs/install/install.forced.sample.php index 4041b471859..1f9389ecd90 100644 --- a/htdocs/install/install.forced.sample.php +++ b/htdocs/install/install.forced.sample.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Yann Le Doaré * Copyright (C) 2025 Charlene Benke * * This program is free software; you can redistribute it and/or modify @@ -16,14 +17,17 @@ * along with this program. If not, see . */ +/** @var boolean $force_install_distrib Set the way the installis done to "custom" value */ +$force_install_distrib = 'custom'; + /** @var boolean $force_install_nophpinfo Hide PHP information */ $force_install_nophpinfo = true; /** @var int $force_install_noedit 1 = Lock and hide environment variables, 2 = Lock all set variables */ $force_install_noedit = 2; -/** @var string $force_install_message Information message */ -$force_install_message = 'Welcome to your Dolibarr install'; +/** @var string $force_install_message Information message to add on the page to setup parameters */ +$force_install_message = 'Welcome to your Dolibarr install...'; /** @var string $force_install_main_data_root Data root absolute path (documents folder) */ $force_install_main_data_root = null; @@ -32,13 +36,13 @@ $force_install_main_data_root = null; $force_install_mainforcehttps = true; /** @var string $force_install_database Database name */ -$force_install_database = 'dolibarr'; +$force_install_database = getenv('DOLI_DATABASE', true) ?: 'dolibarr'; /** @var string $force_install_type Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */ $force_install_type = 'mysqli'; /** @var string $force_install_dbserver Database server host */ -$force_install_dbserver = 'localhost'; +$force_install_dbserver = getenv('DOLI_DB_SERVER', true) ?: 'localhost'; /** @var int $force_install_port Database server port */ $force_install_port = 3306; @@ -47,31 +51,31 @@ $force_install_port = 3306; $force_install_prefix = 'llx_'; /** @var bool $force_install_createdatabase Force database creation */ -$force_install_createdatabase = true; +$force_install_createdatabase = getenv('DOLI_DB_CREATE', true) ? true : false; /** @var string $force_install_databaselogin Database username */ $force_install_databaselogin = 'root'; /** @var string $force_install_databasepass Database password */ -$force_install_databasepass = ''; +$force_install_databasepass = getenv('DOLI_DB_PASSWORD', true) ?: ''; /** @var bool $force_install_createuser Force database user creation */ $force_install_createuser = false; +/** @var string $force_install_dolibarrlogin Dolibarr administrator username */ +$force_install_dolibarrlogin = 'admin'; + +/** @var string $force_install_dolibarrpassword Dolibarr administrator password */ +$force_install_dolibarrpassword = ''; + /** @var string $force_install_databaserootlogin Database root username */ $force_install_databaserootlogin = 'root'; /** @var string $force_install_databaserootpass Database root password */ -$force_install_databaserootpass = ''; - -/** @var string $force_install_dolibarrlogin Dolibarr super-administrator username */ -$force_install_dolibarrlogin = 'admin'; - -/** @var string $force_install_dolibarrpassword Dolibarr super-administrator password */ -$force_install_dolibarrpassword = ''; +$force_install_databaserootpass = getenv('DOLI_ROOT_PASSWORD', true) ?: ''; /** @var bool $force_install_lockinstall Force install locking */ $force_install_lockinstall = true; -/** @var string $force_install_module Enable module(s) (Comma separated class names list) */ -$force_install_module = 'modSociete,modFournisseur,modFacture'; +/** @var string $force_install_module Enable module(s) (Comma separated class names list, example: modSociete,modFournisseur,modFacture) */ +$force_install_module = ''; diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 6f2be263240..557c032857a 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -612,7 +612,8 @@ $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (e $hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only. -$out = ' '; +$out = '
'; +$out .= ' '; $out .= ''; $out .= ''; diff --git a/htdocs/install/step4.php b/htdocs/install/step4.php index 8c83535e8e8..dbe20b58e88 100644 --- a/htdocs/install/step4.php +++ b/htdocs/install/step4.php @@ -28,7 +28,6 @@ include_once 'inc.php'; - /** * @var string $conffile * @var string $conffiletoshow @@ -37,6 +36,9 @@ include_once 'inc.php'; * @var Translate $langs * * @var string $dolibarr_main_document_root + * @var int $force_install_noedit + * @var string $force_install_dolibarrlogin + * @var string $force_install_dolibarrpassword */ require_once $dolibarr_main_document_root.'/core/class/conf.class.php'; @@ -56,7 +58,7 @@ if ($conffile == "/etc/dolibarr/conf.php") { $forcedfile = "/etc/dolibarr/install.forced.php"; } if (@file_exists($forcedfile)) { - $useforcedwizard = true; + $useforcedwizard = true; // used into install.forced.php include_once $forcedfile; } @@ -90,13 +92,14 @@ print ''; $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port); + if ($db->ok) { print ''; + print ''; print ''; + print ''; print ''; + print ''; print '
'; - print '
'; - print '
'; - print '
'; if (GETPOSTINT("error") == 1) { diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index e9ebbe3d7cf..9ee233056ba 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -39,7 +39,6 @@ define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; - /** * @var string $conffile * @var string $conffiletoshow @@ -64,6 +63,8 @@ if (file_exists($conffile)) { * @var string $dolibarr_main_db_cryptkey * @var string $dolibarr_main_url_root * @var string $modulesdir + * @var int $force_install_noedit + * @var string $force_install_dolibarrpassword */ require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash @@ -144,6 +145,14 @@ if (@file_exists($forcedfile)) { $force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ? GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8]))); + +// Case the password was in forced mode +if (@$force_install_noedit == 2 && isset($force_install_dolibarrpassword)) { + $pass = $force_install_dolibarrpassword; + $pass_verif = $force_install_dolibarrpassword; +} + + dolibarr_install_syslog("--- step5: entering step5.php page ".$versionfrom." ".$versionto); $error = 0; @@ -169,6 +178,10 @@ if ($action == "set") { // Test on permissions not required here header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : '')); exit; } + if ($pass === '**********' || $pass_verif == '**********') { + header("Location: step4.php?error=2&selectlang=$setuplang".(isset($login) ? '&login='.$login : '')); + exit; + } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 1e2be0944dd..ac65607c9da 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -381,7 +381,7 @@ ErrorFailedToGetTokenFromClientIdAndSecret=Failed to get a %s token from client # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. -WarningMandatorySetupNotComplete=Click here to setup main parameters +WarningMandatorySetupNotComplete=Setup is not complete ! Click here to setup main parameters WarningEnableYourModulesApplications=Click here to enable your modules and applications WarningSafeModeOnCheckExecDir=Warning, PHP option safe_mode is on so command must be stored inside a directory declared by php parameter safe_mode_exec_dir. WarningBookmarkAlreadyExists=A bookmark with this title or this target (URL) already exists.