Ver Fonte

docker new version

Vincent GUFFON há 4 anos atrás
pai
commit
fa18391eab

+ 9 - 2
.env.skeleton

@@ -15,7 +15,8 @@ ES_VIRTUAL_HOST=local.elasticsearch.opentalent.fr
 ES_PORT=9200
 
 #API
-API_VIRTUAL_HOST=local.api.opentalent.fr,local.new.api.opentalent.fr
+API_VIRTUAL_HOST=local.api.opentalent.fr
+API_NEW_VIRTUAL_HOST=local.new.api.opentalent.fr
 
 #ADMIN
 ADMIN_VIRTUAL_HOST=local.admin.opentalent.fr
@@ -56,4 +57,10 @@ BLACK_FIRE_PORT=8707
 
 #Metabase
 METABASE_VIRTUAL_HOST=local.metabase.opentalent.fr
-METABASE_PORT=3000
+METABASE_PORT=3000
+
+#Phpdoc
+PHPDOC_VIRTUAL_HOST=local.api-doc.opentalent.fr
+
+#Jsdoc
+JSDOC_VIRTUAL_HOST=local.admin-doc.opentalent.fr

+ 6 - 0
README

@@ -113,3 +113,9 @@ Si on rencontre des erreurs "Oups an error occured" ==> regarder dans typo3temp/
 allez sur l'adresse url, ouvrir la console de debugger entrer :
 console.log(window.atob('dGhpc2lzdW5zYWZl'));
 cliquer n'importe où sur la page et taper le mot qui s'est afficher dans la console précédemment.
+
+
+========== Pour créer la PHP DOC de l'API ====================
+docker run --rm -v /opt/opentalent/apps/api/src/:/data -v /opt/opentalent/apps/apidoc:/output phpdoc/phpdoc:3.1 -d /data -t /output
+se rendre ensuite sur http://local.api-doc.opentalent.fr
+========== Pour créer la PHP DOC de l'API ====================

+ 66 - 35
docker-compose.yaml

@@ -6,7 +6,7 @@ services:
     container_name: nginx-proxy
     build:
       context: .
-      dockerfile: docker/nginx/Dockerfile
+      dockerfile: docker/nginx-proxy/Dockerfile
     restart: always
     ports:
       - 80:80
@@ -16,21 +16,6 @@ services:
       - /etc/nginx/vhost.d
       - /usr/share/nginx/html
 
-  nginx:
-    hostname: nginx
-    container_name: nginx
-    image: nginx:alpine
-    volumes:
-      - ./apps/api/public:/var/www/html/public:cached
-      - ./apps/opentalent-platform/web:/var/www/html/web:cached
-      - ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf:cached
-    environment:
-      - VIRTUAL_HOST=${API_VIRTUAL_HOST}
-      - HTTPS_METHOD=noredirect
-    depends_on:
-      - php70
-      - php74
-
   db:
     hostname: db
     container_name: mariaDb
@@ -50,6 +35,18 @@ services:
     environment:
       MYSQL_ROOT_PASSWORD: ${MYSQL_PASS}
 
+  nginx:
+    hostname: nginx
+    container_name: nginx
+    image: nginx:alpine
+    volumes:
+      - ./apps/opentalent-platform/web:/var/www/html/web:cached
+      - ./docker/nginx/site_php70.conf:/etc/nginx/conf.d/default.conf:cached
+    environment:
+      - VIRTUAL_HOST=${API_VIRTUAL_HOST}
+    depends_on:
+      - php70
+
   php70:
     hostname: apiLegacy
     container_name: php70
@@ -62,6 +59,7 @@ services:
     restart: always
     environment:
       - PHP_IDE_CONFIG=serverName=api
+      - HTTPS_METHOD=noredirect
     volumes:
       # Version Symfony 2
       - appdata:/var/www/html/app/cache/
@@ -80,6 +78,18 @@ services:
       - thumbor
       - nginx-proxy
 
+  nginx_new:
+    hostname: nginx_new
+    container_name: nginx_new
+    image: nginx:alpine
+    volumes:
+      - ./apps/api/public:/var/www/html/public:cached
+      - ./docker/nginx/site_php74.conf:/etc/nginx/conf.d/default.conf:cached
+    environment:
+      - VIRTUAL_HOST=${API_NEW_VIRTUAL_HOST}
+    depends_on:
+      - php74
+
   php74:
     hostname: api
     container_name: php74
@@ -92,6 +102,7 @@ services:
     restart: always
     environment:
       - PHP_IDE_CONFIG=serverName=api
+      - HTTPS_METHOD=noredirect
     volumes:
       # Le code sera surtout modifié en dehors du container, donc la consistence est prioritairement dans ce sens
       - ./apps/api:/var/www/html:cached
@@ -110,8 +121,8 @@ services:
       - nginx-proxy
 
   admin:
