Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrelemee committed Jan 13, 2025
2 parents b8d123a + b820d15 commit 55fb9d9
Show file tree
Hide file tree
Showing 104 changed files with 1,632 additions and 1,522 deletions.
2 changes: 1 addition & 1 deletion .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM composer:2.7 AS composer

FROM php:8.2-fpm
FROM php:8.3-fpm

COPY --from=composer /usr/bin/composer /usr/bin/composer

Expand Down
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BASE_URL=https://mon-indemnisation.anje-justice.fr
###< donnée de configuration de l'application ###

###> symfony/mailer ###
<<<<<<< ours
MAILER_FROM=ne-pas-repondre@mon-indemnisation.anje-justice.fr
MAILER_DSN=smtp://mailpit:1025
###< symfony/mailer ###
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Setup PHP and run tests
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
extensions: 'zip, intl, calendarn gd, pdo, pdo_pgsql, pgsql'

- name: Install yarn dependencies & build assets
Expand Down
123 changes: 6 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,9 @@
# 🇫🇷 👩‍⚖️ 🤝 Mon Indemnisation Justice (ex Précontentieux)

## Installation
L'application **Mon Indemnisation Justice** vise à améliorer la qualité du service rendu aux usagers en dématérialisant le processus d’indemnisation afin de réduire les délais de traitement des demandes, de gagner du temps pour le service précontentieux, et de permettre des économies financières pour le ministère de la Justice.

Avant tout, éditez un fichier `.env.local` en reprenant les valeurs déclarées dans `.env.internet`.

Ensuite, démarrer le projet via `docker compose`:


```bash
docker compose build
docker compose up -d
```

