Compare commits

..

3 Commits

Author SHA1 Message Date
22f26ddb38 feat : Ajout du bundle Monolog pour la gestion des logs
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m13s
2026-01-22 11:00:06 +01:00
d3289c8497 fix : correction du path URI pour la création d'un poids dans une réception
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m13s
2026-01-22 10:21:45 +01:00
9f589bc86c ci : ajout du script et de la doc déploiement
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 1m12s
2026-01-21 21:18:47 +01:00
14 changed files with 631 additions and 53 deletions

3
.idea/ferme.iml generated
View File

@@ -147,6 +147,9 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/thecodingmachine/safe" />
<excludeFolder url="file://$MODULE_DIR$/vendor/lcobucci/jwt" />
<excludeFolder url="file://$MODULE_DIR$/vendor/lexik/jwt-authentication-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/monolog-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/monolog-bundle" />
<excludePattern pattern="reference.php" />
</content>
<orderEntry type="inheritedJdk" />

3
.idea/php.xml generated
View File

@@ -153,6 +153,9 @@
<path value="$PROJECT_DIR$/vendor/dompdf/php-font-lib" />
<path value="$PROJECT_DIR$/vendor/lexik/jwt-authentication-bundle" />
<path value="$PROJECT_DIR$/vendor/lcobucci/jwt" />
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bundle" />
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bridge" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.4" />

47
.idea/workspace.xml generated
View File

