Projet

Général

Profil

EnvoleBonnesPratiques » Historique » Version 24

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

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