commit 3d64c4bc00c1ec8bcec978637c6f5031e3c6ee23 Author: Kévin Tessier Date: Thu Jun 21 17:12:00 2018 +0200 firstcommit diff --git a/.env b/.env new file mode 100644 index 0000000..4abc672 --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +COMPOSE_PROJECT_NAME=r2c-grav + +PROJECT_ROOT=./public_html +LOG_ROOT=./log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77ea2d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +public_html/* +log/* +*.sql +.DS_Store +.directory + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8624605 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "public_html"] + path = public_html + url = https://figureslibres.io/gogs/kevin/r2C.git 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..2201eaf --- /dev/null +++ b/Docker/php/Dockerfile @@ -0,0 +1,23 @@ +FROM php:7-fpm + +COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libzip-dev \ + zip && \ + docker-php-ext-install -j$(nproc) iconv mcrypt && \ + docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install -j$(nproc) gd && \ + docker-php-ext-install opcache && \ + docker-php-ext-configure zip --with-libzip && \ + docker-php-ext-install zip && \ + apt-get install -y git vim && \ + pecl install xdebug-2.5.0 && \ + docker-php-ext-enable xdebug + +RUN export COMPOSER_HOME=/usr/local/composer && \ + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer diff --git a/Docker/php/php-custom.ini b/Docker/php/php-custom.ini new file mode 100644 index 0000000..7d45b6c --- /dev/null +++ b/Docker/php/php-custom.ini @@ -0,0 +1 @@ +memory_limit = 526M diff --git a/README.md b/README.md new file mode 100644 index 0000000..011ca30 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# USG 2018 + +USG 2018 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 esadhar.net https://esadhar.net/gogs/bachir/docker-usg-2018.git +``` + +## Hosts and reverse proxy + +add to your /etc/hosts : +``` +127.0.0.1 dev.2018.unesaisongraphique.fr +``` +configure your apache vhosts to add a reverse proxy that will redirect the dev.materio.com to our container +``` + + ServerName dev.2018.unesaisongraphique.fr + 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 gravusg2018_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: