Projet

Général

Profil

EnvoleBonnesPratiques » Historique » Version 26

Gérald Schwartzmann, 27/04/2010 17:34

1 21 Gérald Schwartzmann
h2. !http://dev-eole.ac-dijon.fr/attachments/download/9/puce.png! Environnement Libre Ouvert Evolutif - Envole
2 21 Gérald Schwartzmann
{{include(eole:menu)}}
3 1 Gérald Schwartzmann
4 21 Gérald Schwartzmann
h1. [[Développement|Développement]]
5 20 Gérald Schwartzmann
6 1 Gérald Schwartzmann
h1. Les Bonnes Pratiques
7 22 Gérald Schwartzmann
8 22 Gérald Schwartzmann
{{include(ModeleEbauche)}}
9 6 Gérald Schwartzmann
10 7 Gérald Schwartzmann
h2. Documentations, sources et articles wiki
11 8 Gérald Schwartzmann
12 12 Gérald Schwartzmann
Voici "Les bonnes pratiques sur le nommage des applications EOLE":http://eole.orion.education.fr/wiki/index.php/DocumentationDokiel
13 6 Gérald Schwartzmann
14 9 Gérald Schwartzmann
h2. Git
15 6 Gérald Schwartzmann
16 7 Gérald Schwartzmann
h3. Placement
17 1 Gérald Schwartzmann
18 11 Gérald Schwartzmann
Les applications de Envole sont des sous-projets de "Envole":http://dev-eole.ac-dijon.fr/projects/envole .
19 13 Gérald Schwartzmann
Dans le dépôt ils apparaissent les un à côté des autres (à plat).
20 1 Gérald Schwartzmann
21 13 Gérald Schwartzmann
h3. Les Bonnes Pratiques
22 25 Gérald Schwartzmann
23 13 Gérald Schwartzmann
"Les Bonnes Pratiques":http://dev-eole.ac-dijon.fr/projects/eole-interne/wiki/GitBonnesPratiques
24 13 Gérald Schwartzmann
25 1 Gérald Schwartzmann
h3. Nommage
26 8 Gérald Schwartzmann
27 14 Gérald Schwartzmann
Le nom des sous-projets doivent être en minuscule
28 6 Gérald Schwartzmann
29 13 Gérald Schwartzmann
Exemple dans la liste des sous-projets : http://dev-eole.ac-dijon.fr/projects/envole
30 6 Gérald Schwartzmann
31 14 Gérald Schwartzmann
h3. Structure du Master
32 6 Gérald Schwartzmann
33 14 Gérald Schwartzmann
Puisque votre développement n'est pas la branche d'un projet déjà existant on réalise un master.<br />
34 14 Gérald Schwartzmann
Pour cela il faut créer selon les besoins de votre application les fichiers et répertoires suivant :
35 6 Gérald Schwartzmann
 - Makefile
36 6 Gérald Schwartzmann
 - debian/
37 6 Gérald Schwartzmann
 - dicos/
38 6 Gérald Schwartzmann
 - mysql/
39 6 Gérald Schwartzmann
 - patch/
40 6 Gérald Schwartzmann
 - sso/
41 6 Gérald Schwartzmann
 - source_de_votre_appli_num_de_version/
42 6 Gérald Schwartzmann
 - tmpls/
43 6 Gérald Schwartzmann
 - etc/
