reconverted to simple drupal env (we'll use progressive decoupling)

This commit is contained in:
Bachir Soussi Chiadmi 2024-07-09 12:48:06 +02:00
parent 7c331df2b2
commit 13e3577288
19 changed files with 32 additions and 184 deletions

3
.env
View File

@ -1,7 +1,6 @@
COMPOSE_PROJECT_NAME=caravane COMPOSE_PROJECT_NAME=caravane
API_ROOT=./api SRC_ROOT=./src
APP_ROOT=./app
LOG_ROOT=./log LOG_ROOT=./log
DB_IMPORTE_FILE=./ressources/caravane.sql DB_IMPORTE_FILE=./ressources/caravane.sql

7
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "api"] [submodule "src"]
path = api path = src
url = https://figureslibres.io/gitea/bachir/drupal-caravane.git url = https://figureslibres.io/gitea/bachir/drupal-caravane.git
[submodule "app"]
path = app
url = https://figureslibres.io/gitea/bachir/nuxt-caravane.git

View File

@ -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"]

View File

@ -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'

View File

@ -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

View File

@ -1,2 +0,0 @@
set show-all-if-ambiguous on
set completion-ignore-case on

View File

@ -1,82 +1,35 @@
upstream app{
server app:3000;
}
server { server {
listen 80 default_server; listen 80 default_server;
# root /var/www/html/api/src/web; root /var/www/html/web;
# root /var/www/html/app/dist;
index index.html index.php; index index.html index.php;
server_name *.caravane.fr; server_name *.caravane.fr;
charset utf-8; charset utf-8;
location / { location / {
proxy_set_header X-Real-IP $remote_addr; try_files $uri $uri/ /index.php?$query_string;
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;
}
} }
location = /favicon.ico { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; }
access_log on; access_log on;
error_log /var/log/nginx/app-error.log error; error_log /var/log/nginx/api-error.log debug;
sendfile off; sendfile off;
client_max_body_size 100m; client_max_body_size 100m;
# location ~ \.php$ { location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass api:9000; fastcgi_pass php:9000;
# fastcgi_index index.php; fastcgi_index index.php;
# include fastcgi_params; include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors off; fastcgi_intercept_errors off;
# fastcgi_buffer_size 16k; fastcgi_buffer_size 16k;
# fastcgi_buffers 4 16k; fastcgi_buffers 4 16k;
# fastcgi_read_timeout 150; }
# }
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;

View File

@ -21,8 +21,8 @@ build:
buildnc: 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) 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: 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) app 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: 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 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: logs:
docker-compose logs -f 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" 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" docker exec caravane-api-1 /bin/bash -c "drush cr"
api_updb: updb:
docker exec caravane-api-1 /bin/bash -c "drush updb -y" 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" 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" docker exec caravane-api-1 /bin/bash -c "composer install --no-dev"
down: down:
@ -67,12 +67,6 @@ exec_api:
restart_api: restart_api:
docker-compose restart api docker-compose restart api
exec_app:
docker exec -it caravane-app-1 bash
restart_app:
docker-compose restart app
exec_mysql: exec_mysql:
docker exec -it caravane-mysql-1 bash docker exec -it caravane-mysql-1 bash

1
api

@ -1 +0,0 @@
Subproject commit 701a24ad36130f473a9a793612d1bc41fe484366

1
app

@ -1 +0,0 @@
Subproject commit 016ce312dec107e5fa2eb973f7ef2438e4ac005c

View File

@ -38,18 +38,18 @@ services:
environment: environment:
PMA_HOSTS: mysql PMA_HOSTS: mysql
api: php:
build: ./Docker/api/ build: ./Docker/php/
expose: expose:
- 9000 - 9000
- 9001 - 9001
user: ${USER_UID}:${USER_GID} user: ${USER_UID}:${USER_GID}
volumes: volumes:
- php-user-data:/home/${USER_UNAME} - php-user-data:/home/${USER_UNAME}
- "${API_ROOT}:/var/www/html/api" - "${SRC_ROOT}:/var/www/html/"
- "${LOG_ROOT}/php:/var/log:rw" - "${LOG_ROOT}/php:/var/log:rw"
- "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini" - "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini"
working_dir: "/var/www/html/api/src" working_dir: "/var/www/html/src"
networks: networks:
- database - database
- redis - redis
@ -62,46 +62,26 @@ services:
- mysql - mysql
- redis - 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: nginx:
build: ./Docker/nginx/ build: ./Docker/nginx/
ports: ports:
- 8990:80 - 8990:80
volumes: volumes:
- "${API_ROOT}:/var/www/html/api" - "${SRC_ROOT}:/var/www/html"
- "${APP_ROOT}:/var/www/html/app"
- "${LOG_ROOT}:/var/log:rw" - "${LOG_ROOT}:/var/log:rw"
working_dir: "/var/www/html/api/" working_dir: "/var/www/html/"
networks: networks:
- server - server
depends_on: depends_on:
- api - php
- app
# command: [nginx-debug, '-g', 'daemon off;'] # command: [nginx-debug, '-g', 'daemon off;']
volumes: volumes:
php-user-data: php-user-data:
db-data: db-data:
redis-data: redis-data:
npm-user-data:
networks: networks:
database: database:
redis: redis:
server: server:
app:

1
src Submodule

@ -0,0 +1 @@
Subproject commit 6acdd7b6496090bbe1ef6c2cef7f22eceaa6c2e5