diff --git a/.env b/.env index b9462a9..d187d3d 100644 --- a/.env +++ b/.env @@ -1,7 +1,6 @@ COMPOSE_PROJECT_NAME=caravane -API_ROOT=./api -APP_ROOT=./app +SRC_ROOT=./src LOG_ROOT=./log DB_IMPORTE_FILE=./ressources/caravane.sql diff --git a/.gitmodules b/.gitmodules index d41c4ff..fdef03c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "api"] - path = api +[submodule "src"] + path = src url = https://figureslibres.io/gitea/bachir/drupal-caravane.git -[submodule "app"] - path = app - url = https://figureslibres.io/gitea/bachir/nuxt-caravane.git diff --git a/Docker/app/Dockerfile b/Docker/app/Dockerfile deleted file mode 100644 index 262a03b..0000000 --- a/Docker/app/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM node:lts-bookworm - -# THE ALL USER THINGS IS USELESS AS NODE IS ALREADY A USER @ 1000 - -# RUN find / -group 1000 -exec chgrp -h node {} \; -# RUN find / -user 1000 -exec chown -h node {} \; - -# ARG USER_UID -# ARG USER_UNAME -# ARG USER_GID -# ARG USER_GNAME - - -# # RUN addgroup -g 1000 gdp && \ -# # adduser -h /home/gdp -D -u 1000 gdp && \ -# RUN adduser -u ${USER_UID} -G users -s /bin/sh -D ${USER_UNAME} -# # chown -R gdp:gdp /home/gdp - -# RUN if getent group ${USER_GNAME} ; then groupdel ${USER_GNAME}; fi -# RUN groupadd -g ${USER_GID} ${USER_GNAME} -# RUN useradd -l -u ${USER_UID} -g ${USER_GNAME} ${USER_UNAME} -# RUN install -d -m 0755 -o ${USER_UNAME} -g ${USER_GNAME} /home/${USER_UNAME} -# RUN chown --changes --silent --no-dereference --recursive \ -# --from=33:33 ${USER_UID}:${USER_GID} \ -# /home/${USER_UNAME} - -# USER ${USER_UNAME} - -# COPY ./bashrc /home/${USER_UNAME}/.bashrc -# COPY ./inputrc /home/${USER_UNAME}/.inputrc - -# COPY ./bashrc /home/node/.bashrc # should do an echo in already existing /home/node/.bashcr -COPY ./inputrc /home/node/.inputrc - -COPY ./client-entrypoint.sh /usr/local/bin -# USER root -RUN chmod +x /usr/local/bin/client-entrypoint.sh -# USER ${USER_UNAME} -CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"] diff --git a/Docker/app/bashrc b/Docker/app/bashrc deleted file mode 100644 index c5b03d2..0000000 --- a/Docker/app/bashrc +++ /dev/null @@ -1,3 +0,0 @@ -PS1='\e[36m\e[1mNODE\e[0m:\e[90m\w\e[0m\n$ ' -bind '"\e[A": history-search-backward' -bind '"\e[B": history-search-forward' diff --git a/Docker/app/client-entrypoint.sh b/Docker/app/client-entrypoint.sh deleted file mode 100644 index 48de690..0000000 --- a/Docker/app/client-entrypoint.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -cat /etc/passwd|grep 1000 - -cd /app - -echo "Cleaning node_modules" -rm -rf node_modules - -echo "Cleaning npm cache" -npm cache clean --f - -echo "Npm install" -npm install - -# echo "Npm init" -# npm ci - - -# echo "Run npm dev" -# npm run dev -echo "APP_ENV $APP_ENV" - -if [ "$APP_ENV" = "prod" ]; then - echo "Run npm prod" - npm run build -else - echo "Run npm dev" - npm run dev -fi diff --git a/Docker/app/inputrc b/Docker/app/inputrc deleted file mode 100644 index db8d91d..0000000 --- a/Docker/app/inputrc +++ /dev/null @@ -1,2 +0,0 @@ -set show-all-if-ambiguous on -set completion-ignore-case on diff --git a/Docker/nginx/default.conf b/Docker/nginx/default.conf index 0e66878..aa83792 100644 --- a/Docker/nginx/default.conf +++ b/Docker/nginx/default.conf @@ -1,82 +1,35 @@ -upstream app{ - server app:3000; -} - server { listen 80 default_server; - # root /var/www/html/api/src/web; - # root /var/www/html/app/dist; + root /var/www/html/web; index index.html index.php; server_name *.caravane.fr; charset utf-8; location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-NginX-Proxy true; - proxy_set_header X-Ssl on; - proxy_cache off; - proxy_buffering off; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_pass http://app; - proxy_redirect off; - } - - # https://serversforhackers.com/c/nginx-php-in-subdirectory - location @api { - rewrite ^/api/(.*)$ /api/index.php; - } - - - location /api { - # rewrite /api/(.*)$ /$1 break; - # root /var/www/html/api/src/web; - alias /var/www/html/api/src/web/; - # index index.php; - # try_files $uri $uri/ /index.php?$query_string; - try_files $uri $uri/ @api; - - error_log /var/log/nginx/api-error.log debug; - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass api:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_intercept_errors off; - fastcgi_buffers 16 32k; - fastcgi_buffer_size 64k; - fastcgi_busy_buffers_size 64k; - fastcgi_read_timeout 150; - } - + 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/app-error.log error; + error_log /var/log/nginx/api-error.log debug; sendfile off; client_max_body_size 100m; - # location ~ \.php$ { - # fastcgi_split_path_info ^(.+\.php)(/.+)$; - # fastcgi_pass api: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; - # fastcgi_read_timeout 150; - # } + 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/api/Dockerfile b/Docker/php/Dockerfile similarity index 100% rename from Docker/api/Dockerfile rename to Docker/php/Dockerfile diff --git a/Docker/api/bashrc b/Docker/php/bashrc similarity index 100% rename from Docker/api/bashrc rename to Docker/php/bashrc diff --git a/Docker/api/inputrc b/Docker/php/inputrc similarity index 100% rename from Docker/api/inputrc rename to Docker/php/inputrc diff --git a/Docker/api/php-custom.ini b/Docker/php/php-custom.ini similarity index 100% rename from Docker/api/php-custom.ini rename to Docker/php/php-custom.ini diff --git a/Docker/api/php-fpm-custom.conf b/Docker/php/php-fpm-custom.conf similarity index 100% rename from Docker/api/php-fpm-custom.conf rename to Docker/php/php-fpm-custom.conf diff --git a/Docker/api/rsyslog-drupal.conf b/Docker/php/rsyslog-drupal.conf similarity index 100% rename from Docker/api/rsyslog-drupal.conf rename to Docker/php/rsyslog-drupal.conf diff --git a/Docker/api/rsyslog.service b/Docker/php/rsyslog.service similarity index 100% rename from Docker/api/rsyslog.service rename to Docker/php/rsyslog.service diff --git a/Makefile b/Makefile index 272e468..2d6f1d8 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,8 @@ build: buildnc: docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) -buildncapp: - docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) app +buildncphp: + docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) php buildnginx: docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) nginx @@ -41,21 +41,21 @@ ps: logs: docker-compose logs -f -api_maj_config: api_crd api_composer_install api_updb api_cim api_cr +maj_config: crd composer_install updb cim cr -api_crd: +crd: docker exec caravane-api-1 /bin/bash -c "drush cache-clear drush" -api_cr: +cr: docker exec caravane-api-1 /bin/bash -c "drush cr" -api_updb: +updb: docker exec caravane-api-1 /bin/bash -c "drush updb -y" -api_cim: +cim: docker exec caravane-api-1 /bin/bash -c "drush config-import -y" -api_composer_install: +composer_install: docker exec caravane-api-1 /bin/bash -c "composer install --no-dev" down: @@ -67,12 +67,6 @@ exec_api: restart_api: docker-compose restart api -exec_app: - docker exec -it caravane-app-1 bash - -restart_app: - docker-compose restart app - exec_mysql: docker exec -it caravane-mysql-1 bash diff --git a/api b/api deleted file mode 160000 index 701a24a..0000000 --- a/api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 701a24ad36130f473a9a793612d1bc41fe484366 diff --git a/app b/app deleted file mode 160000 index 016ce31..0000000 --- a/app +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 016ce312dec107e5fa2eb973f7ef2438e4ac005c diff --git a/docker-compose.yml b/docker-compose.yml index ec237a2..73ed1e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,18 +38,18 @@ services: environment: PMA_HOSTS: mysql - api: - build: ./Docker/api/ + php: + build: ./Docker/php/ expose: - 9000 - 9001 user: ${USER_UID}:${USER_GID} volumes: - php-user-data:/home/${USER_UNAME} - - "${API_ROOT}:/var/www/html/api" + - "${SRC_ROOT}:/var/www/html/" - "${LOG_ROOT}/php:/var/log:rw" - "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini" - working_dir: "/var/www/html/api/src" + working_dir: "/var/www/html/src" networks: - database - redis @@ -62,46 +62,26 @@ services: - mysql - redis - app: - build: ./Docker/app - user: ${USER_UID}:${USER_GID} - volumes: - - "${APP_ROOT}:/app" - - npm-user-data:/home/${USER_UNAME} - networks: - - app - - server - ports: - - 3000:3000 - working_dir: "/app" - environment: - - APP_ENV=dev - tty: true - nginx: build: ./Docker/nginx/ ports: - 8990:80 volumes: - - "${API_ROOT}:/var/www/html/api" - - "${APP_ROOT}:/var/www/html/app" + - "${SRC_ROOT}:/var/www/html" - "${LOG_ROOT}:/var/log:rw" - working_dir: "/var/www/html/api/" + working_dir: "/var/www/html/" networks: - server depends_on: - - api - - app + - php # command: [nginx-debug, '-g', 'daemon off;'] volumes: php-user-data: db-data: redis-data: - npm-user-data: networks: database: redis: server: - app: diff --git a/src b/src new file mode 160000 index 0000000..6acdd7b --- /dev/null +++ b/src @@ -0,0 +1 @@ +Subproject commit 6acdd7b6496090bbe1ef6c2cef7f22eceaa6c2e5