Initial commit: VPS tutorial complet (105 etapes)
This commit is contained in:
86
14-deploiement-symfony.md
Normal file
86
14-deploiement-symfony.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# 14. Deploiement Symfony
|
||||
|
||||
## Creer le site dans ISPConfig
|
||||
|
||||
1. DNS A `<PROJET>` -> `<IP>` (ou zone DNS dediee)
|
||||
2. Site web ISPConfig : `<PROJET_DOMAINE>` (SSL, LE, PHP-FPM, HTTPS redirect)
|
||||
3. Creer base de donnees dans ISPConfig
|
||||
|
||||
## Apache Directives pour Symfony
|
||||
|
||||
Dans l'onglet Options du site :
|
||||
|
||||
```apache
|
||||
DocumentRoot /var/www/<PROJET_DOMAINE>/web/public
|
||||
|
||||
<Directory /var/www/<PROJET_DOMAINE>/web/public>
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
FallbackResource /index.php
|
||||
</Directory>
|
||||
```
|
||||
|
||||
## Lien symbolique
|
||||
|
||||
```bash
|
||||
ln -s /var/www/clients/clientX/webY/web /var/www/<PROJET>
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
```bash
|
||||
# Identifier le proprietaire
|
||||
ls -la /var/www/<PROJET_DOMAINE>/ | head -5
|
||||
# Noter webX:clientY
|
||||
|
||||
# Ajouter votre user au groupe client
|
||||
usermod -a -G clientY <USER>
|
||||
|
||||
# Donner l'acces groupe
|
||||
chmod 750 /var/www/clients/clientX/webY/web
|
||||
|
||||
# ACL pour acces complet
|
||||
apt install acl
|
||||
setfacl -R -m u:<USER>:rwx /var/www/clients/clientX/webY/web
|
||||
setfacl -R -d -m u:<USER>:rwx /var/www/clients/clientX/webY/web
|
||||
```
|
||||
|
||||
> **Important :** Apres connexion SSH, executer `newgrp clientY` pour activer le groupe.
|
||||
|
||||
## Cloner le projet
|
||||
|
||||
```bash
|
||||
git clone git@github.com:<REPO>.git /tmp/<PROJET>
|
||||
cp -r /tmp/<PROJET>/. /var/www/clients/clientX/webY/web/
|
||||
chown -R webX:clientY /var/www/clients/clientX/webY/web/
|
||||
rm -rf /tmp/<PROJET>
|
||||
```
|
||||
|
||||
## Installer les dependances
|
||||
|
||||
```bash
|
||||
cd /var/www/<PROJET>
|
||||
composer install
|
||||
```
|
||||
|
||||
## Configuration .env
|
||||
|
||||
```bash
|
||||
# Base de donnees
|
||||
DATABASE_URL="mysql://<DB_USER>:<DB_PASS>@localhost:3306/<DB_NAME>"
|
||||
|
||||
# Mail (Postfix local)
|
||||
MAILER_DSN=smtp://127.0.0.1:25?auto_tls=false
|
||||
```
|
||||
|
||||
## Migrations
|
||||
|
||||
```bash
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
```
|
||||
|
||||
## Cache
|
||||
|
||||
```bash
|
||||
php bin/console cache:clear
|
||||
```
|
||||
Reference in New Issue
Block a user