44 6 Gérald Schwartzmann
45 14 Gérald Schwartzmann
Exemple : http://dev-eole.ac-dijon.fr/projects/dokuwiki/repository
46 6 Gérald Schwartzmann
47 7 Gérald Schwartzmann
h2. Les fichiers templates
48 8 Gérald Schwartzmann
49 6 Gérald Schwartzmann
Le nom d'un fichier templétisé ne doit pas porté le même nom qu'un autre pour cela il faut préfixer le nom du fichier avec le nom de l'application.
50 6 Gérald Schwartzmann
51 6 Gérald Schwartzmann
Exemple du fichier config.php qui est présent dans une bonne partie des applications :
52 6 Gérald Schwartzmann
53 6 Gérald Schwartzmann
taskfreak_config.php
54 6 Gérald Schwartzmann
55 7 Gérald Schwartzmann
h2. Dico
56 8 Gérald Schwartzmann
57 7 Gérald Schwartzmann
h3. Nommage
58 8 Gérald Schwartzmann
59 6 Gérald Schwartzmann
Les applications du socle
60 6 Gérald Schwartzmann
<pre>5x_nom_de_l_application.xml</pre>
61 6 Gérald Schwartzmann
Les applications supplémentaires au socle
62 6 Gérald Schwartzmann
<pre>6x_nom_de_l_application.xml</pre>
63 6 Gérald Schwartzmann
x étant supérieur à 0
64 6 Gérald Schwartzmann
65 7 Gérald Schwartzmann
h3. construction du fichier
66 8 Gérald Schwartzmann
67 15 Gérald Schwartzmann
{{include(ModeleFixme)}}
68 6 Gérald Schwartzmann
69 7 Gérald Schwartzmann
h2. Paquetage
70 8 Gérald Schwartzmann
71 24 Gérald Schwartzmann
h3. nommage du paquet
72 25 Gérald Schwartzmann
73 6 Gérald Schwartzmann
eole-nom_de_l_application
74 24 Gérald Schwartzmann
75 24 Gérald Schwartzmann
h3. fichiers postinst postrm
76 25 Gérald Schwartzmann
77 24 Gérald Schwartzmann
dans les fichiers postinst et postrm il faut utiliser des chemins absolus pour les commandes :
78 26 Gérald Schwartzmann
<pre>/bin/cp</pre>
79 6 Gérald Schwartzmann
80 7 Gérald Schwartzmann
h2. Apache
81 1 Gérald Schwartzmann
82 15 Gérald Schwartzmann
h3. nommage du fichier de conf dans sites-enabled
83 15 Gérald Schwartzmann
84 6 Gérald Schwartzmann
Un fichier de conf apache par application :
85 1 Gérald Schwartzmann
<pre>apache-nom_de_l_application.conf</pre>
86 15 Gérald Schwartzmann
87 15 Gérald Schwartzmann
h3. contenu du fichier de conf dans sites-enabled
88 15 Gérald Schwartzmann
89 19 Gérald Schwartzmann
Le chemin de l'application doit être son nom
90 19 Gérald Schwartzmann
91 16 Gérald Schwartzmann
Si un projet ne contient pas de .htaccess il faut ajouter la directive *AllowOverride None*.
92 16 Gérald Schwartzmann
Celle-ci permet de diminuer le délai d'attente en lui évitant de partir à la recherche de fichier .htaccess dans chaque répertoire qu'il visite.
93 16 Gérald Schwartzmann
94 18 Gérald Schwartzmann
Date d'expiration du cache proxy ou navigateur.
95 18 Gérald Schwartzmann
Régler correctement et finement le cache des clients permet d'éviter un grand nombre de requête.
96 18 Gérald Schwartzmann
En prévision de l'activation du *mod_expires* sur le serveur Apache, on peut ajouter la directive *ExpiresActive On* suivit de directive *ExpiresByType type "durée de vie dans le cache"*
97 18 Gérald Schwartzmann
98 18 Gérald Schwartzmann
<pre>
99 18 Gérald Schwartzmann
<IfModule mod_expires.c>
100 18 Gérald Schwartzmann
                ExpiresActive On
101 18 Gérald Schwartzmann
                ExpiresByType text/html "access plus 1 day"
102 18 Gérald Schwartzmann
</IfModule>
103 18 Gérald Schwartzmann
</pre>
104 18 Gérald Schwartzmann
105 18 Gérald Schwartzmann
Exemple complet d'un fichier de configuration d'une application :
106 16 Gérald Schwartzmann
107 16 Gérald Schwartzmann
<pre>
108 16 Gérald Schwartzmann
# Envole Infos
109 16 Gérald Schwartzmann
# Equipe EOLE
110 16 Gérald Schwartzmann
Alias /envole-infos /var/www/html/envole-infos
111 16 Gérald Schwartzmann
<Directory "/var/www/html/envole-infos">
112 17 Gérald Schwartzmann
        AllowOverride None
113 16 Gérald Schwartzmann
        AddDefaultCharset UTF-8
114 16 Gérald Schwartzmann
        DirectoryIndex index.php
115 16 Gérald Schwartzmann
        Order Allow,Deny
116 16 Gérald Schwartzmann
        Allow from All
117 16 Gérald Schwartzmann
        <IfModule mod_expires.c>
118 16 Gérald Schwartzmann
                ExpiresActive On
119 16 Gérald Schwartzmann
                ExpiresByType text/html "access plus 1 day"
