Hello tout le monde,
J’ai un problème dans la récupération des secrets sur docker. Lorsque je lance mon serveur, j’obtiens cette erreur : « WARN[0000] The « DB_PASSWORD » variable is not set. Defaulting to a blank string. » Le serveur se lance tout de même sans réel problème. J’ai vérifié que le fichier était bien présent avec un contenu sans autres caractères que le mot de passe. J’ai l’impression qu’il est correctement déclaré sur compose.yml. Mais malgré mes relances de serveurs, rien y fait.
Et lorsque je regarde les logs, je vois également des problèmes sur d’autres secrets : « [Warning] Access denied for user ‹ root ›@‹ localhost › (using password: NO) »
Si quelqu’un a une idée d’où pourrait provenir le problème …
Merciu d’avance
Le docker-compose :
services:
db:
image: mariadb:10.3
volumes:
- ./mariadb/database:/var/lib/mysql
restart: always
environment:
MARIADB_DATABASE: pickfungi
MARIADB_USER_FILE: '/run/secrets/mariadb_user'
MARIADB_PASSWORD_FILE: '/run/secrets/mariadb_password'
MARIADB_ROOT_PASSWORD_FILE: '/run/secrets/mariadb_root_password'
ports:
- 3306:3306
secrets:
- mariadb_root_password
- mariadb_user
- mariadb_password
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}" ]
timeout: 5s
retries: 3
adminer:
image: adminer
restart: always
ports:
- 8080:8080
cache:
image: redis:6
healthcheck:
test: ["CMD-SHELL", "[ $$(redis-cli ping) = 'PONG' ]"]
interval: 10s
timeout: 5s
retries: 5
start_interval: 5s
start_period: 30s
directus:
image: directus/directus:11.0.2
ports:
- 8055:8055
volumes:
- ./directus/uploads:/directus/uploads
- ./directus/extensions:/directus/extensions
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
environment:
KEY_FILE: '/run/secrets/directus_key'
SECRET_FILE: '/run/secrets/directus_secret'
DB_CLIENT: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: pickfungi
DB_USER_FILE: '/run/secrets/mariadb_user'
DB_PASSWORD_FILE: '/run/secrets/mariadb_password'
CACHE_ENABLED: "true"
CACHE_AUTO_PURGE: "true"
CACHE_STORE: "redis"
REDIS: "redis://cache:6379"
ADMIN_EMAIL_FILE: '/run/secrets/admin_email'
ADMIN_PASSWORD_FILE: '/run/secrets/admin_password'
secrets:
- mariadb_user
- mariadb_password
- directus_key
- directus_secret
- admin_email
- admin_password
secrets:
mariadb_root_password:
file: ./secrets/mariadb_root_password.txt
mariadb_user:
file: ./secrets/mariadb_user.txt
mariadb_password:
file: ./secrets/mariadb_password.txt
directus_key:
file: ./secrets/directus_key.txt
directus_secret:
file: ./secrets/directus_secret.txt
admin_email:
file: ./secrets/admin_email.txt
admin_password:
file: ./secrets/admin_password.txt
Voici les logs :
kevinyard@MBP-de-Kevin docker_api_pickfungi % docker-compose down
docker-compose up --build -d
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string.
[+] Running 5/5
✔ Container docker_api_pickfungi-adminer-1 Removed 0.2s
✔ Container docker_api_pickfungi-directus-1 Removed 0.5s
✔ Container docker_api_pickfungi-db-1 Removed 2.0s
✔ Container docker_api_pickfungi-cache-1 Removed 0.3s
✔ Network docker_api_pickfungi_default Removed 0.1s
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string.
[+] Running 5/5
✔ Network docker_api_pickfungi_default Created 0.0s
✔ Container docker_api_pickfungi-adminer-1 Started 0.6s
✔ Container docker_api_pickfungi-cache-1 Healthy 6.1s
✔ Container docker_api_pickfungi-db-1 Healthy 31.1s
✔ Container docker_api_pickfungi-directus-1 Started 31.3s
kevinyard@MBP-de-Kevin docker_api_pickfungi % cat ./secrets/mariadb_password.txt
password%
kevinyard@MBP-de-Kevin docker_api_pickfungi % chmod 600 ./secrets/mariadb_password.txt
kevinyard@MBP-de-Kevin docker_api_pickfungi % ls -l ./secrets/
total 56
-rw-------@ 1 kevinyard staff 20 19 aoû 18:58 admin_email.txt
-rw-------@ 1 kevinyard staff 8 19 aoû 18:58 admin_password.txt
-rw-------@ 1 kevinyard staff 8 19 aoû 18:57 directus_key.txt
-rw-------@ 1 kevinyard staff 6 19 aoû 18:57 directus_secret.txt
-rw-------@ 1 kevinyard staff 8 17 aoû 19:38 mariadb_password.txt
-rw-------@ 1 kevinyard staff 8 19 aoû 18:51 mariadb_root_password.txt
-rw-------@ 1 kevinyard staff 9 17 aoû 19:38 mariadb_user.txt
kevinyard@MBP-de-Kevin docker_api_pickfungi % docker-compose down
docker-compose up --build -d
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string.
[+] Running 5/5
✔ Container docker_api_pickfungi-directus-1 Removed 0.8s
✔ Container docker_api_pickfungi-adminer-1 Removed 0.4s
✔ Container docker_api_pickfungi-db-1 Removed 1.3s
✔ Container docker_api_pickfungi-cache-1 Removed 0.2s
✔ Network docker_api_pickfungi_default Removed 0.1s
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string.
[+] Running 5/5
✔ Network docker_api_pickfungi_default Created 0.0s
✔ Container docker_api_pickfungi-db-1 Healthy 31.0s
✔ Container docker_api_pickfungi-adminer-1 Started 0.5s
✔ Container docker_api_pickfungi-cache-1 Healthy 6.0s
✔ Container docker_api_pickfungi-directus-1 Started 31.2s
kevinyard@MBP-de-Kevin docker_api_pickfungi % docker-compose logs
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string.
db-1 | 2024-08-25 09:31:59+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.3.39+maria~ubu2004 started.
db-1 | 2024-08-25 09:31:59+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db-1 | 2024-08-25 09:31:59+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.3.39+maria~ubu2004 started.
db-1 | 2024-08-25 09:31:59+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
cache-1 | 1:C 25 Aug 2024 09:31:59.025 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
cache-1 | 1:C 25 Aug 2024 09:31:59.025 # Redis version=6.2.14, bits=64, commit=00000000, modified=0, pid=1, just started
cache-1 | 1:C 25 Aug 2024 09:31:59.025 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
cache-1 | 1:M 25 Aug 2024 09:31:59.026 * monotonic clock: POSIX clock_gettime
db-1 | 2024-08-25 9:31:59 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
db-1 | 2024-08-25 9:31:59 0 [Note] Starting MariaDB 10.3.39-MariaDB-1:10.3.39+maria~ubu2004 source revision ca001cf2048f0152689e1895e2dc15486dd0b1af as process 1
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Using Linux native AIO
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Uses event mutexes
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Number of pools: 1
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Using generic crc32 instructions
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Completed initialization of buffer pool
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Creating shared tablespace for temporary tables
cache-1 | 1:M 25 Aug 2024 09:31:59.027 * Running mode=standalone, port=6379.
adminer-1 | [Sun Aug 25 09:31:59 2024] PHP 7.4.33 Development Server (http://[::]:8080) started
cache-1 | 1:M 25 Aug 2024 09:31:59.027 # Server initialized
cache-1 | 1:M 25 Aug 2024 09:31:59.064 * Ready to accept connections
directus-1 | [09:32:33.331] WARN: Some tables and columns do not match your database's default collation (latin1_swedish_ci):
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: 10.3.39 started; log sequence number 6082223; transaction id 3585
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db-1 | 2024-08-25 9:31:59 0 [Note] Plugin 'FEEDBACK' is disabled.
db-1 | 2024-08-25 9:31:59 0 [Note] Server socket created on IP: '::'.
db-1 | 2024-08-25 9:31:59 0 [Note] InnoDB: Buffer pool(s) load completed at 240825 9:31:59
db-1 | 2024-08-25 9:31:59 0 [Note] Reading of all Master_info entries succeeded
db-1 | 2024-08-25 9:31:59 0 [Note] Added new Master_info '' to hash table
db-1 | 2024-08-25 9:31:59 0 [Note] mysqld: ready for connections.
db-1 | Version: '10.3.39-MariaDB-1:10.3.39+maria~ubu2004' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
db-1 | 2024-08-25 9:32:29 8 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
directus-1 | - Table "directus_flows": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_users": "latin1_swedish_ci"
directus-1 | - Column "tags": "utf8mb4_bin"
directus-1 | - Column "auth_data": "utf8mb4_bin"
directus-1 | - Column "theme_light_overrides": "utf8mb4_bin"
directus-1 | - Column "theme_dark_overrides": "utf8mb4_bin"
directus-1 | - Table "directus_panels": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_revisions": "latin1_swedish_ci"
directus-1 | - Column "data": "utf8mb4_bin"
directus-1 | - Column "delta": "utf8mb4_bin"
directus-1 | - Table "directus_fields": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Column "display_options": "utf8mb4_bin"
directus-1 | - Column "translations": "utf8mb4_bin"
directus-1 | - Column "conditions": "utf8mb4_bin"
directus-1 | - Column "validation": "utf8mb4_bin"
directus-1 | - Table "directus_operations": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_permissions": "latin1_swedish_ci"
directus-1 | - Column "permissions": "utf8mb4_bin"
directus-1 | - Column "validation": "utf8mb4_bin"
directus-1 | - Column "presets": "utf8mb4_bin"
directus-1 | - Table "directus_webhooks": "latin1_swedish_ci"
directus-1 | - Column "headers": "utf8mb4_bin"
directus-1 | - Table "directus_settings": "latin1_swedish_ci"
directus-1 | - Column "storage_asset_presets": "utf8mb4_bin"
directus-1 | - Column "basemaps": "utf8mb4_bin"
directus-1 | - Column "module_bar": "utf8mb4_bin"
directus-1 | - Column "custom_aspect_ratios": "utf8mb4_bin"
directus-1 | - Column "theme_light_overrides": "utf8mb4_bin"
directus-1 | - Column "theme_dark_overrides": "utf8mb4_bin"
directus-1 | - Column "public_registration_email_filter": "utf8mb4_bin"
directus-1 | - Table "directus_presets": "latin1_swedish_ci"
directus-1 | - Column "layout_query": "utf8mb4_bin"
directus-1 | - Column "layout_options": "utf8mb4_bin"
directus-1 | - Column "filter": "utf8mb4_bin"
directus-1 | - Table "directus_collections": "latin1_swedish_ci"
directus-1 | - Column "translations": "utf8mb4_bin"
directus-1 | - Column "item_duplication_fields": "utf8mb4_bin"
directus-1 | - Table "directus_files": "latin1_swedish_ci"
directus-1 | - Column "metadata": "utf8mb4_bin"
directus-1 | - Column "tus_data": "utf8mb4_bin"
directus-1 |
directus-1 | [09:32:33.451] INFO: Initializing bootstrap...
directus-1 | [09:32:33.454] INFO: Database already initialized, skipping install
directus-1 | [09:32:33.454] INFO: Running migrations...
directus-1 | [09:32:33.461] INFO: Done
directus-1 | 2024-08-25T09:32:33: PM2 log: Launching in no daemon mode
directus-1 | 2024-08-25T09:32:33: PM2 log: App [directus:0] starting in -cluster mode-
directus-1 | [09:32:36.290] WARN: Some tables and columns do not match your database's default collation (latin1_swedish_ci):
directus-1 | - Table "directus_flows": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_users": "latin1_swedish_ci"
directus-1 | - Column "tags": "utf8mb4_bin"
directus-1 | - Column "auth_data": "utf8mb4_bin"
directus-1 | - Column "theme_light_overrides": "utf8mb4_bin"
directus-1 | - Column "theme_dark_overrides": "utf8mb4_bin"
directus-1 | - Table "directus_panels": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_revisions": "latin1_swedish_ci"
directus-1 | - Column "data": "utf8mb4_bin"
directus-1 | - Column "delta": "utf8mb4_bin"
directus-1 | - Table "directus_fields": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Column "display_options": "utf8mb4_bin"
directus-1 | - Column "translations": "utf8mb4_bin"
directus-1 | - Column "conditions": "utf8mb4_bin"
directus-1 | - Column "validation": "utf8mb4_bin"
directus-1 | - Table "directus_operations": "latin1_swedish_ci"
directus-1 | - Column "options": "utf8mb4_bin"
directus-1 | - Table "directus_permissions": "latin1_swedish_ci"
directus-1 | - Column "permissions": "utf8mb4_bin"
directus-1 | - Column "validation": "utf8mb4_bin"
directus-1 | - Column "presets": "utf8mb4_bin"
directus-1 | - Table "directus_webhooks": "latin1_swedish_ci"
directus-1 | - Column "headers": "utf8mb4_bin"
directus-1 | - Table "directus_settings": "latin1_swedish_ci"
directus-1 | - Column "storage_asset_presets": "utf8mb4_bin"
directus-1 | - Column "basemaps": "utf8mb4_bin"
directus-1 | - Column "module_bar": "utf8mb4_bin"
directus-1 | - Column "custom_aspect_ratios": "utf8mb4_bin"
directus-1 | - Column "theme_light_overrides": "utf8mb4_bin"
directus-1 | - Column "theme_dark_overrides": "utf8mb4_bin"
directus-1 | - Column "public_registration_email_filter": "utf8mb4_bin"
directus-1 | - Table "directus_presets": "latin1_swedish_ci"
directus-1 | - Column "layout_query": "utf8mb4_bin"
directus-1 | - Column "layout_options": "utf8mb4_bin"
directus-1 | - Column "filter": "utf8mb4_bin"
directus-1 | - Table "directus_collections": "latin1_swedish_ci"
directus-1 | - Column "translations": "utf8mb4_bin"
directus-1 | - Column "item_duplication_fields": "utf8mb4_bin"
directus-1 | - Table "directus_files": "latin1_swedish_ci"
directus-1 | - Column "metadata": "utf8mb4_bin"
directus-1 | - Column "tus_data": "utf8mb4_bin"
directus-1 |
directus-1 | [09:32:36.500] INFO: Server started at http://0.0.0.0:8055
directus-1 | 2024-08-25T09:32:36: PM2 log: App [directus:0] online
kevinyard@MBP-de-Kevin docker_api_pickfungi %