This commit is contained in:
2021-06-28 16:28:10 +02:00
parent 14ff62fb4d
commit 65bcc917ae
10 changed files with 123 additions and 27 deletions
+4 -2
View File
@@ -1,4 +1,6 @@
COMPOSE_PROJECT_NAME=kevintessier_grav COMPOSE_PROJECT_NAME=epau.archi.fr
PROJECT_ROOT=./src PROJECT_ROOT=./public_html
LOG_ROOT=./log LOG_ROOT=./log
XDEBUG_INI=./ressources/xdebug.ini
+1 -1
View File
@@ -1,4 +1,4 @@
src/* public_html/*
log/* log/*
*.sql *.sql
.DS_Store .DS_Store
+3
View File
@@ -0,0 +1,3 @@
[submodule "public_html"]
path = public_html
url = https://figureslibres.io/gogs/ouidade/dev-epau.archi.fr.git
+14 -10
View File
@@ -1,28 +1,32 @@
FROM php:7.3-fpm FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libfreetype6-dev \ libfreetype6-dev \
libjpeg62-turbo-dev \ libjpeg62-turbo-dev \
libmcrypt-dev \ libmcrypt-dev \
libpng-dev \ libpng-dev \
mysql-client \
zip \ zip \
libzip-dev && \ libzip-dev
# docker-php-ext-install -j$(nproc) iconv && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ RUN docker-php-ext-configure gd && \
apt-get install -y imagemagick libmagickwand-dev && \ apt-get install -y imagemagick libmagickwand-dev && \
pecl install imagick && docker-php-ext-enable imagick && \ pecl install imagick && docker-php-ext-enable imagick && \
docker-php-ext-install -j$(nproc) gd && \ docker-php-ext-install -j$(nproc) gd && \
docker-php-ext-install pdo_mysql zip && \ docker-php-ext-install zip && \
docker-php-ext-install opcache && \ docker-php-ext-install opcache && \
docker-php-ext-install bcmath && \ docker-php-ext-install bcmath && \
apt-get install -y git vim && \ apt-get install -y git vim
pecl install redis-4.3.0 && \
pecl install xdebug-2.7.0 && \ RUN pecl install redis-5.3.4 && docker-php-ext-enable redis
docker-php-ext-enable redis xdebug
RUN pecl install xdebug-3.0.4 && \
docker-php-ext-enable xdebug
RUN export COMPOSER_HOME=/usr/local/composer && \ RUN export COMPOSER_HOME=/usr/local/composer && \
curl -sS https://getcomposer.org/installer \ curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer | php -- --install-dir=/usr/local/bin --filename=composer
COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini
COPY ./bashrc /root/.bashrc
COPY ./inputrc /root/.inputrc
+4
View File
@@ -0,0 +1,4 @@
PS1='\e[36m\e[1mPHP-7.4\e[0m:\e[90m\w\e[0m\n$ '
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
+2
View File
@@ -0,0 +1,2 @@
set show-all-if-ambiguous on
set completion-ignore-case on
+74 -13
View File
@@ -1,6 +1,6 @@
# docker # epau.archi.fr
Docker php 7.3fpm nginx epau.archi.fr powered by grav in docker environement (nginx, php:7.0-fpm)
## Install docker ## Install docker
``` ```
@@ -12,21 +12,47 @@ sudo pacman -S docker docker-compose docker-machine
this will clone this repos (main docker environement) and the grav source code this will clone this repos (main docker environement) and the grav source code
``` ```
git clone --recursive -o figli https://figureslibres.io/gogs/kevin/docker-grav.git git clone --recursive -o figli https://figureslibres.io/gogs/ouidade/docker-epau.archi.fr-grav.git
``` ```
## Hosts and reverse proxy ## Hosts and reverse proxy
add to your /etc/hosts : add to your /etc/hosts :
``` ```
127.0.0.1 dev.docker-grav.net 127.0.0.1 dev.epau.archi.fr
``` ```
configure your apache 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 domain dev.figureslibres.com to our container
### nginx
edit ```/etc/nginx/sites-available/dev.epau.archi.fr.conf``` with :
```nginx
server {
listen 80;
server_name dev.epau.archi.fr;
location / {
proxy_pass http://127.0.0.1:8882;
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;
}
}
``` ```
then activate the vhost
```sh
sudo ln -s /etc/nginx/sites-available/dev.epau.archi.fr.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
```
### Apache
```apache
<Virtualhost *:80> <Virtualhost *:80>
ServerName dev.docker-grav.net ServerName dev.epau.archi.fr
ProxyPass / http://127.0.0.1:8880/ ProxyPass / http://127.0.0.1:8882/
ProxyPassReverse / http://127.0.0.1:8880/ ProxyPassReverse / http://127.0.0.1:8882/
ProxyRequests Off ProxyRequests Off
</Virtualhost> </Virtualhost>
``` ```
@@ -41,18 +67,53 @@ sudo systemctl start docker
### build ### build
only before the first run (may take some time) only before the first run (may take some time)
``` ```
sudo docker-compose build sudo docker-compose build --no-cache
``` ```
### run ### run
then each time you want to launch the app then each time you want to launch the app
``` ```
sudo docker-compose up -d sudo docker-compose up -d
``` ```
### loging in
### check if containers are running
``` ```
sudo docker exec -it docker-grav_php_1 bash sudo docker-compose ps
``` ```
### check the logs
```
sudo docker-compose logs -f
```
### install grav
```
# log into the php container
sudo docker exec -it epauarchifr_php_1 bash
# install grav using cli
bin/grav install
```
### fixing permissions
```
# log into the php container
sudo docker exec -it epauarchifr_php_1 bash
# run the script
./fixperms.sh
```
### Pages
fill the /user/pages with your contents or you'll get a 404 error
## Visualize ## Visualize
You can now visit http://dev.docker-grav.fr or simply http://localhost:8880 on your browser You can now visit http://dev.epau.archi.fr or simply http://localhost:8882 on your browser
After the first run
## Updating code
```
git pull figli master
# then update all submodules
git submodule update --recursive --checkout
```
+2 -1
View File
@@ -8,13 +8,14 @@ services:
volumes: volumes:
- php-root-data:/root - php-root-data:/root
- "${PROJECT_ROOT}:/var/www/html" - "${PROJECT_ROOT}:/var/www/html"
- "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini"
networks: networks:
- server - server
nginx: nginx:
build: ./Docker/nginx/ build: ./Docker/nginx/
ports: ports:
- 8880:80 - 8882:80
volumes: volumes:
- "${PROJECT_ROOT}:/var/www/html" - "${PROJECT_ROOT}:/var/www/html"
- "${LOG_ROOT}:/var/log:rw" - "${LOG_ROOT}:/var/log:rw"
Submodule
+1
Submodule public_html added at d608458880
+18
View File
@@ -0,0 +1,18 @@
[xdebug]
xdebug.remote_enable=1
;Should use host.docker.internal but not working on linux
xdebug.remote_host=172.20.0.1
;Not working on docker context
xdebug.remote_connect_back=0
;9000 is already bound by php-fpm
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
; ?=XDEBUG_SESSION_START=1
;Log file is mounted on volume so you can follow it
xdebug.remote_log=/var/log/xdebug-error.log
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir=/var/log/
; Example: http://localhost:8080/test?XDEBUG_PROFILE=1