commit ec68d24ac2bacde0785ef094faa587a3d15ea2cc Author: kevin tessier Date: Sun Sep 29 15:38:02 2019 +0200 first commit diff --git a/.env b/.env new file mode 100644 index 0000000..a77a05f --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +COMPOSE_PROJECT_NAME=kevintessier_grav + +PROJECT_ROOT=./src +LOG_ROOT=./log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7b8cc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +src/* +log/* +*.sql +.DS_Store +.directory diff --git a/Docker/nginx/Dockerfile b/Docker/nginx/Dockerfile new file mode 100644 index 0000000..f1acc2d --- /dev/null +++ b/Docker/nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:latest + +COPY ./default.conf /etc/nginx/conf.d/default.conf diff --git a/Docker/nginx/default.conf b/Docker/nginx/default.conf new file mode 100644 index 0000000..83f32f4 --- /dev/null +++ b/Docker/nginx/default.conf @@ -0,0 +1,36 @@ +server { + listen 80 default_server; + root /var/www/html; + index index.html index.php; + + 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.log error; + + sendfile off; + + client_max_body_size 100m; + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php: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; + } +} diff --git a/Docker/php/Dockerfile b/Docker/php/Dockerfile new file mode 100644 index 0000000..50b72f5 --- /dev/null +++ b/Docker/php/Dockerfile @@ -0,0 +1,28 @@ +FROM php:7.3-fpm + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + mysql-client \ + zip \ + libzip-dev && \ + # docker-php-ext-install -j$(nproc) iconv && \ + docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + apt-get install -y imagemagick libmagickwand-dev && \ + pecl install imagick && docker-php-ext-enable imagick && \ + docker-php-ext-install -j$(nproc) gd && \ + docker-php-ext-install pdo_mysql zip && \ + docker-php-ext-install opcache && \ + docker-php-ext-install bcmath && \ + apt-get install -y git vim && \ + pecl install redis-4.3.0 && \ + pecl install xdebug-2.7.0 && \ + docker-php-ext-enable redis xdebug + +RUN export COMPOSER_HOME=/usr/local/composer && \ + curl -sS https://getcomposer.org/installer \ + | php -- --install-dir=/usr/local/bin --filename=composer + +COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini diff --git a/Docker/php/php-custom.ini b/Docker/php/php-custom.ini new file mode 100644 index 0000000..735a00e --- /dev/null +++ b/Docker/php/php-custom.ini @@ -0,0 +1,2 @@ +memory_limit = 526M +date.timezone = Europe/Paris diff --git a/README.md b/README.md new file mode 100644 index 0000000..f42a5b0 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# R2C + +r2C powered by grav in docker environement (nginx, php:5.6-fpm) + +## Install docker +``` +sudo pacman -S docker docker-compose docker-machine +``` + +## Clone this repos + +this will clone this repos (main docker environement) and the grav source code + +``` +git clone --recursive -o figli https://figureslibres.io/gogs/kevin/docker-r2c-grav.git +``` + +## Hosts and reverse proxy + +add to your /etc/hosts : +``` +127.0.0.1 dev.r2c.net +``` +configure your apache vhosts to add a reverse proxy that will redirect the dev.materio.com to our container +``` + + ServerName dev.r2c.net + ProxyPass / http://127.0.0.1:8880/ + ProxyPassReverse / http://127.0.0.1:8880/ + ProxyRequests Off + +``` + +## Docker + +### start daemon +launch the docker daemon +``` +sudo systemctl start docker +``` +### build +only before the first run (may take some time) +``` +sudo docker-compose build +``` +### run +then each time you want to launch the app +``` +sudo docker-compose up -d +``` +### loging in +``` +sudo docker exec -it r2c-grav_php_1 bash +``` + +## Visualize +You can now visit http://dev.2018.unesaisongraphique.fr or simply http://localhost:8880 on your browser +After the first run diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bd250cc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +version: "3.5" + +services: + php: + build: ./Docker/php/ + expose: + - 9000 + volumes: + - php-root-data:/root + - "${PROJECT_ROOT}:/var/www/html" + networks: + - server + + nginx: + build: ./Docker/nginx/ + ports: + - 8880:80 + volumes: + - "${PROJECT_ROOT}:/var/www/html" + - "${LOG_ROOT}:/var/log:rw" + networks: + - server + depends_on: + - php + +volumes: + php-root-data: + +networks: + server: diff --git a/src b/src new file mode 160000 index 0000000..8a48a6a --- /dev/null +++ b/src @@ -0,0 +1 @@ +Subproject commit 8a48a6ac0f86f798d2018591b01afb14e3450ed2