-    hostname: front
-    container_name: admin
+    hostname: frontLegacy
+    container_name: adminLegacy
     build:
       context: .
       dockerfile: docker/node/Dockerfile
@@ -130,13 +141,14 @@ services:
       - nginx
 
   admin2:
-    hostname: front2
-    container_name: admin2
+    hostname: front
+    container_name: admin
     build:
       context: .
       dockerfile: docker/admin/Dockerfile
     volumes:
-      - ./apps/admin:/home/workspace/admin:rw,cached
+      - ./apps/admin:/home/workspace:rw,cached
+      - ./apps/admin-doc:/home/admin-doc:rw,cached
     tty: true
     ports:
       - 3002:3002
@@ -147,7 +159,7 @@ services:
       - NODE_ENV=docker
       - HTTPS_METHOD=noredirect
     depends_on:
-      - nginx
+      - nginx_new
 
   portail:
     hostname: portail
@@ -213,18 +225,18 @@ services:
     depends_on:
       - nginx
 
-  metabase:
-    hostname: metabase
-    image: metabase/metabase
-    restart: always
-    volumes:
-      - ./metabase-data:/metabase-data
-    environment:
-      - MB_DB_FILE=./metabase-data/metabase.db
-      - VIRTUAL_HOST=${METABASE_VIRTUAL_HOST}
-      - VIRTUAL_PORT=${METABASE_PORT}
-    depends_on:
-      - db
+#  metabase:
+#    hostname: metabase
+#    image: metabase/metabase
+#    restart: always
+#    volumes:
+#      - ./metabase-data:/metabase-data
+#    environment:
+##      - MB_DB_FILE=./metabase-data/metabase.db
+#      - VIRTUAL_HOST=${METABASE_VIRTUAL_HOST}
+#      - VIRTUAL_PORT=${METABASE_PORT}
+#    depends_on:
+#      - db
 
   es:
     hostname: es
@@ -296,10 +308,29 @@ services:
       - php70
       - php74
 
+  phpdoc:
+    hostname: phpdoc
+    container_name: phpdoc
+    image: nginx:alpine
+    volumes:
+      - ./apps/api-doc:/usr/share/nginx/html
+    environment:
+      - VIRTUAL_HOST=${PHPDOC_VIRTUAL_HOST}
+    #docker run --rm -v /opt/opentalent/apps/api/src/:/data -v /opt/opentalent/apps/api-doc:/output phpdoc/phpdoc -d /data -t /output
+
+  jsdoc:
+    hostname: jsdoc
+    container_name: jsdoc
+    image: nginx:alpine
+    volumes:
+      - ./apps/admin-doc:/usr/share/nginx/html
+    environment:
+      - VIRTUAL_HOST=${JSDOC_VIRTUAL_HOST}
+
 volumes:
   mysqldata: ~
   elasticsearchdata: ~
-  metabase-data: ~
+#  metabase-data: ~
   # On rajoute un volume (de données non accessibles en dehors)
   appdata: ~
   appVendor: ~

+ 6 - 4
docker/admin/Dockerfile

@@ -3,11 +3,13 @@ FROM node:14.5.0-buster
 
 ENV WORKDIR /home/workspace
 
+RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
+    echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
+
+
+RUN apt-get update && apt-get install -y g++ build-essential yarn
+
 # Define working directory.
 WORKDIR ${WORKDIR}
 
-RUN npm install npm; \
-    npm i -g create-nuxt-app; \
-    rm -rf /usr/local/lib/node_modules/npm;
-
 CMD node

+ 3 - 0
docker/nginx-proxy/Dockerfile

@@ -0,0 +1,3 @@
+FROM jwilder/nginx-proxy:alpine
+
+ADD /docker/nginx-proxy/certs /etc/nginx/certs

+ 7 - 1
docker/nginx/certs/ssl_keys.sh → docker/nginx-proxy/certs/ssl_keys.sh

@@ -47,4 +47,10 @@ cp docker/nginx/certs/default.crt docker/nginx/certs/local.blackfire.opentalent.
 cp docker/nginx/certs/default.key docker/nginx/certs/local.metabase.opentalent.fr.key
 cp docker/nginx/certs/default.crt docker/nginx/certs/local.metabase.opentalent.fr.crt
 
-docker-compose build --no-cache nginx-proxy
+cp docker/nginx/certs/default.key docker/nginx/certs/local.api-doc.opentalent.fr.key
+cp docker/nginx/certs/default.crt docker/nginx/certs/local.api-doc.opentalent.fr.crt
+
+cp docker/nginx/certs/default.key docker/nginx/certs/local.admin-doc.opentalent.fr.key
+cp docker/nginx/certs/default.crt docker/nginx/certs/local.admin-doc.opentalent.fr.crt
+
+#docker-compose build --no-cache nginx-proxy

+ 0 - 3
docker/nginx/Dockerfile

@@ -1,3 +0,0 @@
-FROM jwilder/nginx-proxy:alpine
-
-ADD /docker/nginx/certs /etc/nginx/certs

