From 6fe629c2dab93689cb637b35fe86c4bee36bf0fc Mon Sep 17 00:00:00 2001 From: abmmhasan Date: Thu, 11 Apr 2024 21:24:49 +0600 Subject: [PATCH 1/2] changeable project directory --- README.md | 18 ++++++++++++------ docker/compose/docker-compose.yml | 7 +++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2d7fa2e..05a6fa3 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ can be enabled based on Environment file (.env)! Supports multiple domains. ## The directory structure -For using your projects with this, you should arrange your projects structure as follows, +For using your projects with this, by default you should arrange your projects structure as follows, ``` | application |- site1 @@ -18,6 +18,13 @@ For using your projects with this, you should arrange your projects structure as |- ..... | localhost (this repository) ``` +But the project structure is flexible. If wanna change the directory of your projects (set other custom path instead of +same level application directory), just change/add the `PROJECT_DIR` in `.env` file, which should point to your project directory. + +```dotenv +PROJECT_DIR=../path/to/your/projects/directory # supports relative/absolute path +``` + Now lets look into the localhost structure for where your configuration files should be. ``` @@ -64,7 +71,7 @@ Checkout the .env.example file for example. To further understand these keep rea ### 1. Sync the system user Sync the internal docker user with the system user using the environment variable `UID`. In case of linux you can get this using `id -u` command which is the UID of current user. In case of windows, you can get with same command if you use [cmder -terminal](https://github.com/cmderdev/cmder). +terminal](https://github.com/cmderdev/cmder) or git-bash. ```dotenv UID=1000 @@ -91,7 +98,7 @@ COMPOSE_PROFILES=nginx,postgresql Select the PHP version using the environment variable `PHP_VERSION`. Supports single PHP version. ```dotenv -PHP_VERSION=8.2 +PHP_VERSION=8.3 ``` ### 4. PHP extensions @@ -205,7 +212,7 @@ _** If you have any other docker container running with the same name as of this - Certificate(s) will be generated directly inside the `configuration/ssl` directory - usage: `cert site1.internal site2.com *.site3.com .....` -In windows, it is recommended to use [cmder terminal](https://github.com/cmderdev/cmder) for better experience. +In windows, it is recommended to use [cmder terminal](https://github.com/cmderdev/cmder) or git-bash for better experience. ## Server Tools Well, you can use these tools to help you out. We have created a list of them below. These tools can help you do several things. @@ -230,6 +237,5 @@ This container mounts your application directory as `/app` inside the container. - `git-story` # Animated Git story generator (check `git-story -h` for command details) ## ToDo -- Supportive tools - Tunnel support -- SupervisorD +- SupervisorD with PHP diff --git a/docker/compose/docker-compose.yml b/docker/compose/docker-compose.yml index c3199f0..89a6359 100644 --- a/docker/compose/docker-compose.yml +++ b/docker/compose/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.9' name: cruise networks: cruise-net: @@ -18,7 +17,7 @@ services: environment: - TZ=${TZ:-Asia/Dhaka} volumes: - - ./../application:/app + - "${PROJECT_DIR:-./../application}:/app" - ./docker/logs/nginx:/var/log/nginx - ./configuration/nginx:/etc/nginx/conf.d - ./configuration/ssl:/etc/ssl/certs:rw @@ -48,7 +47,7 @@ services: env_file: - "./.env" volumes: - - ./../application:/app + - "${PROJECT_DIR:-./../application}:/app" - ./docker/conf/php/php.ini:/usr/local/etc/php/conf.d/99-overrides.ini - ./docker/conf/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:rw - ./docker/conf/php/openssl.cnf:/etc/ssl/openssl.cnf:rw @@ -81,7 +80,7 @@ services: - "${HTTP_PORT:-80}:80" - "${HTTPS_PORT:-443}:443" volumes: - - ./../application:/var/www/html + - "${PROJECT_DIR:-./../application}:/var/www/html" - ./docker/conf/php/php.ini:/usr/local/etc/php/conf.d/99-overrides.ini - ./docker/conf/php/openssl.cnf:/etc/ssl/openssl.cnf - ./configuration/ssl:/etc/apache2/ssl:rw From 33ee8c86210ba0bf013c5d4ec9e23df29343b932 Mon Sep 17 00:00:00 2001 From: abmmhasan Date: Sun, 14 Apr 2024 20:38:44 +0600 Subject: [PATCH 2/2] php.ini blank file creation --- configuration/php/.gitignore | 2 ++ configuration/php/php.ini | 1 - cruise | 6 +++++- cruise.bat | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 configuration/php/.gitignore delete mode 100644 configuration/php/php.ini diff --git a/configuration/php/.gitignore b/configuration/php/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/configuration/php/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/configuration/php/php.ini b/configuration/php/php.ini deleted file mode 100644 index 8d0e268..0000000 --- a/configuration/php/php.ini +++ /dev/null @@ -1 +0,0 @@ -# add your custom ini conf here diff --git a/cruise b/cruise index 0dcd9e0..37cacfd 100644 --- a/cruise +++ b/cruise @@ -21,6 +21,10 @@ fi find "${directory}/configuration/apache/" -type f -name "*.conf" -exec cp -ua {} "${directory}/docker/conf/docker-files/apache/" \; +if [ ! -f "${directory}/configuration/php/php.ini" ]; then + touch "${directory}/configuration/php/php.ini" +fi + case "$1" in up) docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml up @@ -37,7 +41,7 @@ case "$1" in ;; rebuild) docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml down - docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml build --no-cache --pull $@ + docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml build --no-cache --pull $2 $3 $4 $5 $6 $7 $8 $9 ;; core) docker exec -it Core bash -c "sudo -u devuser /bin/bash" diff --git a/cruise.bat b/cruise.bat index 12df370..ab67f3e 100644 --- a/cruise.bat +++ b/cruise.bat @@ -31,6 +31,10 @@ for /r "%directory%\configuration\apache\" %%f in (*.conf) do ( ) ) +if not exist "%directory%\configuration\php\php.ini" ( + type nul > "%directory%\configuration\php\php.ini" +) + if "%1" == "start" ( docker compose --project-directory "%directory%" -f docker/compose/docker-compose.yml up -d ) else if %1 == reload ( @@ -49,7 +53,7 @@ if "%1" == "start" ( docker compose --project-directory "%directory%" -f docker/compose/docker-compose.yml up -d ) else if %1 == rebuild ( docker compose --project-directory "%directory%" -f docker/compose/docker-compose.yml down - docker compose --project-directory "%directory%" -f docker/compose/docker-compose.yml build --no-cache --pull $@ + docker compose --project-directory "%directory%" -f docker/compose/docker-compose.yml build --no-cache --pull %2 %3 %4 %5 %6 %7 %8 %9 ) else if %1 == core ( docker exec -it Core bash -c "sudo -u devuser /bin/bash" ) else if %1 == lzd (