fix : dernière modification pour le déploiement en recette et le changement de conf vers nginx
This commit is contained in:
@@ -1,48 +1,22 @@
|
|||||||
# In all environments, the following files are loaded if they exist,
|
APP_ENV=
|
||||||
# the latter taking precedence over the former:
|
APP_DEBUG=
|
||||||
#
|
|
||||||
# * .env contains default values for the environment variables needed by the app
|
|
||||||
# * .env.local uncommitted file with local overrides
|
|
||||||
# * .env.$APP_ENV committed environment-specific defaults
|
|
||||||
# * .env.$APP_ENV.local uncommitted environment-specific overrides
|
|
||||||
#
|
|
||||||
# Real environment variables win over .env files.
|
|
||||||
#
|
|
||||||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
|
|
||||||
# https://symfony.com/doc/current/configuration/secrets.html
|
|
||||||
#
|
|
||||||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
|
|
||||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
|
||||||
|
|
||||||
###> symfony/framework-bundle ###
|
|
||||||
APP_ENV=dev
|
|
||||||
APP_SECRET=
|
APP_SECRET=
|
||||||
APP_SHARE_DIR=var/share
|
|
||||||
###< symfony/framework-bundle ###
|
|
||||||
|
|
||||||
###> symfony/routing ###
|
DEFAULT_URI=
|
||||||
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
|
|
||||||
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
|
|
||||||
DEFAULT_URI=http://localhost
|
|
||||||
###< symfony/routing ###
|
|
||||||
|
|
||||||
###> doctrine/doctrine-bundle ###
|
|
||||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
|
||||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
|
||||||
#
|
|
||||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
|
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
|
||||||
#DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
|
||||||
###< doctrine/doctrine-bundle ###
|
|
||||||
|
|
||||||
###> nelmio/cors-bundle ###
|
###> nelmio/cors-bundle ###
|
||||||
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
CORS_ALLOW_ORIGIN=
|
||||||
###< nelmio/cors-bundle ###
|
###< nelmio/cors-bundle ###
|
||||||
|
|
||||||
###> lexik/jwt-authentication-bundle ###
|
###> lexik/jwt-authentication-bundle ###
|
||||||
JWT_SECRET_KEY=
|
JWT_SECRET_KEY=
|
||||||
JWT_PUBLIC_KEY=
|
JWT_PUBLIC_KEY=
|
||||||
JWT_PASSPHRASE=
|
JWT_PASSPHRASE=
|
||||||
COOKIE_SECURE=1
|
COOKIE_SECURE=
|
||||||
###< lexik/jwt-authentication-bundle ###
|
###< lexik/jwt-authentication-bundle ###
|
||||||
|
|
||||||
|
# ADAPTER avec la vraie BDD (pas de variables docker)
|
||||||
|
DATABASE_URL=
|
||||||
|
|
||||||
|
PONT_BASCULE_BYPASS=
|
||||||
|
PONT_BASCULE_URL=
|
||||||
|
|||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="db-tree-configuration">
|
||||||
|
<option name="data" value="---------------------------------------- 1:0:f407a514-c6b4-4b26-9555-445a85892502 2:0:ae622167-c834-4e7b-87a5-c1721036f5dc " />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+14
-11
@@ -4,15 +4,9 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : fix de la conf pour le déploiement en recette">
|
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : migration apache vers nginx pour un déploiement plus simple">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/config/packages/security.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/config/packages/security.yaml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/config/routes/api_platform.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/config/routes/api_platform.yaml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose.yml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/docker/php/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/docker/php/Dockerfile" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/docker/php/config/vhost.conf" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/makefile" beforeDir="false" afterPath="$PROJECT_DIR$/makefile" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -268,7 +262,7 @@
|
|||||||
<workItem from="1768374298711" duration="12403000" />
|
<workItem from="1768374298711" duration="12403000" />
|
||||||
<workItem from="1768460547451" duration="26946000" />
|
<workItem from="1768460547451" duration="26946000" />
|
||||||
<workItem from="1768547023783" duration="11371000" />
|
<workItem from="1768547023783" duration="11371000" />
|
||||||
<workItem from="1768894030675" duration="28473000" />
|
<workItem from="1768894030675" duration="31119000" />
|
||||||
</task>
|
</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)">
|
<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" />
|
<option name="closed" value="true" />
|
||||||
@@ -390,7 +384,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1769014602062</updated>
|
<updated>1769014602062</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="16" />
|
<task id="LOCAL-00016" summary="fix : migration apache vers nginx pour un déploiement plus simple">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1769019284586</created>
|
||||||
|
<option name="number" value="00016" />
|
||||||
|
<option name="presentableId" value="LOCAL-00016" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1769019284586</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="17" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -456,7 +458,8 @@
|
|||||||
<MESSAGE value="fix : correction de l'accès au swagger en mode dev qui n'était plus accessible" />
|
<MESSAGE value="fix : correction de l'accès au swagger en mode dev qui n'était plus accessible" />
|
||||||
<MESSAGE value="feat : ajout de la conf pour le déploiement en recette" />
|
<MESSAGE value="feat : ajout de la conf pour le déploiement en recette" />
|
||||||
<MESSAGE value="fix : fix de la conf pour le déploiement en recette" />
|
<MESSAGE value="fix : fix de la conf pour le déploiement en recette" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix : fix de la conf pour le déploiement en recette" />
|
<MESSAGE value="fix : migration apache vers nginx pour un déploiement plus simple" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="fix : migration apache vers nginx pour un déploiement plus simple" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
|||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
# Déploiement Ferme (recette)
|
||||||
|
|
||||||
|
## 1) Premier déploiement
|
||||||
|
|
||||||
|
### Pré-requis système (Ubuntu)
|
||||||
|
1. Mettre à jour la machine
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y software-properties-common ca-certificates curl gnupg unzip git nginx
|
||||||
|
```
|
||||||
|
2. Installer PHP 8.4 + FPM + extensions
|
||||||
|
```bash
|
||||||
|
sudo add-apt-repository -y ppa:ondrej/php
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y \
|
||||||
|
php8.4 php8.4-fpm php8.4-cli php8.4-common \
|
||||||
|
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)
|
||||||
|
```bash
|
||||||
|
sudo apt install -y postgresql postgresql-contrib
|
||||||
|
sudo -u postgres psql
|
||||||
|
```
|
||||||
|
Dans psql :
|
||||||
|
```sql
|
||||||
|
CREATE USER ferme_user WITH PASSWORD 'motdepassefort';
|
||||||
|
CREATE DATABASE ferme OWNER ferme_user;
|
||||||
|
\q
|
||||||
|
```
|
||||||
|
|
||||||
|
### Déploiement applicatif
|
||||||
|
1. Cloner le repo
|
||||||
|
```bash
|
||||||
|
sudo mkdir -p /var/www
|
||||||
|
sudo git clone <repo> /var/www/ferme
|
||||||
|
sudo chown -R malio:malio /var/www/ferme
|
||||||
|
```
|
||||||
|
2. Variables d’environnement
|
||||||
|
- Backend : `/var/www/ferme/.env.local`
|
||||||
|
- `APP_ENV=prod`
|
||||||
|
- `APP_DEBUG=0`
|
||||||
|
- `APP_SECRET=...`
|
||||||
|
- `DATABASE_URL=postgresql://ferme_user:motdepassefort@127.0.0.1:5432/ferme?serverVersion=16&charset=utf8`
|
||||||
|
- `JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem`
|
||||||
|
- `JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem`
|
||||||
|
- `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)
|
||||||
|
```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 l’app
|
||||||
|
```bash
|
||||||
|
cd /var/www/ferme
|
||||||
|
./scripts/deploy-native.sh
|
||||||
|
```
|
||||||
|
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)
|
||||||
|
|
||||||
|
1. Mettre à jour le code + build + migrations
|
||||||
|
```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
|
||||||
|
```
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name ferme.malio-dev.fr;
|
||||||
|
|
||||||
|
root /var/www/ferme/frontend/.output/public;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location ^~ /api/ {
|
||||||
|
root /var/www/ferme/public;
|
||||||
|
try_files $uri /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /bundles/ {
|
||||||
|
root /var/www/ferme/public;
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /api/login_check {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/ferme/public/index.php;
|
||||||
|
fastcgi_param DOCUMENT_ROOT /var/www/ferme/public;
|
||||||
|
fastcgi_param SCRIPT_NAME /index.php;
|
||||||
|
fastcgi_param PATH_INFO /login_check;
|
||||||
|
fastcgi_param REQUEST_URI /login_check;
|
||||||
|
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/index\.php(/|$) {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/ferme/public/index.php;
|
||||||
|
fastcgi_param DOCUMENT_ROOT /var/www/ferme/public;
|
||||||
|
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user