Fix the cron key is not save according to setup - Add more logs

This commit is contained in:
ldestailleur
2025-03-10 14:21:36 +01:00
parent b8f85c1ca1
commit 2542b6b568
12 changed files with 53 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ services:
- mysql-user - mysql-user
- mysql-password - mysql-password
environment: environment:
#MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
MYSQL_RANDOM_ROOT_PASSWORD: "1" MYSQL_RANDOM_ROOT_PASSWORD: "1"
MYSQL_DATABASE: "dolidb" MYSQL_DATABASE: "dolidb"
MYSQL_USER_FILE: "/run/secrets/mysql-user" MYSQL_USER_FILE: "/run/secrets/mysql-user"
@@ -86,6 +87,7 @@ services:
DOLI_URL_ROOT: 'http://0.0.0.0:81' DOLI_URL_ROOT: 'http://0.0.0.0:81'
DOLI_INSTANCE_UNIQUE_ID: myinstanceuniqueid DOLI_INSTANCE_UNIQUE_ID: myinstanceuniqueid
DOLI_INIT_DEMO: 1 DOLI_INIT_DEMO: 1
DOLI_CRON_KEY: mycronsecurekey
ports: ports:
- "81:80" - "81:80"
networks: networks:

View File

@@ -15,8 +15,8 @@ services:
environment: environment:
DOLI_DB_HOST: "mysql" DOLI_DB_HOST: "mysql"
DOLI_DB_HOST_PORT: "3306" DOLI_DB_HOST_PORT: "3306"
DOLI_DB_USER: "dolibarr" DOLI_DB_USER: "dolidbuser"
DOLI_DB_PASSWORD: "mysupersecretpasswordfordatabase" DOLI_DB_PASSWORD: "dolidbpass"
DOLI_DB_NAME: "dolibarr" DOLI_DB_NAME: "dolibarr"
DOLI_ADMIN_LOGIN: "admin" DOLI_ADMIN_LOGIN: "admin"
DOLI_ADMIN_PASSWORD: "mysuperhypersecretpasswordforadminacount" DOLI_ADMIN_PASSWORD: "mysuperhypersecretpasswordforadminacount"

View File

@@ -1 +1 @@
mysupersecretpasswordfordatabase dolidbpass

View File

@@ -1 +1 @@
dolibarr dolidbuser

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -267,6 +267,10 @@ function initializeDatabase()
echo "Enable user module ..." >> /var/www/documents/initdb.log echo "Enable user module ..." >> /var/www/documents/initdb.log
php /var/www/scripts/docker-init.php php /var/www/scripts/docker-init.php
echo "Set cron key to ${DOLI_CRON_KEY}..."
echo "Set cron key to ${DOLI_CRON_KEY}..." >> /var/www/documents/initdb.log
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "UPDATE llx_const set value = '${DOLI_CRON_KEY}' WHERE name = 'CRON_KEY'" >> /var/www/documents/initdb.log 2>&1
# Run init scripts # Run init scripts
echo "Run scripts into docker-init.d if there is ..." echo "Run scripts into docker-init.d if there is ..."
echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log echo "Run scripts into docker-init.d if there is ..." >> /var/www/documents/initdb.log
@@ -431,6 +435,8 @@ function run()
echo "*** You can connect to the docker Mariadb with:" echo "*** You can connect to the docker Mariadb with:"
echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash" echo "sudo docker exec -it nameofwebcontainer-mariadb-1 bash"
echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost" echo "mariadb -uroot -p'MYSQL_ROOT_PASSWORD' -h localhost"
echo "or"
echo "mariadb -uxxx -p'yyy' -h mariadb where xxx is in /run/secrets/mysql-user and yyy in /run/secrets/mysql-password"
echo "ls /var/lib/mysql" echo "ls /var/lib/mysql"
echo echo
echo "*** You can connect to the docker Dolibarr with:" echo "*** You can connect to the docker Dolibarr with:"

View File

@@ -13,6 +13,8 @@ BASE_DIR="$( cd "$(dirname "$0")" && pwd )"
DOLI_VER=${1} DOLI_VER=${1}
PHP_VER=${2:-""} PHP_VER=${2:-""}
echo "Test - working in $BASE_DIR"
if [ "${DOLI_VER}" = "" ]; then if [ "${DOLI_VER}" = "" ]; then
echo "Usage: sudo test.sh dolversion [phpversion]" echo "Usage: sudo test.sh dolversion [phpversion]"
echo " The couple dolversion/phpversion must be an existing couple into /images directory." echo " The couple dolversion/phpversion must be an existing couple into /images directory."
@@ -21,6 +23,7 @@ if [ "${DOLI_VER}" = "" ]; then
exit exit
fi fi
# Create links of images into docker-compose-links
rm -rf "${BASE_DIR}/docker-compose-links/" && mkdir "${BASE_DIR}/docker-compose-links" rm -rf "${BASE_DIR}/docker-compose-links/" && mkdir "${BASE_DIR}/docker-compose-links"
# shellcheck disable=SC2044 # shellcheck disable=SC2044
@@ -50,7 +53,7 @@ if [ "${PHP_VER}" = "" ]; then
echo "Stopping existing image (if exists) ..." echo "Stopping existing image (if exists) ..."
echo "DOLI_VERSION=${DOLI_VER} PHP_VERSION='' $dockerComposeBin -f '${BASE_DIR}/docker-compose.yml' [down|...]" echo "DOLI_VERSION=${DOLI_VER} PHP_VERSION='' $dockerComposeBin -f '${BASE_DIR}/docker-compose.yml' [down|...]"
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null
echo "Building image ..." echo "Building image using docker-compose.yml in $BASE_DIR..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web
echo "Starting image ..." echo "Starting image ..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron
@@ -60,7 +63,7 @@ else
echo " - PHP ${PHP_VER}" echo " - PHP ${PHP_VER}"
echo "Stopping existing image (if exists) ..." echo "Stopping existing image (if exists) ..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null
echo "Building image ..." echo "Building image using docker-compose.yml in $BASE_DIR..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web
echo "Starting image ..." echo "Starting image ..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron