Browse Source

firstcommit

Kévin Tessier 5 years ago
commit
3d64c4bc00
9 changed files with 164 additions and 0 deletions
  1. 4 0
      .env
  2. 6 0
      .gitignore
  3. 3 0
      .gitmodules
  4. 3 0
      Docker/nginx/Dockerfile
  5. 36 0
      Docker/nginx/default.conf
  6. 23 0
      Docker/php/Dockerfile
  7. 1 0
      Docker/php/php-custom.ini
  8. 58 0
      README.md
  9. 30 0
      docker-compose.yml

+ 4 - 0
.env

@@ -0,0 +1,4 @@
+COMPOSE_PROJECT_NAME=r2c-grav
+
+PROJECT_ROOT=./public_html
+LOG_ROOT=./log

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+public_html/*
+log/*
+*.sql
+.DS_Store
+.directory
+

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "public_html"]
+	path = public_html
+	url = https://figureslibres.io/gogs/kevin/r2C.git

+ 3 - 0
Docker/nginx/Dockerfile

@@ -0,0 +1,3 @@
+FROM nginx:latest
+
+COPY ./default.conf /etc/nginx/conf.d/default.conf

+ 36 - 0
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;
+    }
+}

+ 23 - 0
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

+ 1 - 0
Docker/php/php-custom.ini

@@ -0,0 +1 @@
+memory_limit = 526M

+ 58 - 0
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
+```
+<Virtualhost *:80>
+   ServerName dev.2018.unesaisongraphique.fr
+   ProxyPass / http://127.0.0.1:8880/
+   ProxyPassReverse / http://127.0.0.1:8880/
+   ProxyRequests Off
+</Virtualhost>
+```
+
+## 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

+ 30 - 0
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: