Projet

Général

Profil

EnvoleBonnesPratiques » Historique » Version 30

Gérald Schwartzmann, 12/05/2010 12:53

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 1 Gérald Schwartzmann
h1. Les Bonnes Pratiques
5 22 Gérald Schwartzmann
6 22 Gérald Schwartzmann
{{include(ModeleEbauche)}}
7 6 Gérald Schwartzmann
8 7 Gérald Schwartzmann
h2. Documentations, sources et articles wiki
9 8 Gérald Schwartzmann
10 12 Gérald Schwartzmann
Voici "Les bonnes pratiques sur le nommage des applications EOLE":http://eole.orion.education.fr/wiki/index.php/DocumentationDokiel
11 6 Gérald Schwartzmann
12 9 Gérald Schwartzmann
h2. Git
13 6 Gérald Schwartzmann
14 7 Gérald Schwartzmann
h3. Placement
15 1 Gérald Schwartzmann
16 11 Gérald Schwartzmann
Les applications de Envole sont des sous-projets de "Envole":http://dev-eole.ac-dijon.fr/projects/envole .
17 13 Gérald Schwartzmann
Dans le dépôt ils apparaissent les un à côté des autres (à plat).
18 1 Gérald Schwartzmann
19 13 Gérald Schwartzmann
h3. Les Bonnes Pratiques
20 25 Gérald Schwartzmann
21 27 Gérald Schwartzmann
"Les Bonnes Pratiques de Git généralité et autres":http://dev-eole.ac-dijon.fr/projects/eole-interne/wiki/GitBonnesPratiques
22 1 Gérald Schwartzmann
23 27 Gérald Schwartzmann
Lorsque le master existe il contient les sources de la première version du paquet.
24 27 Gérald Schwartzmann
Créer une nouvelle branche en vue d'ajouter des développements
25 27 Gérald Schwartzmann
26 27 Gérald Schwartzmann
<pre>
27 27 Gérald Schwartzmann
$ git checkout -b devel
28 27 Gérald Schwartzmann
$ git push --all
29 27 Gérald Schwartzmann
</pre>
30 27 Gérald Schwartzmann
31 1 Gérald Schwartzmann
h3. Nommage
32 8 Gérald Schwartzmann
33 14 Gérald Schwartzmann
Le nom des sous-projets doivent être en minuscule
34 6 Gérald Schwartzmann
35 13 Gérald Schwartzmann
Exemple dans la liste des sous-projets : http://dev-eole.ac-dijon.fr/projects/envole
36 6 Gérald Schwartzmann
37 14 Gérald Schwartzmann
h3. Structure du Master
38 6 Gérald Schwartzmann
39 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 />
40 14 Gérald Schwartzmann
Pour cela il faut créer selon les besoins de votre application les fichiers et répertoires suivant :
41 6 Gérald Schwartzmann
 - Makefile
42 6 Gérald Schwartzmann
 - debian/
43 6 Gérald Schwartzmann
 - dicos/
44 6 Gérald Schwartzmann
 - mysql/
45 6 Gérald Schwartzmann
 - patch/
46 6 Gérald Schwartzmann
 - sso/
47 6 Gérald Schwartzmann
 - source_de_votre_appli_num_de_version/
48 6 Gérald Schwartzmann
 - tmpls/
49 6 Gérald Schwartzmann
 - etc/
