readme
This commit is contained in:
@@ -1,47 +1,50 @@
|
|||||||
|
|
||||||
# training Docker
|
|
||||||
training powered by druapl 9 in docker environement (nginx, php:8.1-fpm+drush, mariadb, redis:4, phpmyadmin)
|
|
||||||
|
|
||||||
## Install docker
|
|
||||||
```
|
|
||||||
sudo pacman -S docker docker-compose docker-machine
|
|
||||||
```
|
|
||||||
art the docker service
|
|
||||||
```
|
|
||||||
sudo systemctl start docker
|
|
||||||
```
|
|
||||||
|
|
||||||
For all the following, DO NOT run docker or make commande as root or with sudo, use this setup: add your user to the docker user group, re-login, and restart docker.service.
|
|
||||||
|
|
||||||
https://wiki.archlinux.org/index.php/Docker#Installation
|
|
||||||
|
|
||||||
## Clone this repos
|
## Clone this repos
|
||||||
|
|
||||||
this will clone this repos (main docker environement) and the training.fr drupal 9 source code (without sites/default folder nor mysq ddbs)
|
clone a older docker of a similar project
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone --recursive -o figli https://figureslibres.io/gogs/ouidade/docker-training.git
|
git clone -o gogs gogs@figureslibres.io:bachir/docker-popsu.git
|
||||||
```
|
|
||||||
|
|
||||||
submodules :
|
|
||||||
- https://figureslibres.io/gogs/bachir/training-d9
|
|
||||||
|
|
||||||
### setup /sites/default/settings.php
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cp -r ressources/d9/settings.php src/web/sites/default/
|
or download docker folder from gogs
|
||||||
cp -r ressources/d9/settings.local.php src/web/sites/default/
|
|
||||||
|
|
||||||
|
## Change name and old project occurences
|
||||||
|
|
||||||
|
open folder in Vscodium and :
|
||||||
|
|
||||||
|
change folder name
|
||||||
|
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
|
||||||
|
copy ```ressources/xdebug.ini.exemple``` to ```ressources/xdebug.ini```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### git
|
||||||
|
|
||||||
|
remove old folder git
|
||||||
|
|
||||||
```
|
```
|
||||||
|
rm -rf .git
|
||||||
|
rm .gitmodules
|
||||||
|
```
|
||||||
|
create new git repositorie
|
||||||
|
|
||||||
### get the sites/default/files folder
|
```
|
||||||
rsync the files from you know where (if you don't, you don't) to src/web/sites/default/files/
|
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
|
||||||
|
|
||||||
### xdebug
|
```
|
||||||
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.sql```
|
|
||||||
They will be automaticly imported into the mysql containers dbs (only) on the first docker-compose up
|
|
||||||
|
|
||||||
## Hosts and reverse proxy
|
## Hosts and reverse proxy
|
||||||
|
|
||||||
@@ -52,13 +55,10 @@ add to your /etc/hosts :
|
|||||||
```
|
```
|
||||||
configure your vhosts to add a reverse proxy that will redirect the dev.training.fr to our container
|
configure your vhosts to add a reverse proxy that will redirect the dev.training.fr to our container
|
||||||
|
|
||||||
### nginx
|
|
||||||
|
|
||||||
```sh
|
create new file, dev.training.fr.conf, in /etc/nginx/sites-available
|
||||||
sudo mkdir /etc/var/log/training
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```nginx
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name dev.training.fr;
|
server_name dev.training.fr;
|
||||||
@@ -96,197 +96,216 @@ server {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### apache
|
```
|
||||||
```apache
|
sudo ln -s /etc/nginx/sites-available/dev.training.fr.conf /etc/nginx/sites-enabled
|
||||||
<Virtualhost *:80>
|
|
||||||
ServerName dev.training.fr
|
|
||||||
ProxyPass / http://127.0.0.1:8980/
|
|
||||||
ProxyPassReverse / http://127.0.0.1:8980/
|
|
||||||
ProxyRequests Off
|
|
||||||
ProxyPreserveHost On
|
|
||||||
proxy_buffer_size 128k;
|
|
||||||
proxy_buffers 4 256k;
|
|
||||||
proxy_busy_buffers_size 256k;
|
|
||||||
</Virtualhost>
|
|
||||||
<Virtualhost *:80>
|
|
||||||
ServerName dev.phpmyadmin.training.fr
|
|
||||||
ProxyPass / http://127.0.0.1:8981/
|
|
||||||
ProxyPassReverse / http://127.0.0.1:8981/
|
|
||||||
ProxyRequests Off
|
|
||||||
ProxyPreserveHost On
|
|
||||||
proxy_buffer_size 128k;
|
|
||||||
proxy_buffers 4 256k;
|
|
||||||
proxy_busy_buffers_size 256k;
|
|
||||||
</Virtualhost>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
``` sudo nginx -t ``` all should be ok
|
||||||
|
```
|
||||||
For all the following, DO NOT run docker or make commande as root or with sudo, use your regular user but first add your user to the docker user group, re-login, and restart docker.service.
|
sudo systemctl restart nginx
|
||||||
|
|
||||||
```sh
|
|
||||||
usermod -aG docker yourusername
|
|
||||||
# https://wiki.archlinux.org/title/Docker#Installation
|
|
||||||
restart
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### docker-compose pull
|
### build docker
|
||||||
pull the latest image of services
|
|
||||||
```sh
|
|
||||||
make pull
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### build
|
|
||||||
only before the first run (may take some time)
|
|
||||||
/!\ DO NOT use ```docker-compose build```, it will fail (check Makefile for more info)
|
|
||||||
```sh
|
|
||||||
make build
|
make build
|
||||||
```
|
|
||||||
|
|
||||||
### run
|
|
||||||
then each time you want to launch the app
|
|
||||||
```sh
|
|
||||||
make up
|
make up
|
||||||
```
|
make ps
|
||||||
Be aware that a first up, since the db is empty, it will be populated with your files ressources/db_d9.sql. It may take some time depending of your db size.
|
|
||||||
|
|
||||||
## Drupal Composer install
|
|
||||||
Only at first up, finish to install drupal 9 composer dependencies
|
|
||||||
```sh
|
|
||||||
make exec_php
|
|
||||||
composer install
|
|
||||||
# or juste
|
|
||||||
make composer_install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Visualize
|
### instal drupal with composer
|
||||||
You can now visit http://dev.training.fr on your browser
|
|
||||||
After the first run
|
|
||||||
|
|
||||||
## Coding
|
|
||||||
### drush
|
|
||||||
you can access to drush by loging into the php container
|
|
||||||
```sh
|
|
||||||
make exec_php
|
|
||||||
```
|
|
||||||
once inside the php container in /var/www/html you can use drush as usual
|
|
||||||
|
|
||||||
|
|
||||||
## Updating code
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git pull figli master
|
|
||||||
# then update all submodules
|
|
||||||
git submodule update --recursive --checkout
|
|
||||||
|
|
||||||
# if you updated d9 code then run
|
|
||||||
make maj_config
|
|
||||||
```
|
|
||||||
|
|
||||||
## Updating manualy the mysql db
|
|
||||||
copy your db backup into the mysql container
|
|
||||||
```sh
|
|
||||||
docker cp your-db-file.sql training-mysql-1:/root/
|
|
||||||
```
|
|
||||||
log into mysql container
|
|
||||||
```sh
|
|
||||||
make exec_mysql
|
|
||||||
```
|
|
||||||
once inside the mysql container you can use mysql command to drop then create and load the db with your file
|
|
||||||
```
|
|
||||||
|
|
||||||
mysql -uroot -ptraining
|
|
||||||
> drop database training;
|
|
||||||
> create database training;
|
|
||||||
> exit;
|
|
||||||
mysql -uroot -ptraining training < your-db-file.sql
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Makefile
|
|
||||||
|
|
||||||
DO NOT use directly docker or docker-compose to run this instance
|
|
||||||
use make instead like ```make up```
|
|
||||||
|
|
||||||
```makefile
|
|
||||||
#!/usr/bin/make
|
|
||||||
|
|
||||||
SHELL = /bin/sh
|
|
||||||
|
|
||||||
USER_UID := $(shell id -u)
|
|
||||||
USER_UNAME := $(shell id -un)
|
|
||||||
USER_GID := $(shell id -g)
|
|
||||||
USER_GNAME := $(shell id -gn)
|
|
||||||
|
|
||||||
export USER_UID
|
|
||||||
export USER_UNAME
|
|
||||||
export USER_GID
|
|
||||||
export USER_GNAME
|
|
||||||
|
|
||||||
|
|
||||||
pull:
|
|
||||||
docker-compose pull
|
|
||||||
|
|
||||||
build:
|
|
||||||
docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)
|
|
||||||
|
|
||||||
buildnc:
|
|
||||||
docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)
|
|
||||||
|
|
||||||
downbuildup: down build up
|
|
||||||
|
|
||||||
up:
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
ps:
|
|
||||||
docker-compose ps
|
|
||||||
|
|
||||||
logs:
|
|
||||||
docker-compose logs -f
|
|
||||||
|
|
||||||
maj_config: crd composer_install updb cim sync_struct cr pag
|
|
||||||
|
|
||||||
crd:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush cache-clear drush"
|
|
||||||
|
|
||||||
composer_install:
|
|
||||||
docker exec training-php-1 /bin/bash -c "composer install --no-dev"
|
|
||||||
|
|
||||||
updb:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush updb -y"
|
|
||||||
|
|
||||||
cim:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush config-import -y"
|
|
||||||
|
|
||||||
sync_struct:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush im --choice safe && drush ib --choice full"
|
|
||||||
|
|
||||||
cr:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush cr"
|
|
||||||
|
|
||||||
pag:
|
|
||||||
docker exec training-php-1 /bin/bash -c "drush pag all canonical_entities:node && drush pag all canonical_entities:taxonomy_term"
|
|
||||||
|
|
||||||
restart_nginx:
|
|
||||||
docker-compose restart nginx
|
|
||||||
|
|
||||||
restart_php:
|
|
||||||
docker-compose restart php
|
|
||||||
|
|
||||||
down:
|
|
||||||
docker-compose down
|
|
||||||
|
|
||||||
exec_nginx:
|
|
||||||
docker exec -it training-nginx-1 bash
|
|
||||||
|
|
||||||
exec_php:
|
|
||||||
docker exec -it training-php-1 bash
|
|
||||||
|
|
||||||
exec_mysql:
|
|
||||||
docker exec -it training-mysql-1 bash
|
|
||||||
|
|
||||||
dump_db:
|
|
||||||
docker exec training-mysql-1 sh -c 'exec mysqldump -uroot -ptraining training' > ./ressources/training-$(DATE_NOW)-local.sql
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
in docker, add in src folder the submodule drupal you just created
|
||||||
|
```
|
||||||
|
git submodule add https://figureslibres.io/gogs/ouidade/drupal-training.git src
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```
|
||||||
|
git add .
|
||||||
|
git commit -m "added drupal submodule"
|
||||||
|
git push origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
### check drush
|
||||||
|
```
|
||||||
|
drush st
|
||||||
|
drush cr
|
||||||
|
```
|
||||||
|
|
||||||
|
### check settings files
|
||||||
|
|
||||||
|
create file services.yml in src/web/sites/default (can copy from previous site)
|
||||||
|
|
||||||
|
in settings.php
|
||||||
|
```
|
||||||
|
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
|
||||||
|
include $app_root . '/' . $site_path . '/settings.local.php';
|
||||||
|
}
|
||||||
|
$databases['default']['default'] = array (
|
||||||
|
....
|
||||||
|
);
|
||||||
|
$settings['config_sync_directory'] = '../config/sync';
|
||||||
|
```
|
||||||
|
|
||||||
|
so the config databse is stored in a folder config/sync not in web, and so not shared online.
|
||||||
|
|
||||||
|
create folder config/sync at the root of your site (src)
|
||||||
|
|
||||||
|
## export config
|
||||||
|
|
||||||
|
```drush cst``` to see config status
|
||||||
|
```drush cex -y``` to export all that's in database in config/sync
|
||||||
|
|
||||||
|
git config
|
||||||
|
|
||||||
|
to add enable new module already in drupal core
|
||||||
|
```drush en module_name```
|
||||||
|
|
||||||
|
and then don't forget to export config ```drush cex``` and to git
|
||||||
|
|||||||
@@ -1,263 +0,0 @@
|
|||||||
## Clone this repos
|
|
||||||
|
|
||||||
clone a older docker of a similar project
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone -o gogs gogs@figureslibres.io:bachir/docker-popsu.git
|
|
||||||
|
|
||||||
```
|
|
||||||
or download docker folder from gogs
|
|
||||||
|
|
||||||
|
|
||||||
## Change name and old project occurences
|
|
||||||
|
|
||||||
open folder in Vscodium and :
|
|
||||||
|
|
||||||
change folder name
|
|
||||||
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
|
|
||||||
copy ```ressources/xdebug.ini.exemple``` to ```ressources/xdebug.ini```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### git
|
|
||||||
|
|
||||||
remove old folder git
|
|
||||||
|
|
||||||
```
|
|
||||||
rm -rf .git
|
|
||||||
rm .gitmodules
|
|
||||||
```
|
|
||||||
create new git repositorie
|
|
||||||
|
|
||||||
```
|
|
||||||
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
|
|
||||||
```
|
|
||||||
+1
-1
Submodule src updated: 12bb523bd4...072c2abbb8
Reference in New Issue
Block a user