+ 49 - 0
docker/nginx/site_php70.conf

@@ -0,0 +1,49 @@
+server {
+    server_name local.api.opentalent.fr;
+    root /var/www/html/web;
+
+    location / {
+        add_header 'Access-Control-Allow-Origin' '*';
+
+        # try to serve file directly, fallback to app.php
+        try_files $uri /app_dev.php$is_args$args;
+
+        http2_push_preload on;
+    }
+
+    proxy_buffer_size 128k;
+    proxy_buffers 4 256k;
+    proxy_busy_buffers_size 256k;
+
+    # DEV
+    # This rule should only be placed on your development environment
+    # In production, don't include this and don't deploy app_dev.php or config.php
+    location ~ ^/(app_dev|app_blackfire|config)\.php(/|$) {
+        fastcgi_pass php70:9000;
+        fastcgi_split_path_info ^(.+\.php)(/.*)$;
+        include fastcgi_params;
+
+        fastcgi_buffer_size 128k;
+        fastcgi_buffers 4 256k;
+        fastcgi_busy_buffers_size 256k;
+
+        # When you are using symlinks to link the document root to the
+        # current version of your application, you should pass the real
+        # application path instead of the path to the symlink to PHP
+        # FPM.
+        # Otherwise, PHP's OPcache may not properly detect changes to
+        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
+        # for more information).
+        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
+        fastcgi_param DOCUMENT_ROOT $realpath_root;
+        proxy_read_timeout 6000;
+
+        http2_push_preload on;
+    }
+
+    # return 404 for all other php files not matching the front controller
+    # this prevents access to other php files you don't want to be accessible.
+    location ~ \.php$ {
+        return 404;
+    }
+}

+ 8 - 41
docker/nginx/site.conf → docker/nginx/site_php74.conf

@@ -16,11 +16,19 @@ server {
     #     try_files $uri =404;
     # }
 
+    proxy_buffer_size 128k;
+    proxy_buffers 4 256k;
+    proxy_busy_buffers_size 256k;
+
     location ~ ^/index\.php(/|$) {
         fastcgi_pass php74:9000;
         fastcgi_split_path_info ^(.+\.php)(/.*)$;
         include fastcgi_params;
 
+        fastcgi_buffer_size 128k;
+        fastcgi_buffers 4 256k;
+        fastcgi_busy_buffers_size 256k;
+
         # optionally set the value of the environment variables used in the application
         # fastcgi_param APP_ENV prod;
         # fastcgi_param APP_SECRET <app-secret-id>;
@@ -49,45 +57,4 @@ server {
 
     error_log /var/log/nginx/project_error.log;
     access_log /var/log/nginx/project_access.log;
-}
-
-server {
-    server_name local.api.opentalent.fr;
-    root /var/www/html/web;
-
-    location / {
-        add_header 'Access-Control-Allow-Origin' '*';
-
-        # try to serve file directly, fallback to app.php
-        try_files $uri /app_dev.php$is_args$args;
-
-        http2_push_preload on;
-    }
-
-    # DEV
-    # This rule should only be placed on your development environment
-    # In production, don't include this and don't deploy app_dev.php or config.php
-    location ~ ^/(app_dev|app_blackfire|config)\.php(/|$) {
-        fastcgi_pass php70:9000;
-        fastcgi_split_path_info ^(.+\.php)(/.*)$;
-        include fastcgi_params;
-        # When you are using symlinks to link the document root to the
-        # current version of your application, you should pass the real
-        # application path instead of the path to the symlink to PHP
-        # FPM.
-        # Otherwise, PHP's OPcache may not properly detect changes to
-        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
-        # for more information).
-        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
-        fastcgi_param DOCUMENT_ROOT $realpath_root;
-        proxy_read_timeout 6000;
-
-        http2_push_preload on;
-    }
-
-    # return 404 for all other php files not matching the front controller
-    # this prevents access to other php files you don't want to be accessible.
-    location ~ \.php$ {
-        return 404;
-    }
 }

+ 11 - 0
docker/php7.4/Dockerfile

@@ -40,6 +40,17 @@ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; \
     php -r "unlink('composer-setup.php');"; \
     mv composer.phar /usr/local/bin/composer
 
+########   BLACKFIRE #########
+# If you use Alpine, you need to set this value to "alpine"
+RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
+    && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
+    && mkdir -p /tmp/blackfire \
+    && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
+    && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
+    && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
+    && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
+########   BLACKFIRE #########
+
 ######## Php conf ########
 COPY /.ssh /root/.ssh
 COPY /docker/php7.4/conf/memory.ini /usr/local/etc/php/conf.d

+ 2 - 0
docker/typo3/conf/xdebug.ini

@@ -12,3 +12,5 @@ xdebug.max_nesting_level=400
 ; for unix (your machine hostname)
 xdebug.remote_host = dev
 
+
+