50 6 Gérald Schwartzmann
51 14 Gérald Schwartzmann
Exemple : http://dev-eole.ac-dijon.fr/projects/dokuwiki/repository
52 6 Gérald Schwartzmann
53 7 Gérald Schwartzmann
h2. Les fichiers templates
54 8 Gérald Schwartzmann
55 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.
56 6 Gérald Schwartzmann
57 6 Gérald Schwartzmann
Exemple du fichier config.php qui est présent dans une bonne partie des applications :
58 6 Gérald Schwartzmann
59 6 Gérald Schwartzmann
taskfreak_config.php
60 6 Gérald Schwartzmann
61 7 Gérald Schwartzmann
h2. Dico
62 8 Gérald Schwartzmann
63 7 Gérald Schwartzmann
h3. Nommage
64 8 Gérald Schwartzmann
65 6 Gérald Schwartzmann
Les applications du socle
66 6 Gérald Schwartzmann
<pre>5x_nom_de_l_application.xml</pre>
67 6 Gérald Schwartzmann
Les applications supplémentaires au socle
68 6 Gérald Schwartzmann
<pre>6x_nom_de_l_application.xml</pre>
69 6 Gérald Schwartzmann
x étant supérieur à 0
70 6 Gérald Schwartzmann
71 7 Gérald Schwartzmann
h3. construction du fichier
72 8 Gérald Schwartzmann
73 15 Gérald Schwartzmann
{{include(ModeleFixme)}}
74 6 Gérald Schwartzmann
75 7 Gérald Schwartzmann
h2. Paquetage
76 8 Gérald Schwartzmann
77 24 Gérald Schwartzmann
h3. nommage du paquet
78 25 Gérald Schwartzmann
79 6 Gérald Schwartzmann
eole-nom_de_l_application
80 24 Gérald Schwartzmann
81 24 Gérald Schwartzmann
h3. fichiers postinst postrm
82 25 Gérald Schwartzmann
83 24 Gérald Schwartzmann
dans les fichiers postinst et postrm il faut utiliser des chemins absolus pour les commandes :
84 26 Gérald Schwartzmann
<pre>/bin/cp</pre>
85 6 Gérald Schwartzmann
86 7 Gérald Schwartzmann
h2. Apache
87 1 Gérald Schwartzmann
88 15 Gérald Schwartzmann
h3. nommage du fichier de conf dans sites-enabled
89 15 Gérald Schwartzmann
90 6 Gérald Schwartzmann
Un fichier de conf apache par application :
91 1 Gérald Schwartzmann
<pre>apache-nom_de_l_application.conf</pre>
92 15 Gérald Schwartzmann
93 15 Gérald Schwartzmann
h3. contenu du fichier de conf dans sites-enabled
94 15 Gérald Schwartzmann
95 19 Gérald Schwartzmann
Le chemin de l'application doit être son nom
96 19 Gérald Schwartzmann
97 16 Gérald Schwartzmann
Si un projet ne contient pas de .htaccess il faut ajouter la directive *AllowOverride None*.
98 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.
99 16 Gérald Schwartzmann
100 18 Gérald Schwartzmann
Date d'expiration du cache proxy ou navigateur.
101 18 Gérald Schwartzmann
Régler correctement et finement le cache des clients permet d'éviter un grand nombre de requête.
102 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"*
103 18 Gérald Schwartzmann
104 18 Gérald Schwartzmann
<pre>
105 18 Gérald Schwartzmann
<IfModule mod_expires.c>
106 18 Gérald Schwartzmann
                ExpiresActive On
107 18 Gérald Schwartzmann
                ExpiresByType text/html "access plus 1 day"
108 18 Gérald Schwartzmann
</IfModule>
109 18 Gérald Schwartzmann
</pre>
110 18 Gérald Schwartzmann
111 18 Gérald Schwartzmann
Exemple complet d'un fichier de configuration d'une application :
112 16 Gérald Schwartzmann
113 16 Gérald Schwartzmann
<pre>
114 16 Gérald Schwartzmann
# Envole Infos
115 16 Gérald Schwartzmann
# Equipe EOLE
116 16 Gérald Schwartzmann
Alias /envole-infos /var/www/html/envole-infos
117 16 Gérald Schwartzmann
<Directory "/var/www/html/envole-infos">
118 17 Gérald Schwartzmann
        AllowOverride None
119 16 Gérald Schwartzmann
        AddDefaultCharset UTF-8
120 16 Gérald Schwartzmann
        DirectoryIndex index.php
121 16 Gérald Schwartzmann
        Order Allow,Deny
122 16 Gérald Schwartzmann
        Allow from All
123 16 Gérald Schwartzmann
        <IfModule mod_expires.c>
124 16 Gérald Schwartzmann
                ExpiresActive On
125 16 Gérald Schwartzmann
                ExpiresByType text/html "access plus 1 day"
126 16 Gérald Schwartzmann
                ExpiresByType text/xml "access plus 1 day"
127 16 Gérald Schwartzmann
                ExpiresByType image/gif "access plus 1 week"
128 16 Gérald Schwartzmann
                ExpiresByType image/jpg "access plus 1 week"
129 16 Gérald Schwartzmann
                ExpiresByType image/png "access plus 1 week"
130 16 Gérald Schwartzmann
                ExpiresByType video/quicktime "access plus 1 month"
131 16 Gérald Schwartzmann
                ExpiresByType audio/mpeg "access plus 1 month"
132 16 Gérald Schwartzmann
                ExpiresByType application/pdf "access plus 1 month"
