Set up Docker stack for figli_compta (Drupal + MariaDB + nginx)
Mirrors the leshed project's Docker layout. src/ is a git submodule containing the Drupal codebase. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
COMPOSE_PROJECT_NAME=figli_compta
|
||||
|
||||
PROJECT_ROOT=./src
|
||||
LOG_ROOT=./log
|
||||
|
||||
DB_ROOT_PASSWORD=figli_compta
|
||||
DB_NAME=figli_compta
|
||||
DB_USERNAME=figli_compta
|
||||
DB_PASSWORD=figli_compta
|
||||
|
||||
XDEBUG_INI=./ressources/xdebug.ini
|
||||
@@ -0,0 +1,4 @@
|
||||
src/*
|
||||
log/*
|
||||
*.sql
|
||||
*/*.gz
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "src"]
|
||||
path = src
|
||||
url = https://figureslibres.io/gitea/bachir/drupal-figli-compta.git
|
||||
@@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
max_allowed_packet=500M
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM nginx:latest
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
vim
|
||||
|
||||
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY ./bashrc /root/.bashrc
|
||||
COPY ./inputrc /root/.inputrc
|
||||
@@ -0,0 +1,3 @@
|
||||
PS1='\e[36m\e[1mNGINX\e[0m:\e[90m\w\e[0m\n$ '
|
||||
bind '"\e[A": history-search-backward'
|
||||
bind '"\e[B": history-search-forward'
|
||||
@@ -0,0 +1,41 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /var/www/figli_compta/web;
|
||||
index index.html index.php;
|
||||
server_name dev.figli-compta.local;
|
||||
|
||||
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/figli_compta/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;
|
||||
}
|
||||
|
||||
location ~ \.mjs$ {
|
||||
default_type application/javascript;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
set show-all-if-ambiguous on
|
||||
set completion-ignore-case on
|
||||
@@ -0,0 +1,65 @@
|
||||
FROM php:8.4-fpm
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmcrypt-dev \
|
||||
libpng-dev \
|
||||
mariadb-client \
|
||||
zip \
|
||||
libzip-dev
|
||||
# docker-php-ext-install -j$(nproc) iconv && \
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
|
||||
apt-get install -y imagemagick libmagickwand-dev && \
|
||||
pecl install imagick && docker-php-ext-enable imagick && \
|
||||
docker-php-ext-install -j$(nproc) gd && \
|
||||
docker-php-ext-install pdo_mysql zip && \
|
||||
docker-php-ext-install opcache && \
|
||||
docker-php-ext-install bcmath
|
||||
|
||||
|
||||
RUN apt-get install -y git vim
|
||||
|
||||
RUN pecl install redis && \
|
||||
docker-php-ext-enable redis
|
||||
|
||||
RUN pecl install xdebug && \
|
||||
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 && \
|
||||
curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar \
|
||||
-L -o /usr/local/bin/drush && \
|
||||
chmod +x /usr/local/bin/drush
|
||||
|
||||
RUN apt-get install -y rsyslog
|
||||
COPY ./rsyslog-drupal.conf /etc/rsyslog.d/drupal.conf
|
||||
# ENTRYPOINT ["sh", "-c", "service rsyslog start ; tail -f /dev/null"]
|
||||
|
||||
COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini
|
||||
# COPY ./php-fpm-custom.conf /usr/local/etc/php-fpm.d/php-fpm-custom.conf
|
||||
|
||||
# COPY ./bashrc /root/.bashrc
|
||||
# COPY ./inputrc /root/.inputrc
|
||||
|
||||
ARG USER_UID
|
||||
ARG USER_UNAME
|
||||
ARG USER_GID
|
||||
ARG USER_GNAME
|
||||
|
||||
RUN if getent group ${USER_GNAME} ; then groupdel ${USER_GNAME}; fi &&\
|
||||
groupadd -g ${USER_GID} ${USER_GNAME} &&\
|
||||
useradd -l -u ${USER_UID} -g ${USER_GNAME} ${USER_UNAME} &&\
|
||||
install -d -m 0755 -o ${USER_UNAME} -g ${USER_GNAME} /home/${USER_UNAME} &&\
|
||||
chown --changes --silent --no-dereference --recursive \
|
||||
--from=33:33 ${USER_UID}:${USER_GID} \
|
||||
/home/${USER_UNAME}
|
||||
# /.composer \
|
||||
# /var/run/php-fpm \
|
||||
# /var/lib/php/sessions \
|
||||
|
||||
COPY ./bashrc /home/${USER_UNAME}/.bashrc
|
||||
COPY ./inputrc /home/${USER_UNAME}/.inputrc
|
||||
|
||||
USER ${USER_UNAME}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
PS1='\e[36m\e[1mPHP-8.1\e[0m:\e[90m\w\e[0m\n$ '
|
||||
bind '"\e[A": history-search-backward'
|
||||
bind '"\e[B": history-search-forward'
|
||||
@@ -0,0 +1,2 @@
|
||||
set show-all-if-ambiguous on
|
||||
set completion-ignore-case on
|
||||
@@ -0,0 +1,9 @@
|
||||
memory_limit = 8192M
|
||||
upload_max_filesize = 50M
|
||||
post_max_size = 50M
|
||||
max_execution_time = 150
|
||||
|
||||
; Log level
|
||||
; Possible Values: alert, error, warning, notice, debug
|
||||
; Default Value: notice
|
||||
log_level = debug
|
||||
@@ -0,0 +1 @@
|
||||
local6.* /var/log/drupal.log
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/make
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
USER_UID := $(shell id -u)
|
||||
USER_UNAME := $(shell id -un)
|
||||
USER_GID := $(shell id -g)
|
||||
USER_GNAME := $(shell id -gn)
|
||||
DATE_NOW := $(shell date '+%Y-%m-%d_%H%M%S')
|
||||
|
||||
export USER_UID
|
||||
export USER_UNAME
|
||||
export USER_GID
|
||||
export USER_GNAME
|
||||
|
||||
|
||||
pull:
|
||||
docker compose pull
|
||||
|
||||
build:
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
downbuildup: down build up
|
||||
|
||||
up:
|
||||
docker compose up -d
|
||||
|
||||
ps:
|
||||
docker compose ps
|
||||
|
||||
logs:
|
||||
docker compose logs -f
|
||||
|
||||
maj_config: crd composer_install updb cim cr
|
||||
|
||||
crd:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "drush cache-clear drush"
|
||||
|
||||
composer_install:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "composer install --no-dev"
|
||||
|
||||
updb:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "drush updb -y"
|
||||
|
||||
cim:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "drush config-import -y"
|
||||
|
||||
cex:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "drush config-export -y"
|
||||
|
||||
cr:
|
||||
docker exec figli_compta-php-1 /bin/bash -c "drush cr"
|
||||
|
||||
restart_nginx:
|
||||
docker compose restart nginx
|
||||
|
||||
restart_php:
|
||||
docker compose restart php
|
||||
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
exec_nginx:
|
||||
docker exec -it figli_compta-nginx-1 bash
|
||||
|
||||
exec_php:
|
||||
docker exec -it figli_compta-php-1 bash
|
||||
|
||||
exec_mysql:
|
||||
docker exec -it figli_compta-mysql-1 bash
|
||||
|
||||
dump_db:
|
||||
docker exec figli_compta-mysql-1 sh -c 'exec mariadb-dump -uroot -pfigli_compta figli_compta' > ./ressources/figli_compta-$(DATE_NOW)-local.sql
|
||||
@@ -0,0 +1,37 @@
|
||||
# figli_compta
|
||||
|
||||
Outil métier interne pour la SAS Figures Libres : suivi des entrées/sorties
|
||||
et du solde de chaque associé (Sandrine, Maud, Ouidade, Chloé, Bachir,
|
||||
Valentin, EXT., EXT.WEB, Provision EPAU), et par client.
|
||||
|
||||
Stack : Drupal 11 (content model + validation + auth + saisie) en decoupled
|
||||
progressif, avec un dashboard Vue 3 (`/dashboard`) qui interroge JSON:API et
|
||||
fait tous les calculs côté client.
|
||||
|
||||
## Démarrage
|
||||
|
||||
```
|
||||
make build
|
||||
make up
|
||||
```
|
||||
|
||||
Le code Drupal (`src/`) est un sous-module git séparé.
|
||||
|
||||
- Site : http://localhost:8990
|
||||
- phpMyAdmin : http://localhost:8991
|
||||
- Identifiants admin de dev : admin / admin (à changer avant tout usage réel)
|
||||
|
||||
## Structure
|
||||
|
||||
- `Docker/` : Dockerfiles (php-8.4-fpm, nginx, config mysql)
|
||||
- `src/` : code Drupal (sous-module git séparé)
|
||||
- `ressources/` : templates settings.php/settings.local.php, xdebug.ini
|
||||
- `log/` : logs nginx/php (non versionnés)
|
||||
|
||||
## Modèle de données
|
||||
|
||||
- Content type **Ligne comptable** : date, type (entrée/charge/versement/achat/ouverture),
|
||||
client, montant HT/TTC, répartition.
|
||||
- Paragraph **Répartition** : compte + montant. La somme des répartitions
|
||||
doit toujours être égale au montant HT (contrôle automatique à la saisie).
|
||||
- Taxonomies **Compte** (9 comptes) et **Client** (liste unifiée).
|
||||
@@ -0,0 +1,66 @@
|
||||
services:
|
||||
|
||||
mysql:
|
||||
image: mariadb:latest
|
||||
volumes:
|
||||
- db-data:/var/lib/mysql
|
||||
- ./Docker/mysql/mysql.cnf:/etc/mysql/conf.d/custom.cnf:ro
|
||||
networks:
|
||||
- database
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
|
||||
MYSQL_DATABASE: "${DB_NAME}"
|
||||
MYSQL_USER: "${DB_USERNAME}"
|
||||
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
||||
|
||||
php:
|
||||
build: ./Docker/php-8.4-fpm/
|
||||
user: ${USER_UID}:${USER_GID}
|
||||
volumes:
|
||||
- php-user-data:/home/${USER_UNAME}
|
||||
- "${PROJECT_ROOT}:/var/www/figli_compta"
|
||||
- "${LOG_ROOT}/php:/var/log:rw"
|
||||
- "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini"
|
||||
working_dir: "/var/www/figli_compta/"
|
||||
environment:
|
||||
- APP_ENV=development
|
||||
- XDEBUG_MODE=debug
|
||||
networks:
|
||||
- database
|
||||
- server
|
||||
extra_hosts:
|
||||
- host.docker.internal:host-gateway
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
ports:
|
||||
- 8991:80
|
||||
networks:
|
||||
- database
|
||||
depends_on:
|
||||
- mysql
|
||||
environment:
|
||||
PMA_HOSTS: mysql
|
||||
|
||||
nginx:
|
||||
build: ./Docker/nginx/
|
||||
ports:
|
||||
- 8990:80
|
||||
working_dir: "/var/www"
|
||||
volumes:
|
||||
- "${PROJECT_ROOT}:/var/www/figli_compta"
|
||||
- "${LOG_ROOT}:/var/log:rw"
|
||||
networks:
|
||||
- server
|
||||
depends_on:
|
||||
- php
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
php-user-data:
|
||||
|
||||
networks:
|
||||
database:
|
||||
server:
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
// phpcs:ignoreFile
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Local development override configuration feature.
|
||||
*
|
||||
* To activate this feature, copy and rename it such that its path plus
|
||||
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
|
||||
* 'sites/default/settings.php' and uncomment the commented lines that mention
|
||||
* 'settings.local.php'.
|
||||
*
|
||||
* If you are using a site name in the path, such as 'sites/example.com', copy
|
||||
* this file to 'sites/example.com/settings.local.php', and uncomment the lines
|
||||
* at the bottom of 'sites/example.com/settings.php'.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assertions.
|
||||
*
|
||||
* The Drupal project primarily uses runtime assertions to enforce the
|
||||
* expectations of the API by failing when incorrect calls are made by code
|
||||
* under development.
|
||||
*
|
||||
* @see http://php.net/assert
|
||||
* @see https://www.drupal.org/node/2492225
|
||||
*
|
||||
* It is strongly recommended that you set zend.assertions=1 in the PHP.ini file
|
||||
* (It cannot be changed from .htaccess or runtime) on development machines and
|
||||
* to 0 or -1 in production.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enable local development services.
|
||||
*/
|
||||
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
|
||||
|
||||
/**
|
||||
* Show all error messages, with backtrace information.
|
||||
*
|
||||
* In case the error level could not be fetched from the database, as for
|
||||
* example the database connection failed, we rely only on this value.
|
||||
*/
|
||||
$config['system.logging']['error_level'] = 'verbose';
|
||||
|
||||
/**
|
||||
* Disable CSS and JS aggregation.
|
||||
*/
|
||||
$config['system.performance']['css']['preprocess'] = FALSE;
|
||||
$config['system.performance']['js']['preprocess'] = FALSE;
|
||||
|
||||
/**
|
||||
* Disable the render cache.
|
||||
*
|
||||
* Note: you should test with the render cache enabled, to ensure the correct
|
||||
* cacheability metadata is present. However, in the early stages of
|
||||
* development, you may want to disable it.
|
||||
*
|
||||
* This setting disables the render cache by using the Null cache back-end
|
||||
* defined by the development.services.yml file above.
|
||||
*
|
||||
* Only use this setting once the site has been installed.
|
||||
*/
|
||||
# $settings['cache']['bins']['render'] = 'cache.backend.null';
|
||||
|
||||
/**
|
||||
* Disable caching for migrations.
|
||||
*
|
||||
* Uncomment the code below to only store migrations in memory and not in the
|
||||
* database. This makes it easier to develop custom migrations.
|
||||
*/
|
||||
# $settings['cache']['bins']['discovery_migration'] = 'cache.backend.memory';
|
||||
|
||||
/**
|
||||
* Disable Internal Page Cache.
|
||||
*
|
||||
* Note: you should test with Internal Page Cache enabled, to ensure the correct
|
||||
* cacheability metadata is present. However, in the early stages of
|
||||
* development, you may want to disable it.
|
||||
*
|
||||
* This setting disables the page cache by using the Null cache back-end
|
||||
* defined by the development.services.yml file above.
|
||||
*
|
||||
* Only use this setting once the site has been installed.
|
||||
*/
|
||||
# $settings['cache']['bins']['page'] = 'cache.backend.null';
|
||||
|
||||
/**
|
||||
* Disable Dynamic Page Cache.
|
||||
*
|
||||
* Note: you should test with Dynamic Page Cache enabled, to ensure the correct
|
||||
* cacheability metadata is present (and hence the expected behavior). However,
|
||||
* in the early stages of development, you may want to disable it.
|
||||
*/
|
||||
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
|
||||
|
||||
/**
|
||||
* Allow test modules and themes to be installed.
|
||||
*
|
||||
* Drupal ignores test modules and themes by default for performance reasons.
|
||||
* During development it can be useful to install test extensions for debugging
|
||||
* purposes.
|
||||
*/
|
||||
# $settings['extension_discovery_scan_tests'] = TRUE;
|
||||
|
||||
/**
|
||||
* Enable access to rebuild.php.
|
||||
*
|
||||
* This setting can be enabled to allow Drupal's php and database cached
|
||||
* storage to be cleared via the rebuild.php page. Access to this page can also
|
||||
* be gained by generating a query string from rebuild_token_calculator.sh and
|
||||
* using these parameters in a request to rebuild.php.
|
||||
*/
|
||||
$settings['rebuild_access'] = TRUE;
|
||||
|
||||
/**
|
||||
* Skip file system permissions hardening.
|
||||
*
|
||||
* The system module will periodically check the permissions of your site's
|
||||
* site directory to ensure that it is not writable by the website user. For
|
||||
* sites that are managed with a version control system, this can cause problems
|
||||
* when files in that directory such as settings.php are updated, because the
|
||||
* user pulling in the changes won't have permissions to modify files in the
|
||||
* directory.
|
||||
*/
|
||||
$settings['skip_permissions_hardening'] = TRUE;
|
||||
|
||||
/**
|
||||
* Exclude modules from configuration synchronization.
|
||||
*
|
||||
* On config export sync, no config or dependent config of any excluded module
|
||||
* is exported. On config import sync, any config of any installed excluded
|
||||
* module is ignored. In the exported configuration, it will be as if the
|
||||
* excluded module had never been installed. When syncing configuration, if an
|
||||
* excluded module is already installed, it will not be uninstalled by the
|
||||
* configuration synchronization, and dependent configuration will remain
|
||||
* intact. This affects only configuration synchronization; single import and
|
||||
* export of configuration are not affected.
|
||||
*
|
||||
* Drupal does not validate or sanity check the list of excluded modules. For
|
||||
* instance, it is your own responsibility to never exclude required modules,
|
||||
* because it would mean that the exported configuration can not be imported
|
||||
* anymore.
|
||||
*
|
||||
* This is an advanced feature and using it means opting out of some of the
|
||||
* guarantees the configuration synchronization provides. It is not recommended
|
||||
* to use this feature with modules that affect Drupal in a major way such as
|
||||
* the language or field module.
|
||||
*/
|
||||
# $settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];
|
||||
@@ -0,0 +1,50 @@
|
||||
[xdebug]
|
||||
; xdebug.remote_enable=1
|
||||
xdebug.mode=debug
|
||||
|
||||
;Should use host.docker.internal but not working on linux
|
||||
; xdebug.remote_host=172.20.0.1
|
||||
; Replaced by xdebug.client_host.
|
||||
xdebug.client_host=host.docker.internal
|
||||
|
||||
|
||||
;Not working on docker context
|
||||
; xdebug.remote_connect_back=0
|
||||
; Replaced by xdebug.discover_client_host.
|
||||
xdebug.discover_client_host=0
|
||||
|
||||
|
||||
;9000 is already bound by php-fpm
|
||||
; xdebug.remote_port=9001
|
||||
; xdebug.remote_port #
|
||||
; Replaced by xdebug.client_port.
|
||||
; The default value has also changed from 9000 to 9003.
|
||||
xdebug.client_port=9001
|
||||
|
||||
xdebug.remote_handler=dbgp
|
||||
|
||||
; xdebug.remote_mode=req
|
||||
; xdebug.remote_mode #
|
||||
; For the req value (the original default), use xdebug.mode=debug with xdebug.start_with_request=trigger. If the original xdebug.remote_autostart behaviour is necessary, use xdebug.start_with_request=yes instead of trigger.
|
||||
|
||||
; For the jit value, use xdebug.mode=debug and xdebug.start_upon_error=yes.
|
||||
|
||||
|
||||
; xdebug.remote_autostart=true
|
||||
; Use xdebug.mode=debug with xdebug.start_with_request=yes
|
||||
xdebug.start_with_request=yes
|
||||
|
||||
; ?=XDEBUG_SESSION_START=1
|
||||
;Log file is mounted on volume so you can follow it
|
||||
; xdebug.remote_log=/var/log/xdebug-error.log
|
||||
; Replaced by xdebug.log, which also includes log messages beyond Step Debugging.
|
||||
xdebug.log=/var/log/xdebug-error.log
|
||||
|
||||
; xdebug.profiler_enable=0
|
||||
; xdebug.profiler_enable_trigger=1
|
||||
; Use xdebug.mode=profile with xdebug.start_with_request=trigger.
|
||||
xdebug.profiler_output_name = cachegrind.out.%t.%R
|
||||
xdebug.output_dir=/var/log/
|
||||
; Use the generic xdebug.output_dir setting.
|
||||
|
||||
; Example: http://localhost:8080/test?XDEBUG_PROFILE=1
|
||||
Submodule
+1
Submodule src added at ca800be21a
Reference in New Issue
Block a user