diff --git a/.env b/.env index 7eb79c9..b4685df 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -COMPOSE_PROJECT_NAME=popsu +COMPOSE_PROJECT_NAME=training PROJECT_ROOT=./src LOG_ROOT=./log diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0e0407a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src"] + path = src + url = https://figureslibres.io/gogs/ouidade/drupal-training.git diff --git a/Docker/nginx/default.conf b/Docker/nginx/default.conf index 658aafa..8ff414b 100644 --- a/Docker/nginx/default.conf +++ b/Docker/nginx/default.conf @@ -1,8 +1,8 @@ server { listen 80; - root /var/www/d7; + root /var/www/training/web; index index.html index.php; - server_name dev.d7.popsu.archi.fr; + server_name dev.training.fr; charset utf-8; @@ -14,7 +14,7 @@ server { location = /robots.txt { access_log off; log_not_found off; } access_log on; - error_log /var/log/nginx/error-d7.log error; + error_log /var/log/nginx/error.log error; sendfile off; @@ -22,45 +22,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass php_d7:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - } - - location ~ /\.ht { - deny all; - } -} - -server { - listen 80; - root /var/www/d9/web; - index index.html index.php; - server_name dev.d9.popsu.archi.fr; - - charset utf-8; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - access_log on; - error_log /var/log/nginx/error-d9.log error; - - sendfile off; - - client_max_body_size 100m; - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass php_d9:9000; + fastcgi_pass php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/README.md b/README.md index ac19a41..62cd575 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ https://wiki.archlinux.org/index.php/Docker#Installation this will clone this repos (main docker environement) and the training.fr drupal 9 source code (without sites/default folder nor mysq ddbs) ``` -git clone --recursive -o figli https://figureslibres.io/gogs/bachir/docker-training.git +git clone --recursive -o figli https://figureslibres.io/gogs/ouidade/docker-training.git ``` submodules : @@ -40,17 +40,17 @@ rsync the files from you know where (if you don't, you don't) to src/web/sites/d copy ```ressources/xdebug.ini.exemple``` to ```ressources/xdebug.ini``` and edit the ```xdebug.remote_host``` ip to your host locale ip (e.g. : 192.168.0.23) (or once the docker is started to the host ip from the container point of vu e.g. 172.21.0.1) ## Mysql -Copy your-sql-dump.sql files into ```./ressources/training_d9.sql``` +Copy your-sql-dump.sql files into ```./ressources/training.sql``` They will be automaticly imported into the mysql containers dbs (only) on the first docker-compose up ## Hosts and reverse proxy add to your /etc/hosts : ``` -127.0.0.1 dev.d9.training.archi.fr -127.0.0.1 dev.phpmyadmin.training.archi.fr +127.0.0.1 dev.training.fr +127.0.0.1 dev.phpmyadmin.training.fr ``` -configure your vhosts to add a reverse proxy that will redirect the dev.materio.com to our container +configure your vhosts to add a reverse proxy that will redirect the dev.training.fr to our container ### nginx @@ -61,7 +61,7 @@ sudo mkdir /etc/var/log/training ```nginx server { listen 80; - server_name dev.training.archi.fr; + server_name dev.training.fr; access_log off; error_log /var/log/nginx/training/error.log error; diff --git a/TUTO_INSTAL_DOCKER_NEW_PROJECT.md b/TUTO_INSTAL_DOCKER_NEW_PROJECT.md index 8a4ad74..9931ce1 100644 --- a/TUTO_INSTAL_DOCKER_NEW_PROJECT.md +++ b/TUTO_INSTAL_DOCKER_NEW_PROJECT.md @@ -18,10 +18,15 @@ change occurence in Readme (ctrl + D pour sélectionner tout en même temps) dossier Docker: php mettre bonne version Docker-compose.yml Makefile +.env (project name donne le nom aux containers) +docker > nginx > default.conf -### xdebug + +## xdebug copy ```ressources/xdebug.ini.exemple``` to ```ressources/xdebug.ini``` + + ### git remove old folder git @@ -30,17 +35,229 @@ remove old folder git rm -rf .git rm .gitmodules ``` +create new git repositorie -``` -git status -``` ``` git init git add . git commit -m 'first commit' +git remote add origin https://figureslibres.io/gogs/ouidade/docker-training.git +git push -u origin master + ``` +## Hosts and reverse proxy - +add to your /etc/hosts : +``` +127.0.0.1 dev.training.fr +127.0.0.1 dev.phpmyadmin.training.fr +``` +configure your vhosts to add a reverse proxy that will redirect the dev.training.fr to our container +create new file, dev.training.fr.conf, in /etc/nginx/sites-available + +``` +server { + listen 80; + server_name dev.training.fr; + + access_log off; + error_log /var/log/nginx/training/error.log error; + + client_max_body_size 100m; + + location / { + proxy_pass http://127.0.0.1:8980; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } + } + server { + listen 80; + server_name dev.phpmyadmin.training.fr; + + location / { + proxy_pass http://127.0.0.1:8981; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } + } +``` + +``` +sudo ln -s /etc/nginx/sites-available/dev.training.fr.conf /etc/nginx/sites-enabled +``` + +``` sudo nginx -t ``` all should be ok +``` +sudo systemctl restart nginx +``` + +### build docker +``` +make build +make up +make ps +``` + +### instal drupal with composer + +``` +cd public_html +composer create-project drupal/recommended-project:^9.5 . +``` + +## clone this profile into profiles folder +``` +cd profiles +git clone -o figli https://figureslibres.io/gogs/bachir/drupal-starterkit-profile.git +``` + +## include the profile's composer file to the main drupal's composer file + +install composer-merge-plugin +``` +composer require wikimedia/composer-merge-plugin +``` +then in main drupal's composer.js file add this in extra +``` +"extra": { + ... + "merge-plugin": { + "include": [ + "web/profiles/d8-starterkit-profile/composer.json" + ], + "recurse": true, + "replace": false, + "merge-extra": true + } + ... +} +``` + +## install the profile's merged dependencies with composer + +cd ../ +composer update + + + +### sites/default setup + +``` +mkdir -p web/sites/default/files +cp web/sites/default/default.settings.php web/sites/default/settings.php +``` +in docker exit container php and re-log as root in php container +``` +docker exec -u 0 -it training-php-1 bash +``` +then aply changes +``` +chgrp -R www-data web/sites/default/files +chgrp -R www-data web/sites/default/settings.php +chmod g+r web/sites/default/files +chmod g+r web/sites/default/settings.php +``` +exit container php as root ```ctrl + D``` + +### install database with install drupal on navigator + +choose profile figli starter kit + +for set up database use info in .env file (for work localserver only passwords very basic, be carefull if on line) + +advanced options : +hosts : mysql + +in dump databse there will be files but also modules config + + +### git the drupal (src folder) + +``` +git init +``` +create a .gitignore file + +``` +# Ignore directories generated by Composer +/drush/contrib/ +/vendor/ +/web/core/ +/web/modules/contrib/ +/web/themes/contrib/ +/web/profiles/contrib/ +/web/libraries/ +composer.lock +# Ignore sensitive information +/web/sites/*/settings.php +/web/sites/*/settings.local.php +/web/sites/*/services*.yml + +# Ignore Drupal's file directory +/web/sites/*/files/ + +# Ignore SimpleTest multi-site environment. +/web/sites/simpletest + +# Ignore files generated by PhpStorm +/.idea/ + +# Ignore .env files as they are personal +/.env + +# npm +node_modules/ + +*.patch +/.csslintrc +/.eslintrc.json +/.ht.router.php +/.htaccess +/INSTALL.txt +/README.txt +/autoload.php +/example.gitignore +/index.php +/robots.txt +/update.php +/web.config + +/web/.vscode/* +``` +``` +git status +git add . + +``` +remove file D8-starterit-profile from the git index in order to add it as a submodule. +```git reset web/profiles/d8-starterkit-profile``` + +add submodule +``` +git submodule add https://figureslibres.io/gogs/bachir/d8-starterkit-profile.git web/profiles/d8-starterkit-profile +``` +``` +git commit -m "first drupal instal working" +``` +Create new repository on gogs, for durpal +then +``` +git remote add origin https://figureslibres.io/gogs/ouidade/drupal-training.git +``` +``` +git push origin master +``` \ No newline at end of file diff --git a/src b/src new file mode 160000 index 0000000..12bb523 --- /dev/null +++ b/src @@ -0,0 +1 @@ +Subproject commit 12bb523bd49ad8892aa1f8eb8235ef82ae018012