133 16 Gérald Schwartzmann
                ExpiresByType application/ps "access plus 1 month"
134 16 Gérald Schwartzmann
                ExpiresByType text/css "access plus 1 day"
135 16 Gérald Schwartzmann
                ExpiresByType application/x-shockwave-flash "access plus 1 day"
136 16 Gérald Schwartzmann
                ExpiresByType text/js "access plus 1 week"
137 16 Gérald Schwartzmann
                ExpiresByType text/javascript "access plus 1 week"
138 16 Gérald Schwartzmann
                ExpiresByType application/x-javascript "access plus 1 week"
139 16 Gérald Schwartzmann
                ExpiresByType image/x-icon "access plus 1 day"
140 16 Gérald Schwartzmann
        </IfModule>
141 16 Gérald Schwartzmann
</Directory>
142 16 Gérald Schwartzmann
</pre>
143 15 Gérald Schwartzmann
144 15 Gérald Schwartzmann
h3. les droits dans /var/www/html/
145 6 Gérald Schwartzmann
146 23 Gaston TJEBBES
Application des droits minimaux sur les répertoires:
147 1 Gérald Schwartzmann
148 23 Gaston TJEBBES
<pre>
149 23 Gaston TJEBBES
# Définition du propriétaire du répertoire
150 23 Gaston TJEBBES
/bin/chown -R root:www-data /var/www/html/votre_appli<br />
151 23 Gaston TJEBBES
# Définition des droits minimaux pour les répertoires (ont besoin d'être exécutables)
152 23 Gaston TJEBBES
/bin/chmod -R 750 /var/www/html/votre_appli<br />
153 23 Gaston TJEBBES
# Définition des droits minimaux pour les fichiers
154 23 Gaston TJEBBES
/usr/bin/find /var/www/html/votre_appli -type f -exec /bin/chmod ugo-x {} \;
155 23 Gaston TJEBBES
</pre>
156 23 Gaston TJEBBES
157 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 />
158 23 Gaston TJEBBES
<pre>
159 23 Gaston TJEBBES
/bin/chmod 770 /var/www/html/votre_appli/datas
160 23 Gaston TJEBBES
/bin/chmod 660 /var/www/html/votre_appli/datas/*.*
161 23 Gaston TJEBBES
</pre>
162 6 Gérald Schwartzmann
163 7 Gérald Schwartzmann
h2. Base de données
164 8 Gérald Schwartzmann
165 6 Gérald Schwartzmann
<pre>scribe-nom_de_l_application.sql</pre>
166 6 Gérald Schwartzmann
167 29 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.
168 29 Gérald Schwartzmann
L'un avec la partie à templétiser et l'autre avec le reste.
169 29 Gérald Schwartzmann
Cette découpe fait gagner un temps considérable lors du reconfigure.
170 7 Gérald Schwartzmann
171 28 Gérald Schwartzmann
h2. Stockage des données
172 6 Gérald Schwartzmann
173 29 Gérald Schwartzmann
Exemple de Dokuwiki
174 28 Gérald Schwartzmann
Pour être prise en charge par la sauvegarde Bacula les données des applications sont stockées dans :
175 28 Gérald Schwartzmann
<pre>
176 28 Gérald Schwartzmann
/home/www-data/var/www/html/nom_de_l'application
177 28 Gérald Schwartzmann
</pre>
178 27 Gérald Schwartzmann
179 27 Gérald Schwartzmann
h2. Commandes systèmes
180 27 Gérald Schwartzmann
181 27 Gérald Schwartzmann
==Création d'un patch==
182 27 Gérald Schwartzmann
<pre>diff -uNr toto/ toto.new/ > patch/toto.patch</pre>
183 27 Gérald Schwartzmann
184 27 Gérald Schwartzmann
==Application d'un patch==
185 27 Gérald Schwartzmann
<pre>patch -d /home/username/travail -p0 < toto.patch</pre>
186 27 Gérald Schwartzmann
187 27 Gérald Schwartzmann
==Changer le mot de passe PhpMyAdmin après un reconfigure==
188 27 Gérald Schwartzmann
<pre>mysql_pwd</pre>
189 27 Gérald Schwartzmann
190 29 Gérald Schwartzmann
Très pratique dans la conception de page web.
191 29 Gérald Schwartzmann
Console permettant le debbugage Javascript et Css:
192 27 Gérald Schwartzmann
[https://addons.mozilla.org/firefox/1843/ Firebug]