D7 running, D9 phpinfo ok
This commit is contained in:
259
README.md
259
README.md
@@ -7,97 +7,286 @@ Popsu powered by druapl 7 in docker environement (nginx, php:5.6-fpm+drush, mar
|
||||
sudo pacman -S docker docker-compose docker-machine
|
||||
```
|
||||
|
||||
start 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
|
||||
|
||||
this will clone this repos (main docker environement) and the materio-base drupal 7 source code (without sites/default folder)
|
||||
this will clone this repos (main docker environement) and the popsu.arch.fr drupal 7 & 9 source code (without sites/default folder nor mysq ddbs)
|
||||
|
||||
```
|
||||
git clone --recursive -o figli https://figureslibres.io/gogs/bachir/docker-popsu-d7.git
|
||||
git clone --recursive -o figli https://figureslibres.io/gogs/bachir/docker-popsu.git
|
||||
```
|
||||
|
||||
submodules :
|
||||
- https://figureslibres.io/gogs/bachir/popsu-d7
|
||||
- https://figureslibres.io/gogs/bachir/popsu-d9
|
||||
|
||||
### setup /sites/default/settings.php
|
||||
|
||||
```cp -r ressources/default public_html/sites/```
|
||||
```
|
||||
cp -r ressources/d7/settings.php src_d7/sites/default/
|
||||
cp -r ressources/d9/settings.php src_d9/sites/default/
|
||||
```
|
||||
|
||||
### get the sites/default/files folder
|
||||
get the files from where you have it and rsync it to public_html/sites/default/files/
|
||||
get the files from where you have it and rsync it to src_d7/sites/default/files/ and src_d9/web/sites/default/files/
|
||||
|
||||
## Mysql
|
||||
Copy your-sql-dump.sql into ./ressources/db.sql
|
||||
Copy your-sql-dump.sql into ./ressources/db_d7.sql or ./ressources/db_d9.sql
|
||||
It will be automaticly imported into the mysql container db (only) on the first docker-compose up
|
||||
|
||||
## Hosts and reverse proxy
|
||||
|
||||
add to your /etc/hosts :
|
||||
```
|
||||
127.0.0.1 dev.popsu.archi.fr
|
||||
127.0.0.1 dev.d7.popsu.archi.fr
|
||||
127.0.0.1 dev.d9.popsu.archi.fr
|
||||
127.0.0.1 dev.phpmyadmin.popsu.archi.fr
|
||||
```
|
||||
configure your apache vhosts to add a reverse proxy that will redirect the dev.materio.com to our container
|
||||
```
|
||||
```apache
|
||||
<Virtualhost *:80>
|
||||
ServerName dev.popsu.archi.fr
|
||||
ProxyPass / http://127.0.0.1:8880/
|
||||
ProxyPassReverse / http://127.0.0.1:8880/
|
||||
ProxyRequests Off
|
||||
ServerName dev.d7.popsu.archi.fr
|
||||
ProxyPass / http://127.0.0.1:8880/
|
||||
ProxyPassReverse / http://127.0.0.1:8880/
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
</Virtualhost>
|
||||
<Virtualhost *:80>
|
||||
ServerName dev.d9.popsu.archi.fr
|
||||
ProxyPass / http://127.0.0.1:8880/
|
||||
ProxyPassReverse / http://127.0.0.1:8880/
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
</Virtualhost>
|
||||
<Virtualhost *:80>
|
||||
ServerName dev.phpmyadmin.popsu.archi.fr
|
||||
ProxyPass / http://127.0.0.1:8881/
|
||||
ProxyPassReverse / http://127.0.0.1:8881/
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
</Virtualhost>
|
||||
```
|
||||
nginx
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name dev.d7.popsu.archi.fr dev.d9.popsu.archi.fr;
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/popsu/error.log error;
|
||||
|
||||
client_max_body_size 100m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8880;
|
||||
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.popsu.archi.fr;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8881;
|
||||
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;
|
||||
}
|
||||
}
|
||||
```
|
||||
<Virtualhost *:80>
|
||||
ServerName dev.phpmyadmin.popsu.archi.fr
|
||||
ProxyPass / http://127.0.0.1:8881/
|
||||
ProxyPassReverse / http://127.0.0.1:8881/
|
||||
ProxyRequests Off
|
||||
</Virtualhost>
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
### docker-compose pull
|
||||
pull the latest image of services
|
||||
```
|
||||
make pull
|
||||
```
|
||||
|
||||
### build
|
||||
only before the first run (may take some time)
|
||||
```
|
||||
sudo docker-compose build
|
||||
make build
|
||||
```
|
||||
/!\ DO NOT use ```docker-compose build```, it will faile
|
||||
|
||||
### run
|
||||
then each time you want to launch the app
|
||||
```
|
||||
sudo docker-compose up -d
|
||||
make up
|
||||
```
|
||||
Be aware that a first up, since the db is empty, it will be populated with your file db.sql. It may take some time depending of your db size.
|
||||
Be aware that a first up, since the db is empty, it will be populated with your files ressources/db_d7.sql and ressources/db_d9.sql. It may take some time depending of your db size.
|
||||
|
||||
### loging in
|
||||
## Drupal Composer install
|
||||
Only at first up, finish to install drupal 9 composer dependencies
|
||||
but first we need to downgrade composer to version 1
|
||||
(you'll need to do this downgrade every time you make_down then make_up)
|
||||
```
|
||||
sudo docker exec -it popsu_php_1 bash
|
||||
docker exec -u 0 -it popsu_php_d9_1 /bin/bash
|
||||
composer selfupdate --1
|
||||
```
|
||||
ctrl+d
|
||||
```
|
||||
make exec_php_d9
|
||||
composer install
|
||||
```
|
||||
|
||||
## Visualize
|
||||
You can now visit http://dev.popsu.archi.fr on your browser
|
||||
You can now visit http://dev.d7.popsu.archi.fr and http://dev.d9.popsu.archi.fr on your browser
|
||||
After the first run
|
||||
|
||||
## Coding
|
||||
### drush
|
||||
you can access to drush by loging into the php container
|
||||
```
|
||||
sudo docker exec -it popsu_php_1 bash
|
||||
make exec_php_d7
|
||||
# or
|
||||
make exec_php_d9
|
||||
```
|
||||
once inside the php container in /var/www/html you can use drush as usual
|
||||
|
||||
## updateding manualy mysql db
|
||||
copy your db backup into the mysql container
|
||||
|
||||
## Updating code
|
||||
|
||||
```
|
||||
sudo docker cp your-db-file.sql popsu_mysql_1:/root/
|
||||
git pull figli master
|
||||
# then update all submodules
|
||||
git submodule update --recursive --checkout
|
||||
# or only one
|
||||
git submodule update --checkout src_d7/
|
||||
# or
|
||||
git submodule update --checkout src_d9/
|
||||
make d9_maj_config
|
||||
```
|
||||
|
||||
## Updating manualy mysql db
|
||||
copy your db backup into the mysql container
|
||||
```sh
|
||||
docker cp your-db-file.sql popsu_mysql_d7_1:/root/
|
||||
# or
|
||||
docker cp your-db-file.sql popsu_mysql_d9_1:/root/
|
||||
```
|
||||
log into mysql container
|
||||
```
|
||||
sudo docker exec -it popsu_php_1 bash
|
||||
```sh
|
||||
make exec_mysql_d7
|
||||
# or
|
||||
make exec_mysql_d9
|
||||
```
|
||||
once inside the mysql container you can use mysql command to drop then create and load the db with your file
|
||||
```
|
||||
mysql -uroot -ppopsu
|
||||
> drop database popsu_d7;
|
||||
> create database popsu_d7;
|
||||
> exit;
|
||||
mysql -uroot -ppopsu popsu_d7 < your-db-file.sql
|
||||
# or
|
||||
mysql -uroot -ppopsu
|
||||
> drop database popsu_d9;
|
||||
> create database popsu_d9;
|
||||
> exit;
|
||||
mysql -uroot -ppopsu popsu_d9 < your-db-file.sql
|
||||
```
|
||||
|
||||
|
||||
# sources
|
||||
https://www.ostraining.com/blog/drupal/docker/
|
||||
## Makefile
|
||||
|
||||
http://tech.osteel.me/posts/2017/01/15/how-to-use-docker-for-local-web-development-an-update.html
|
||||
DO NOT use directly docker or docker-compose to run this instance
|
||||
use make instead like ```make up```
|
||||
|
||||
https://mmenozzi.github.io/2016/01/22/php-web-development-with-docker/
|
||||
```makefile
|
||||
#!/usr/bin/make
|
||||
|
||||
https://dzone.com/articles/continuous-drupal-maintaining-a-drupal-website-wit
|
||||
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
|
||||
|
||||
d9_maj_config: d9_crd d9_composer_install d9_updb d9_cim d9_cr
|
||||
|
||||
d9_crd:
|
||||
docker exec enfrancais_pgp_d9_1 /bin/bash -c "drush cache-clear drush"
|
||||
|
||||
d9_cr:
|
||||
docker exec enfrancais_pgp_d9_1 /bin/bash -c "drush cr"
|
||||
|
||||
d9_updb:
|
||||
docker exec enfrancais_pgp_d9_1 /bin/bash -c "drush updb -y"
|
||||
|
||||
d9_cim:
|
||||
docker exec enfrancais_pgp_d9_1 /bin/bash -c "drush config-import -y"
|
||||
|
||||
d9_composer_install:
|
||||
docker exec enfrancais_pgp_d9_1 /bin/bash -c "composer install --no-dev"
|
||||
|
||||
down:
|
||||
docker-compose down
|
||||
|
||||
exec_php_d7:
|
||||
docker exec -it popsu_php_d7_1 bash
|
||||
|
||||
exec_php_d9:
|
||||
docker exec -it popsu_php_d9_1 sh
|
||||
|
||||
exec_mysql_d7:
|
||||
docker exec -it popsu_mysql_d7 bash
|
||||
|
||||
exec_mysql_d9:
|
||||
docker exec -it popsu_mysql_d9 bash
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user