120 16 Gérald Schwartzmann
                ExpiresByType text/xml "access plus 1 day"
121 16 Gérald Schwartzmann
                ExpiresByType image/gif "access plus 1 week"
122 16 Gérald Schwartzmann
                ExpiresByType image/jpg "access plus 1 week"
123 16 Gérald Schwartzmann
                ExpiresByType image/png "access plus 1 week"
124 16 Gérald Schwartzmann
                ExpiresByType video/quicktime "access plus 1 month"
125 16 Gérald Schwartzmann
                ExpiresByType audio/mpeg "access plus 1 month"
126 16 Gérald Schwartzmann
                ExpiresByType application/pdf "access plus 1 month"
127 16 Gérald Schwartzmann
                ExpiresByType application/ps "access plus 1 month"
128 16 Gérald Schwartzmann
                ExpiresByType text/css "access plus 1 day"
129 16 Gérald Schwartzmann
                ExpiresByType application/x-shockwave-flash "access plus 1 day"
130 16 Gérald Schwartzmann
                ExpiresByType text/js "access plus 1 week"
131 16 Gérald Schwartzmann
                ExpiresByType text/javascript "access plus 1 week"
132 16 Gérald Schwartzmann
                ExpiresByType application/x-javascript "access plus 1 week"
133 16 Gérald Schwartzmann
                ExpiresByType image/x-icon "access plus 1 day"
134 16 Gérald Schwartzmann
        </IfModule>
135 16 Gérald Schwartzmann
</Directory>
136 16 Gérald Schwartzmann
</pre>
137 15 Gérald Schwartzmann
138 15 Gérald Schwartzmann
h3. les droits dans /var/www/html/
139 6 Gérald Schwartzmann
140 23 Gaston TJEBBES
Application des droits minimaux sur les répertoires:
141 1 Gérald Schwartzmann
142 23 Gaston TJEBBES
<pre>
143 23 Gaston TJEBBES
# Définition du propriétaire du répertoire
144 23 Gaston TJEBBES
/bin/chown -R root:www-data /var/www/html/votre_appli<br />
145 23 Gaston TJEBBES
# Définition des droits minimaux pour les répertoires (ont besoin d'être exécutables)
146 23 Gaston TJEBBES
/bin/chmod -R 750 /var/www/html/votre_appli<br />
147 23 Gaston TJEBBES
# Définition des droits minimaux pour les fichiers
148 23 Gaston TJEBBES
/usr/bin/find /var/www/html/votre_appli -type f -exec /bin/chmod ugo-x {} \;
149 23 Gaston TJEBBES
</pre>
150 23 Gaston TJEBBES
151 23 Gaston TJEBBES
Pour des raisons de sécurité seuls les fichiers nécessitant d'être modifiés par l'application sont éditables par l'utilisateur avec lequel est lancé apache à savoir www-data<br />
152 23 Gaston TJEBBES
<pre>
153 23 Gaston TJEBBES
/bin/chmod 770 /var/www/html/votre_appli/datas
154 23 Gaston TJEBBES
/bin/chmod 660 /var/www/html/votre_appli/datas/*.*
155 23 Gaston TJEBBES
</pre>
156 6 Gérald Schwartzmann
157 7 Gérald Schwartzmann
h2. Base de données
158 8 Gérald Schwartzmann
159 6 Gérald Schwartzmann
<pre>scribe-nom_de_l_application.sql</pre>
160 6 Gérald Schwartzmann
161 6 Gérald Schwartzmann
Si la bdd nécessite une templétisation il est préférable de découper la bdd en deux fichiers MySql.<br />
162 6 Gérald Schwartzmann
L'un avec la partie à templétiser et l'autre avec le reste.<br />
163 6 Gérald Schwartzmann
Cette découpe fait gagner un temps considérable lors du reconfigure.<br />
164 6 Gérald Schwartzmann
165 7 Gérald Schwartzmann
h2. {{include(ModeleFixme)}}
166 6 Gérald Schwartzmann
167 6 Gérald Schwartzmann
Où stocker les données des applications d'Envole ?<br />
168 6 Gérald Schwartzmann
exemple Moodle<br />
169 6 Gérald Schwartzmann
les données sont pour le moment stockées dans /var/www/<br />
170 6 Gérald Schwartzmann
serait-ce mieux dans /home/<br />
171 6 Gérald Schwartzmann
sauvegarde de Bacule ?