En développement, lancez [le mode `watch`](https://docs.docker.com/compose/file-watch/):

```bash
docker compose watch
```

Pour exécuter une commande, exemple ici `cat composer.json`, sur le conteneur du service `symfony`, lancez:

```bash
docker compose exec symfony cat composer.json
```

Pour sauter directement sur le conteneur, ouvrez un shell comme suit:

```bash
docker compose exec symfony bash
```

### Données de test

Pour pouvoir naviguer sur le site, il va vous falloir créer des utilisateurs avec leurs données. On peut réaliser ceci
grâce aux _data fixtures_:

```bash
# Depuis le conteneur du service `symfony`:
bin/console doctrine:fixture:load --purge-with-truncate --no-interaction
```

## Restaurer un dump

Nous allons produire un fichier au format SQL qui sera utilisé directement par le conteneur Docker de PostgreSQL en
local.

Commençons par nettoyer le dossier source:

```bash
rm -f .docker/scripts/*
```

Il faut d'abord générer un dump au format SQL. Pour cela, jouer cette commande depuis la base existante:

```bash


```bash
pg_dump $DATABASE_URL --schema=public --if-exists --clean --no-owner --no-privileges --exclude-table=public.spatial_ref_sys | grep -i -v 'extensions' > ./.docker/postgres/scripts/001-precontentieux-prod-$(date +'%Y-%m-%d').sql
```

On note ici que pour éliminer le bruit autour des extensions, on filtre à la volée les clauses qui les concernent.

Il reste à redémarrer le conteneur docker pour PostgreSQL :

```bash
docker compose rm --stop --force postgres
# Suppression de données de Postgre, pour forcer la recréation et la lecture des fichiers d'entrée
rm -Rf .docker/postgres/data/*
docker compose up -d postgres
```


## Test fonctionnels:

Pour lancer un test fonctionnel, on utilise [Panther](https://github.com/symfony/panther) et Firefox.

Pour pouvoir les lancer depuis le conteneur Docker:

```bash
# Firefox est déjà installé sur l'image de base ✅
./vendor/bin/bdi detect drivers
./vendor/bin/phpunit tests/Functional/
# Ou un test spécifique, pour un jeu de données précis:
./vendor/bin/phpunit --filter DepotBrisPorteTest::testDepotDossierBrisPorte@desktop
```

Si le test ne passe pas, c'est très compliqué de débugger en _headless_ depuis un conteneur. Dans ce cas on rejoue le
test depuis la machine _host_ :
```bash
# Aliaser les noms de service Docker comme étant locaux:
echo "127.0.0.1 postgres" | sudo tee -a /etc/hosts
echo "127.0.0.1 mailpit" | sudo tee -a /etc/hosts
# Installer `geckodriver` https://github.com/symfony/panther?tab=readme-ov-file#installing-chromedriver-and-geckodriver
# Ex sur MacOS :
brew install geckodriver
PANTHER_NO_HEADLESS=1 ./vendor/bin/phpunit tests/Functional/
```
En cas d'erreur suivante :

```
Fatal error: Uncaught Facebook\WebDriver\Exception\Internal\WebDriverCurlException: Curl error thrown for http DELETE to /session/a0be33fe-07d6-4f9b-8c03-24fc29795ae8

Failed to connect to 127.0.0.1 port 4444 after 0 ms: Couldn't connect to server in /app/vendor/php-webdriver/webdriver/lib/Exception/Internal/WebDriverCurlException.php:20
```
Ensuite suivie de :
```
RuntimeException: The port 9080 is already in use.
```
Il faut prendre soin de supprimer le process zombie qui écoute le port désiré par `panther`:
```bash
lsof -nP -t -i:9080 | xargs kill -9
```
Les préjudices éligibles à une indemnisation sont:
* ✅ les bris de portes : les portes fracturées à tort par les forces de l'ordre lors d'une opération
* 🕥 les mises sous scéllé
* 🕥 les dysfonctionnements
* 🕥 les sinistres
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use MonIndemnisationJustice\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use \Symfony\Component\Dotenv\Dotenv;

Expand Down
70 changes: 35 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"acsiomatic/device-detector-bundle": "^0.5.0",
"api-platform/core": "^3.2",
"acsiomatic/device-detector-bundle": "^0.6.0",
"api-platform/core": "*",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3",
Expand All @@ -19,35 +19,35 @@
"league/flysystem-bundle": "^3.3",
"martin-georgiev/postgresql-for-doctrine": "^2.5",
"nelmio/cors-bundle": "^2.4",
"pentatrion/vite-bundle": "^7.0",
"pentatrion/vite-bundle": "^7.1",
"phpstan/phpdoc-parser": "^1.28",
"sentry/sentry-symfony": "^5.0",
"symfony/apache-pack": "^1.0",
"symfony/asset": "6.4.*",
"symfony/cache": "6.4.*",
"symfony/console": "6.4.*",
"symfony/dotenv": "6.4.*",
"symfony/expression-language": "6.4.*",
"symfony/asset": "7.2.*",
"symfony/cache": "7.2.*",
"symfony/console": "7.2.*",
"symfony/dotenv": "7.2.*",
"symfony/expression-language": "7.2.*",
"symfony/flex": "^2",
"symfony/form": "6.4.*",
"symfony/framework-bundle": "6.4.*",
"symfony/http-client": "6.4.*",
"symfony/intl": "6.4.*",
"symfony/mailer": "6.4.*",
"symfony/mime": "6.4.*",
"symfony/form": "7.2.*",
"symfony/framework-bundle": "7.2.*",
"symfony/http-client": "7.2.*",
"symfony/intl": "7.2.*",
"symfony/mailer": "7.2.*",
"symfony/mime": "7.2.*",
"symfony/monolog-bundle": "^3.0",
"symfony/notifier": "6.4.*",
"symfony/process": "6.4.*",
"symfony/property-access": "6.4.*",
"symfony/property-info": "6.4.*",
"symfony/runtime": "6.4.*",
"symfony/security-bundle": "6.4.*",
"symfony/serializer": "6.4.*",
"symfony/string": "6.4.*",
"symfony/twig-bundle": "6.4.*",
"symfony/validator": "6.4.*",
"symfony/web-link": "6.4.*",
"symfony/yaml": "6.4.*",
"symfony/notifier": "7.2.*",
"symfony/process": "7.2.*",
"symfony/property-access": "7.2.*",
"symfony/property-info": "7.2.*",
"symfony/runtime": "7.2.*",
"symfony/security-bundle": "7.2.*",
"symfony/serializer": "7.2.*",
"symfony/string": "7.2.*",
"symfony/twig-bundle": "7.2.*",
"symfony/validator": "7.2.*",
"symfony/web-link": "7.2.*",
"symfony/yaml": "7.2.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/intl-extra": "~3.8.0",
"twig/twig": "^3.14"
Expand All @@ -62,12 +62,12 @@
},
"autoload": {
"psr-4": {
"App\\": "src/"
"MonIndemnisationJustice\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
"MonIndemnisationJustice\\Tests\\": "tests/"
}
},
"replace": {
Expand Down Expand Up @@ -97,7 +97,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.4.*"
"require": "7.2.*"
}
},
"require-dev": {
Expand All @@ -106,13 +106,13 @@
"doctrine/doctrine-fixtures-bundle": "^3.6",
"friendsofphp/php-cs-fixer": "^3.62",
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "6.4.*",
"symfony/css-selector": "6.4.*",
"symfony/debug-bundle": "6.4.*",
"symfony/browser-kit": "7.2.*",
"symfony/css-selector": "7.2.*",
"symfony/debug-bundle": "7.2.*",
"symfony/maker-bundle": "^1.0",
"symfony/panther": "^2.1",
"symfony/phpunit-bridge": "^7.0",
"symfony/stopwatch": "6.4.*",
"symfony/web-profiler-bundle": "6.4.*"
"symfony/stopwatch": "7.2.*",
"symfony/web-profiler-bundle": "7.2.*"
}
}
Loading

0 comments on commit 55fb9d9

Please sign in to comment.