From c13516c08509a6a0ffbe9cf599ea64d35306c8b5 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 23 Apr 2024 21:51:07 +0200 Subject: [PATCH] Moved docker default passwords to .env --- .gitignore | 1 + Core/Configuration/Settings.class.php | 3 +-- Core/Documents/Install.class.php | 3 +-- README.md | 7 ++++--- docker-compose.yml | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Core/Configuration/Settings.class.php b/Core/Configuration/Settings.class.php index 61452f4..e0b7337 100644 --- a/Core/Configuration/Settings.class.php +++ b/Core/Configuration/Settings.class.php @@ -121,14 +121,13 @@ class Settings { // rate limiting $settings->redisPort = 6379; + $settings->redisPassword = ""; if (isDocker()) { $settings->rateLimitingEnabled = true; $settings->redisHost = "webbase-redis"; - $settings->redisPassword = "webbase-redis"; } else { $settings->rateLimitingEnabled = false; $settings->redisHost = ""; - $settings->redisPassword = ""; } return $settings; diff --git a/Core/Documents/Install.class.php b/Core/Documents/Install.class.php index 35f0708..2969b84 100644 --- a/Core/Documents/Install.class.php +++ b/Core/Documents/Install.class.php @@ -710,14 +710,13 @@ namespace Documents\Install { if (isDocker()) { $defaultHost = "db"; $defaultUsername = "root"; - $defaultPassword = "webbasedb"; $defaultDatabase = "webbase"; } else { $defaultHost = "localhost"; $defaultUsername = ""; - $defaultPassword = ""; $defaultDatabase = ""; } + $defaultPassword = ""; $views = array( self::CHECKING_REQUIREMENTS => array( diff --git a/README.md b/README.md index b8b1f81..05b23b9 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,10 @@ I actually don't know what i want to implement here. There are quite to many CMS 3. Open the webapp in your browser and follow the installation guide ### Docker Installation -1. `docker-compose build` -2. `docker-compose up` -3. Open the webapp in your browser and follow the installation guide +1. Create an `.env` file with `MYSQL_ROOT_PASSWORD` AND `REDIS_PASSWORD` +2. `docker-compose build` +3. `docker-compose up` +4Open the webapp in your browser and follow the installation guide 3a. Since the docker runs as user www-data (33), the following permissions are recommended and at least necessary for the installation process: ``` chown -R :33 . diff --git a/docker-compose.yml b/docker-compose.yml index 5072a38..faf503c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,8 +18,8 @@ services: ports: - '3306:3306' environment: - - "MYSQL_ROOT_PASSWORD=webbasedb" - - "MYSQL_DATABASE=webbase" + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_DATABASE: webbase php: container_name: webbase-php volumes: @@ -35,7 +35,7 @@ services: image: redis:latest ports: - '6379:6379' - command: redis-server --save 20 1 --loglevel warning --requirepass webbase-redis + command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD} volumes: - cache:/data volumes: