Projet

Général

Profil

EnvoleBonnesPratiques » Historique » Version 29

Gérald Schwartzmann, 03/05/2010 11:43

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