@@ -4,9 +4,17 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="ci : fix release artefact">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : Ajout de monolog pour la gestion des logs">
<change beforePath="$PROJECT_DIR$/.idea/ferme.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/ferme.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/bundles.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/bundles.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/makefile" beforeDir="false" afterPath="$PROJECT_DIR$/makefile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/symfony.lock" beforeDir="false" afterPath="$PROJECT_DIR$/symfony.lock" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -193,6 +201,9 @@
<path value="$PROJECT_DIR$/vendor/dompdf/php-font-lib" />
<path value="$PROJECT_DIR$/vendor/lexik/jwt-authentication-bundle" />
<path value="$PROJECT_DIR$/vendor/lcobucci/jwt" />
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bundle" />
<path value="$PROJECT_DIR$/vendor/symfony/monolog-bridge" />
</include_path>
</component>
<component name="ProjectColorInfo">{
@@ -262,7 +273,7 @@
<workItem from="1768374298711" duration="12403000" />
<workItem from="1768460547451" duration="26946000" />
<workItem from="1768547023783" duration="11371000" />
<workItem from="1768894030675" duration="33744000" />
<workItem from="1768894030675" duration="43713000" />
</task>
<task id="LOCAL-00001" summary="feat : Ajout de pinia, création de la table weight et reception mise en place du système de step pour les receptions (WIP)">
<option name="closed" value="true" />
@@ -416,7 +427,31 @@
<option name="project" value="LOCAL" />
<updated>1769022071620</updated>
</task>
<option name="localTasksCounter" value="20" />
<task id="LOCAL-00020" summary="ci : fix release artefact">
<option name="closed" value="true" />
<created>1769024603812</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1769024603812</updated>
</task>
<task id="LOCAL-00021" summary="ci : ajout du script et de la doc déploiement">
<option name="closed" value="true" />
<created>1769026716634</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1769026716634</updated>
</task>
<task id="LOCAL-00022" summary="fix : correction du path URI pour la création d'un poids dans une réception">
<option name="closed" value="true" />
<created>1769073690382</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1769073690382</updated>
</task>
<option name="localTasksCounter" value="23" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -487,7 +522,9 @@
<MESSAGE value="ci: auto tag + release artefact" />
<MESSAGE value="ci : auto tag + release artefact" />
<MESSAGE value="ci : fix release artefact" />
<option name="LAST_COMMIT_MESSAGE" value="ci : fix release artefact" />
<MESSAGE value="ci : ajout du script et de la doc déploiement" />
<MESSAGE value="fix : correction du path URI pour la création d'un poids dans une réception" />
<option name="LAST_COMMIT_MESSAGE" value="fix : correction du path URI pour la création d'un poids dans une réception" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@@ -1,4 +1,4 @@
# Déploiement Ferme (recette)
# Déploiement Ferme (release Gitea)
## 1) Premier déploiement
@@ -17,19 +17,7 @@
php8.4-mbstring php8.4-xml php8.4-curl php8.4-intl \
php8.4-zip php8.4-gd php8.4-pgsql php8.4-opcache
```
3. Installer Composer
```bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
```
4. Installer Node via NVM
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.bashrc
nvm install --lts
```
5. Installer PostgreSQL (si la DB est locale)
3. Installer PostgreSQL (si la DB est locale)
```bash
sudo apt install -y postgresql postgresql-contrib
sudo -u postgres psql
@@ -41,15 +29,14 @@
\q
```
### Déploiement applicatif
1. Cloner le repo
### Dossier de déploiement
1. Cer le dossier de déploiement
```bash
sudo mkdir -p /var/www
sudo git clone <repo> /var/www/ferme
sudo mkdir -p /var/www/ferme
sudo chown -R malio:malio /var/www/ferme
```
2. Variables denvironnement
- Backend : `/var/www/ferme/.env.local`
2. Créer le fichier denvironnement
- Backend : `/var/www/ferme/.env`
- `APP_ENV=prod`
- `APP_DEBUG=0`
- `APP_SECRET=...`
@@ -59,45 +46,34 @@
- `JWT_PASSPHRASE=...`
- `COOKIE_SECURE=1`
- `PONT_BASCULE_BYPASS=false`
- Frontend : `/var/www/ferme/frontend/.env`
- `NUXT_PUBLIC_APP_BASE=/`
- `NUXT_PUBLIC_API_BASE=/api`
3. Générer les clés JWT
```bash
cd /var/www/ferme
mkdir -p config/jwt
php bin/console lexik:jwt:generate-keypair
```
4. Config Nginx (sous-domaine)
4. Config Nginx (sous-domaine)<br>
Copier le fichier de conf /deploy/nginx/ferme.conf dans /etc/nginx/sites-available/ferme.conf
```bash
sudo cp /var/www/ferme/deploy/nginx/ferme.conf /etc/nginx/sites-available/ferme.conf
sudo ln -s /etc/nginx/sites-available/ferme.conf /etc/nginx/sites-enabled/ferme.conf
sudo nginx -t && sudo systemctl reload nginx
```
6. Déployer lapp
5. Installer le script de déploiement (disponible /scripts/deploy-release.sh)
```bash
cd /var/www/ferme
./scripts/deploy-native.sh
sudo nano /usr/local/bin/deploy-ferme
sudo chmod +x /usr/local/bin/deploy-ferme
```
7. Vérifications
- Front : `http://ferme.malio-dev.fr/`
- API : `http://ferme.malio-dev.fr/api/users`
- Login : `POST http://ferme.malio-dev.fr/api/login_check`
## 2) Déployer une nouvelle version (app déjà en place)
## 2) Déployer une release
1. Mettre à jour le code + build + migrations
1. Créer un tag sur `develop` (auto-tag `v0.0.X`)
2. Attendre que la release Gitea soit publiée
3. Déployer la release
```bash
cd /var/www/ferme
./scripts/deploy-native.sh
```
2. Si changement de conf Nginx
```bash
sudo cp /var/www/ferme/deploy/nginx/ferme.conf /etc/nginx/sites-available/ferme.conf
sudo nginx -t && sudo systemctl reload nginx
```
3. Si besoin, purger le cache Symfony
```bash
php /var/www/ferme/bin/console cache:clear --env=prod
php /var/www/ferme/bin/console cache:warmup --env=prod
sudo DEPLOY_OWNER=malio /usr/local/bin/deploy-ferme v0.0.X
```
### Vérifications
- Front : `http://ferme.malio-dev.fr/`
- API : `http://ferme.malio-dev.fr/api/users`
- Login : `POST http://ferme.malio-dev.fr/api/login_check`

View File

@@ -71,6 +71,20 @@ Le frontend ne lit jamais directement le token, le navigateur envoie automatique
- Le cookie est automatiquement envoyé pour les futures requêtes.
- La déconnexion utilise `POST /api/logout` et redirige vers `/login`.
## Livraison en recette
### Préparatifs
Avant de déployer, il faut penser à ajouter les variables d'env s'il y a des changements/modifications.
Le .env se trouve /var/www/ferme/.env
Le script de livraison est version dans le repo dans script/deploy-release.sh <br>
Sur la machine, il est disponible dans /usr/local/bin/deploy-ferme <br>
Pour le modifier, il faut copier le contenu du deploy-release.sh dans le deploy-ferme
### Livraison
Sur le serveur de recette, il suffit d'utiliser cette commande pour livrer
```bash
sudo DEPLOY_OWNER=malio /usr/local/bin/deploy-ferme vX.X.X
```
## Commandes utiles
Pour restart le container
```bash
@@ -102,3 +116,7 @@ Sélectionner entity User, taper sont mdp, le copier et l'ajouter dans l'insert
INSERT INTO "user" (username, roles, password)
VALUES ('Mon user', '["ROLE_USER"]', 'Mon mdp hashé');
```
## Gestion des logs
Pour suivre les logs en temps réel :
* tail -f var/log/dev.log
* tail -f var/log/prod.log

View File

@@ -24,6 +24,7 @@
"symfony/flex": "^2",
"symfony/framework-bundle": "8.0.*",
"symfony/http-client": "8.0.*",
"symfony/monolog-bundle": "^4.0",
"symfony/property-access": "8.0.*",
"symfony/property-info": "8.0.*",
"symfony/runtime": "8.0.*",

261
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f619208e7dd3272e671e7c2b139afa87",
"content-hash": "e122271fbb08b4c19c1fe6084f95aeab",
"packages": [
{
"name": "api-platform/doctrine-common",
@@ -2772,6 +2772,109 @@
},
"time": "2025-07-25T09:04:22+00:00"
},
{
"name": "monolog/monolog",
"version": "3.10.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0",
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/log": "^2.0 || ^3.0"
},
"provide": {
"psr/log-implementation": "3.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
"graylog2/gelf-php": "^1.4.2 || ^2.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8 || ^2.0",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"php-console/php-console": "^3.1.8",
"phpstan/phpstan": "^2",
"phpstan/phpstan-deprecation-rules": "^2",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "^10.5.17 || ^11.0.7",
"predis/predis": "^1.1 || ^2",
"rollbar/rollbar": "^4.0",
"ruflin/elastica": "^7 || ^8",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"ext-openssl": "Required to send log messages using SSL",
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "https://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/3.10.0"
},
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"type": "tidelift"
}
],
"time": "2026-01-02T08:56:05+00:00"
},
{
"name": "nelmio/cors-bundle",
"version": "2.6.0",
@@ -5272,6 +5375,162 @@
],
"time": "2025-12-31T09:29:34+00:00"
},
{
"name": "symfony/monolog-bridge",
"version": "v8.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/monolog-bridge.git",
"reference": "6dd0793eb9ebcecb0b909a5571ac6e82867d7b20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/6dd0793eb9ebcecb0b909a5571ac6e82867d7b20",
"reference": "6dd0793eb9ebcecb0b909a5571ac6e82867d7b20",
"shasum": ""
},
"require": {
"monolog/monolog": "^3",
"php": ">=8.4",
"symfony/http-kernel": "^7.4|^8.0",
"symfony/service-contracts": "^2.5|^3"
},
"require-dev": {
"symfony/console": "^7.4|^8.0",
"symfony/http-client": "^7.4|^8.0",
"symfony/mailer": "^7.4|^8.0",
"symfony/messenger": "^7.4|^8.0",
"symfony/mime": "^7.4|^8.0",
"symfony/security-core": "^7.4|^8.0",
"symfony/var-dumper": "^7.4|^8.0"
},
"type": "symfony-bridge",
"autoload": {
"psr-4": {
"Symfony\\Bridge\\Monolog\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides integration for Monolog with various Symfony components",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/monolog-bridge/tree/v8.0.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-11-01T09:19:23+00:00"
},
{
"name": "symfony/monolog-bundle",
"version": "v4.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/monolog-bundle.git",
"reference": "3b4ee2717ee56c5e1edb516140a175eb2a72bc66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/3b4ee2717ee56c5e1edb516140a175eb2a72bc66",
"reference": "3b4ee2717ee56c5e1edb516140a175eb2a72bc66",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0",
"monolog/monolog": "^3.5",
"php": ">=8.2",
"symfony/config": "^7.3 || ^8.0",
"symfony/dependency-injection": "^7.3 || ^8.0",
"symfony/http-kernel": "^7.3 || ^8.0",
"symfony/monolog-bridge": "^7.3 || ^8.0",
"symfony/polyfill-php84": "^1.30"
},
"require-dev": {
"phpunit/phpunit": "^11.5.41 || ^12.3",
"symfony/console": "^7.3 || ^8.0",
"symfony/yaml": "^7.3 || ^8.0"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Symfony\\Bundle\\MonologBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony MonologBundle",
"homepage": "https://symfony.com",
"keywords": [
"log",
"logging"
],
"support": {
"issues": "https://github.com/symfony/monolog-bundle/issues",
"source": "https://github.com/symfony/monolog-bundle/tree/v4.0.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-12-08T08:00:13+00:00"
},
{
"name": "symfony/password-hasher",
"version": "v8.0.0",

View File

@@ -8,6 +8,7 @@ use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
use Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle;
use Nelmio\CorsBundle\NelmioCorsBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\MonologBundle\MonologBundle;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -20,4 +21,5 @@ return [
NelmioCorsBundle::class => ['all' => true],
LexikJWTAuthenticationBundle::class => ['all' => true],
ApiPlatformBundle::class => ['all' => true],
MonologBundle::class => ['all' => true],
];

View File

@@ -0,0 +1,28 @@
monolog:
channels: [deprecation]
when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
when@prod:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: ["!deprecation"]
deprecation:
type: stream
channels: [deprecation]
path: "%kernel.logs_dir%/deprecations.log"

View File

@@ -1608,6 +1608,149 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* ...<mixed>
* },
* }
* @psalm-type MonologConfig = array{
* use_microseconds?: scalar|null|Param, // Default: true
* channels?: list<scalar|null|Param>,
* handlers?: array<string, array{ // Default: []
* type: scalar|null|Param,
* id?: scalar|null|Param,
* enabled?: bool|Param, // Default: true
* priority?: scalar|null|Param, // Default: 0
* level?: scalar|null|Param, // Default: "DEBUG"
* bubble?: bool|Param, // Default: true
* interactive_only?: bool|Param, // Default: false
* app_name?: scalar|null|Param, // Default: null
* include_stacktraces?: bool|Param, // Default: false
* process_psr_3_messages?: array{
* enabled?: bool|null|Param, // Default: null
* date_format?: scalar|null|Param,
* remove_used_context_fields?: bool|Param,
* },
* path?: scalar|null|Param, // Default: "%kernel.logs_dir%/%kernel.environment%.log"
* file_permission?: scalar|null|Param, // Default: null
* use_locking?: bool|Param, // Default: false
* filename_format?: scalar|null|Param, // Default: "{filename}-{date}"
* date_format?: scalar|null|Param, // Default: "Y-m-d"
* ident?: scalar|null|Param, // Default: false
* logopts?: scalar|null|Param, // Default: 1
* facility?: scalar|null|Param, // Default: "user"
* max_files?: scalar|null|Param, // Default: 0
* action_level?: scalar|null|Param, // Default: "WARNING"
* activation_strategy?: scalar|null|Param, // Default: null
* stop_buffering?: bool|Param, // Default: true
* passthru_level?: scalar|null|Param, // Default: null
* excluded_http_codes?: list<array{ // Default: []
* code?: scalar|null|Param,
* urls?: list<scalar|null|Param>,
* }>,
* accepted_levels?: list<scalar|null|Param>,
* min_level?: scalar|null|Param, // Default: "DEBUG"
* max_level?: scalar|null|Param, // Default: "EMERGENCY"
* buffer_size?: scalar|null|Param, // Default: 0
* flush_on_overflow?: bool|Param, // Default: false
* handler?: scalar|null|Param,
* url?: scalar|null|Param,
* exchange?: scalar|null|Param,
* exchange_name?: scalar|null|Param, // Default: "log"
* channel?: scalar|null|Param, // Default: null
* bot_name?: scalar|null|Param, // Default: "Monolog"
* use_attachment?: scalar|null|Param, // Default: true
* use_short_attachment?: scalar|null|Param, // Default: false
* include_extra?: scalar|null|Param, // Default: false
* icon_emoji?: scalar|null|Param, // Default: null
* webhook_url?: scalar|null|Param,
* exclude_fields?: list<scalar|null|Param>,
* token?: scalar|null|Param,
* region?: scalar|null|Param,
* source?: scalar|null|Param,
* use_ssl?: bool|Param, // Default: true
* user?: mixed,
* title?: scalar|null|Param, // Default: null
* host?: scalar|null|Param, // Default: null
* port?: scalar|null|Param, // Default: 514
* config?: list<scalar|null|Param>,
* members?: list<scalar|null|Param>,
* connection_string?: scalar|null|Param,
* timeout?: scalar|null|Param,
* time?: scalar|null|Param, // Default: 60
* deduplication_level?: scalar|null|Param, // Default: 400
* store?: scalar|null|Param, // Default: null
* connection_timeout?: scalar|null|Param,
* persistent?: bool|Param,
* message_type?: scalar|null|Param, // Default: 0
* parse_mode?: scalar|null|Param, // Default: null
* disable_webpage_preview?: bool|null|Param, // Default: null
* disable_notification?: bool|null|Param, // Default: null
* split_long_messages?: bool|Param, // Default: false
* delay_between_messages?: bool|Param, // Default: false
* topic?: int|Param, // Default: null
* factor?: int|Param, // Default: 1
* tags?: list<scalar|null|Param>,
* console_formatter_options?: mixed, // Default: []
* formatter?: scalar|null|Param,
* nested?: bool|Param, // Default: false
* publisher?: string|array{
* id?: scalar|null|Param,
* hostname?: scalar|null|Param,
* port?: scalar|null|Param, // Default: 12201
* chunk_size?: scalar|null|Param, // Default: 1420
* encoder?: "json"|"compressed_json"|Param,
* },
* mongodb?: string|array{
* id?: scalar|null|Param, // ID of a MongoDB\Client service
* uri?: scalar|null|Param,
* username?: scalar|null|Param,
* password?: scalar|null|Param,
* database?: scalar|null|Param, // Default: "monolog"
* collection?: scalar|null|Param, // Default: "logs"
* },
* elasticsearch?: string|array{
* id?: scalar|null|Param,
* hosts?: list<scalar|null|Param>,
* host?: scalar|null|Param,
* port?: scalar|null|Param, // Default: 9200
* transport?: scalar|null|Param, // Default: "Http"
* user?: scalar|null|Param, // Default: null
* password?: scalar|null|Param, // Default: null
* },
* index?: scalar|null|Param, // Default: "monolog"
* document_type?: scalar|null|Param, // Default: "logs"
* ignore_error?: scalar|null|Param, // Default: false
* redis?: string|array{
* id?: scalar|null|Param,
* host?: scalar|null|Param,
* password?: scalar|null|Param, // Default: null
* port?: scalar|null|Param, // Default: 6379
* database?: scalar|null|Param, // Default: 0
* key_name?: scalar|null|Param, // Default: "monolog_redis"
* },
* predis?: string|array{
* id?: scalar|null|Param,
* host?: scalar|null|Param,
* },
* from_email?: scalar|null|Param,
* to_email?: list<scalar|null|Param>,
* subject?: scalar|null|Param,
* content_type?: scalar|null|Param, // Default: null
* headers?: list<scalar|null|Param>,
* mailer?: scalar|null|Param, // Default: null
* email_prototype?: string|array{
* id: scalar|null|Param,
* method?: scalar|null|Param, // Default: null
* },
* verbosity_levels?: array{
* VERBOSITY_QUIET?: scalar|null|Param, // Default: "ERROR"
* VERBOSITY_NORMAL?: scalar|null|Param, // Default: "WARNING"
* VERBOSITY_VERBOSE?: scalar|null|Param, // Default: "NOTICE"
* VERBOSITY_VERY_VERBOSE?: scalar|null|Param, // Default: "INFO"
* VERBOSITY_DEBUG?: scalar|null|Param, // Default: "DEBUG"
* },
* channels?: string|array{
* type?: scalar|null|Param,
* elements?: list<scalar|null|Param>,
* },
* }>,
* }
* @psalm-type ConfigType = array{
* imports?: ImportsConfig,
* parameters?: ParametersConfig,
@@ -1620,6 +1763,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* nelmio_cors?: NelmioCorsConfig,
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
* api_platform?: ApiPlatformConfig,
* monolog?: MonologConfig,
* "when@dev"?: array{
* imports?: ImportsConfig,
* parameters?: ParametersConfig,
@@ -1632,6 +1776,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* nelmio_cors?: NelmioCorsConfig,
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
* api_platform?: ApiPlatformConfig,
* monolog?: MonologConfig,
* },
* "when@prod"?: array{
* imports?: ImportsConfig,
@@ -1645,6 +1790,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* nelmio_cors?: NelmioCorsConfig,
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
* api_platform?: ApiPlatformConfig,
* monolog?: MonologConfig,
* },
* "when@test"?: array{
* imports?: ImportsConfig,
@@ -1658,6 +1804,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* nelmio_cors?: NelmioCorsConfig,
* lexik_jwt_authentication?: LexikJwtAuthenticationConfig,
* api_platform?: ApiPlatformConfig,
* monolog?: MonologConfig,
* },
* ...<string, ExtensionType|array{ // extra keys must follow the when@%env% pattern or match an extension alias
* imports?: ImportsConfig,

View File

@@ -65,7 +65,7 @@ export const useWeighing = ({
})
} else {
await createWeight({
reception: `/receptions/${reception.value.id}`,
reception: `api/receptions/${reception.value.id}`,
type: mode,
dsd: baseDsd,
weight: baseWeight,

View File

@@ -101,6 +101,13 @@ copy-git-hook:
shell:
$(EXEC_PHP_INTERACTIVE) bash
shell-root:
$(EXEC_PHP_INTERACTIVE_ROOT) bash
# Suivi temps réel des logs dev
logs-dev:
$(EXEC_PHP_INTERACTIVE) sh -lc "tail -f var/log/dev.log"
# Force la version node
node-use:
bash -lc 'source "$$HOME/.nvm/nvm.sh" && nvm install && nvm use'

85
scripts/deploy-release.sh Normal file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./scripts/deploy-release.sh v0.0.1
# Requires: curl, tar, (optional) rsync
#
# Auth token: set RELEASE_TOKEN env var or create /etc/ferme-release-token
TAG="${1:-}"
if [ -z "$TAG" ]; then
echo "Usage: $0 v0.0.1" >&2
exit 1
fi
REPO_OWNER="MALIO-DEV"
REPO_NAME="Ferme"
GITEA_API="https://gitea.malio.fr/api/v1"
DEPLOY_DIR="/var/www/ferme"
if [ -f /etc/ferme-release-token ] && [ -z "${RELEASE_TOKEN:-}" ]; then
RELEASE_TOKEN="$(cat /etc/ferme-release-token)"
fi
tmp_dir="$(mktemp -d)"
cleanup() {
rm -rf "$tmp_dir"
}
trap cleanup EXIT
release_json="$tmp_dir/release.json"
curl_opts=(-sS)
if [ -n "${RELEASE_TOKEN:-}" ]; then
curl_opts+=(-H "Authorization: token ${RELEASE_TOKEN}")
fi
curl "${curl_opts[@]}" \
"${GITEA_API}/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${TAG}" \
-o "$release_json"
asset_url="$(python3 - "$release_json" <<'PY'
import json, sys
data = json.load(open(sys.argv[1], 'r'))
assets = data.get("assets", [])
for a in assets:
name = a.get("name", "")
if name.startswith("ferme-") and name.endswith(".tar.gz"):
print(a.get("browser_download_url", ""))
break
PY
)"
if [ -z "$asset_url" ]; then
echo "Release asset not found for tag ${TAG}" >&2
exit 1
fi
archive="$tmp_dir/artefact.tar.gz"
curl "${curl_opts[@]}" -L "$asset_url" -o "$archive"
tar -xzf "$archive" -C "$tmp_dir"
if command -v rsync >/dev/null 2>&1; then
rsync -a --delete \
--exclude ".env" \
--exclude ".env.local" \
--exclude "config/jwt" \
--exclude "var" \
"$tmp_dir"/ "$DEPLOY_DIR"/
else
cp -a "$tmp_dir"/. "$DEPLOY_DIR"/
fi
echo "Release ${TAG} deployed to ${DEPLOY_DIR}"
if [ -n "${DEPLOY_OWNER:-}" ]; then
DEPLOY_GROUP="${DEPLOY_GROUP:-www-data}"
chown -R "${DEPLOY_OWNER}:${DEPLOY_GROUP}" "$DEPLOY_DIR"
chmod -R g+rx,o+rx "$DEPLOY_DIR"
fi
if [ -f "${DEPLOY_DIR}/.env.local" ]; then
echo "Running migrations (if any)..."
php "${DEPLOY_DIR}/bin/console" doctrine:migrations:migrate --no-interaction --env=prod
else
echo "Skip migrations: ${DEPLOY_DIR}/.env.local not found" >&2
fi

View File

@@ -145,6 +145,18 @@
".editorconfig"
]
},
"symfony/monolog-bundle": {
"version": "4.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.7",
"ref": "1b9efb10c54cb51c713a9391c9300ff8bceda459"
},
"files": [
"config/packages/monolog.yaml"
]
},
"symfony/property-info": {
"version": "8.0",
"recipe": {