make file & readme

This commit is contained in:
2024-03-07 13:05:11 +01:00
parent 84b4444dad
commit d8879ebb32
7 changed files with 2432 additions and 24 deletions
+136 -24
View File
@@ -1,11 +1,19 @@
popsu-colloque
# Popsu Coloque 8.x Docker Environement
Popsu Coloque powered by druapl 8 in docker environement (nginx, php:7-fpm+drush, phpmyadmin, redis)
Popsu Colloques powered by druapl in docker environement (nginx, php-fpm+drush, phpmyadmin, redis)
## 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
@@ -15,12 +23,26 @@ this will clone this repos (main docker environement) and the edlp drupal 8 sour
git clone --recursive -o gogs https://figureslibres.io/gogs/bachir/docker-popsu-coloques.git
```
## touch log file
```
touch log/nginx/error.log
touch log/nginx/erable/error.log
```
### setup /sites/default/settings.php
`cp -r ressources/default public_html/sites/`
```
cp -r ressources/drupal/default/settings.php app/web/sites/default/
cp -r ressources/drupal/default/settings.local.php app/web/sites/default/
cp -r ressources/drupal/default/services.yml app/web/sites/default/
cp -r ressources/drupal/colloque2024.popsu.archi.fr/settings.php app/web/sites/colloque2024.popsu.archi.fr/
cp -r ressources/drupal/colloque2024.popsu.archi.fr/settings.local.php app/web/sites/colloque2024.popsu.archi.fr/
cp -r ressources/drupal/colloque2024.popsu.archi.fr/services.yml app/web/sites/colloque2024.popsu.archi.fr/
```
### get the sites/default/salt.txt file (if you don't have it, you don't)
### get the sites/default/files folder
get the files from where you have it and rsync it to public_html/sites/default/files/
rsync the files from you know where (if you don't, you don't) to app/sites/default/files/ and app/sites/colloque2024.popsu.archi.fr/files/
## Mysql
Copy your-sql-dump.sql into ./ressources/popsucolloque21.sql & ./ressources/popsucolloque24.sql
@@ -74,53 +96,111 @@ server {
```
## Docker
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.
```sh
usermod -aG docker yourusername
# https://wiki.archlinux.org/title/Docker#Installation
restart
```
### docker-compose pull
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
```
sudo docker-compose build
```
### run
then each time you want to launch the app
```sh
make up
```
sudo docker-compose up -d
```
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.
## Druapal Composer install
## Drupal Composer install
Only at first up, finish to install drupal composer dependencies
```
sudo docker exec -it popsucoloque_php_1 bash
```sh
make exec_php
composer install
# or juste
make composer_install
```
## Visualize
You can now visit http://dev.popsu-coloque.com on your browser
You can now visit http://dev.colloque2021.popsu.archi.fr & http://dev.colloque2024.popsu.archi.fr on your browser
## Coding
### drush
you can access to drush by loging into the php container
```
sudo docker exec -it popsucoloque_php_1 bash
```sh
make exec_php
```
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
```sh
git pull figli master
# then update all submodules
git submodule update --recursive --checkout
# if you updated d9 code then run
make maj_config
```
sudo docker cp your-db-file.sql popsucoloque_mysql_1:/root/
## Updating manualy the mysql db
copy your db backup into the mysql container
```sh
docker cp your-db-file.sql popsucoloque-mysql-1:/root/
```
log into mysql container
```
sudo docker exec -it popsucoloque_mysql_1 bash
```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 -popsu
> drop database colloque21;
> create database colloque21;
> exit;
mysql -uroot -ppopsu colloque21 < your-db-file-name.sql
```
or
```
mysql -uroot -popsu
> drop database colloque24;
> create database colloque24;
> exit;
mysql -uroot -ppopsu colloque24 < your-db-file-name.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
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)
@@ -142,11 +222,43 @@ logs:
down:
docker-compose down
php:
docker exec -it popsucoloque_php_1 bash
maj_config: crd composer_install updb cim cr
crd:
docker exec popsucoloque-php-1 /bin/bash -c "vendor/bin/drush cache-clear drush"
composer_install:
docker exec popsucoloque-php-1 /bin/bash -c "composer install --no-dev"
updb:
docker exec popsucoloque-php-1 /bin/bash -c "vendor/bin/drush updb -y"
cim:
docker exec popsucoloque-php-1 /bin/bash -c "vendor/bin/drush config-import -y"
cr:
docker exec q2d-php-1 /bin/bash -c "vendor/bin/drush cr"
exec_php:
docker exec -it popsucoloque-php-1 bash
exec_nginx:
docker exec -it popsucoloque-nginx-1 bash
exec_mysql:
docker exec -it popsucoloque-mysql-1 bash
restart_php:
docker-compose restart php
restart_nginx:
docker-compose restart nginx
dump_db:
docker exec popsucoloque-mysql-1 sh -c 'exec mysqldump -uroot -ppopsu colloque21' > ./ressources/colloque21-$(DATE_NOW)-local.sql
docker exec popsucoloque-mysql-1 sh -c 'exec mysqldump -uroot -ppopsu colloque24' > ./ressources/colloque24-$(DATE_NOW)-local.sql
phplegacy:
docker exec -it popsucoloque_php-legacy_1 bash
```