SLA plugin: template integration with SLA Dashboard
[myslice.git] / README
1 Last update 18 MAR. 2015
2
3 Installation
4 =================================================================
5 Complete Guide: http://trac.myslice.info/wiki/Manifold/Install
6
7 Recommended OS
8 ===============
9 Debian GNU/Linux 7.5 (wheezy) x64
10
11 PYTHON DEPENDENCIES
12 =====================
13 sudo apt-get install python-pip or sudo easy_install pip==1.4.1
14 sudo apt-get install python-dev (for paramiko and pyOpenSSL)
15 sudo apt-get install libffi-dev (for pyOpenSSL)
16
17 $ pip install django=="1.5.2"
18 $ apt-get install python-django-south
19 $ pip install requests
20 $ pip install djangorestframework
21 $ pip install django-celery
22 $ pip install geopy
23 $ pip install paramiko
24 $ pip install pyparsing
25 $ pip install python-dateutil
26 $ pip instal pyOpenSSL
27
28 MYSLICE
29 =======
30 git clone ssh://yourlogin@git.onelab.eu/git/myslice.git
31 cd myslice
32 git checkout onelab
33
34 edit/create myslice/myslice.ini and enter the details of your manifold backend
35
36 $ ./manage.py syncdb
37 $ ./manage.py migrate
38 $ ./manage.py collectstatic
39
40 Run the development server
41 $ ./devel/server-loop.sh
42
43 MANIFOLD
44 ==========
45 git clone git://git.onelab.eu/manifold.git
46 cd manifold
47 git checkout devel
48 make && make install
49
50 SFA
51 ===
52 $ git clone -b geni-v3 git://git.onelab.eu/sfa.git
53 $ cd sfa 
54 $ git checkout geni-v3
55
56 $ make version
57 $ python ./setup.py install
58
59 =====================================================================
60
61 ## Whenever doing a git pull the following operations are recommended:
62
63 $ make static # will refresh static/ from all the pieces in the project
64 $ make templates # same, for templates
65 $ make redo-static # clears up (rm -rf) static/ first, then make static
66 $ make redo-templates # ditto for templates
67 $ make redo == make redo-static redo-templates
68
69
70 * run a local server:
71 $ ./manage.py runserver 0.0.0.0:8000
72 -- or -- my advice:
73 $ devel/server-loop.sh
74 when you just need to hit ^C yourself when your static files need to be refreshed - see below
75
76 * use it from your browser 
77 (See more notes on using the development server below)
78
79 * install dependencies 
80 $ pip install -r path/to/requirements/file.txt
81 Note. not quite sure what this is about, I could not spot this file..
82
83 =====APACHE Config=====
84 if are running apache please do:
85
86 $ chown www-data:www-data /var/myslice-f4f
87
88 otherwise you may get the following error:
89 "DatabaseError: unable to open database file"
90
91 ==================== Status
92
93 *** Authentication ***
94
95 Should be mostly fine
96 Not quite sure if/how the user gets proper notifications when
97 . his session has expired (i.e. his frontend is not logged into the backend any longer)
98 . his credentials have expired (i.e. the uploaded credentials, e.g. SFA delegated cred)
99   expired and she needs to run e.g. sfi myslice again
100
101 Hard-coded accounts (from a very early stage) are gone
102
103
104 *** Packaging ***
105
106 I've done a very rough attempt at packaging for rpm.
107 The logic seems about right but needs more work, in particular in terms of installing myslice.conf
108 in the httpd conf.d directory. 
109 It seems like our app won't work on f14 as is because Django is only 1.3.1 on f14
110 Plan is to target f18 but I lack a test machine.
111 Also of course I'll try to tackle debian/ubunti at some point.
112
113 There also is a working packaging for debian(s) and ubuntu(s) that we use 
114 on an almost daily basis to upgrade manifold.pl.sophia.inria.fr
115
116
117 ==================== 
118
119 Third party tools shipped:
120
121 * jquery
122 * datatables
123 * spin
124 * bootstrap
125
126 Others are added as we build the system when they become needed
127 Look in third-party/ for a more detailed list
128
129 As a rule of thumb, please try to keep in mind that these will need to
130 be upgraded over time I've tried to keep track of the version I picked
131 and to have an easy upgrade path (depending on the way the original
132 package is published)
133
134 ==================== Contents: 1st level subdirs
135
136 ========== code from git
137
138 * myslice/
139   this is the django 'project', where to look for
140   . settings.py
141   . urls.py
142
143 * manifold/
144   the code for dealing with queries, sending them to the backend, and offering the /manifold/proxy/ URL
145
146 * unfold/
147   the code for building / rendering plugins 
148
149 * plugins/
150   the actual code for plugins
151
152 * auth/ 
153   a django 'app' that deals with authentication; see especially
154   auth.backend.MyCustomBackend 
155   for how to use a separate authentication system, 
156   as well as settings.py for how to enable it
157
158 * ui/
159   provides building blocks for the UI, especially layouts (1 or 2 columns) as
160   well as the topmenu widget
161   + some global static files (css, js, images..)
162
163 * portal/
164   this is where the first implementation of myslice, with complete
165   user-management including registration, is taking place
166
167 * trash/
168   rough/preliminary scaffolding views are in here
169   as the name suggests this is temporary
170
171 * insert_above: 
172   a third-party django app for adding on-the-fly mentions to css or js files that need to go in the header
173
174 * third-party/
175    * third party javascript and css stuff (bootstrapfs, jquery, this kind of things)
176      see more about that below too
177
178 * devel:
179   no code in there, only various notes and other scripts useful for developers
180
181 ========== automatically generated 
182
183 * static/: (generated by collectstatic, see above, do not source-control)
184   $ manage.py [ --noinput ] collectstatic
185
186 * templates/
187
188 * myslice.sqlite3
189   this is where django stores its own stuff, as per settings.py
190
191 ==================== conventions for templates & static files
192 ==================== and NOTES on using the development server
193
194 . first off, running manage.py runserver is provided by django as a development convenience but
195   SHOULD NOT be used in production
196
197 . second, when you do use it for developement purposes, please be aware that:
198
199 .. the recommended layout for the various files and pieces (py, html, js and css) with django is e.g.
200       plugins/quickfilter/___init__.py, 
201       plugins/quickfilter/templates/quickfilter.html,
202       plugins/quickfilter/static/js/quickfilter.js 
203       plugins/quickfilter/static/css/quickfilter.css
204       plugins/quickfilter/static/img/some-image.png
205
206 .. the files actually used by the development server are the ones located in
207  static/
208  templates/
209
210 you can and should use the following make targets to refresh the
211 contents of these directories when running a developement server
212 $ make static                 to refresh static/
213 $ make redo-static            to clean up static/ and then refresh its contents
214 $ make templates              to refresh templates/
215 $ make redo-templates         to clean up templates/ and then refresh its contents
216 $ make redo                   equivalent to make redo-static redo-templates
217
218 .. as far as possible, please make sure to use third-party to store
219 any javascript tool or utility that your plugin depends upon
220
221 also we have the convention that all material in third-party should be
222 tagged with a version number, with a symlink pointing to the version
223 being used, like this
224
225 ~/git/myslice/third-party $ ls -ld spin*
226 lrwxr-xr-x  1 parmentelat  staff   10 Sep  6 17:55 spin -> spin-1.3.0
227 drwxr-xr-x  7 parmentelat  staff  238 Sep  6 17:55 spin-1.2.8
228 drwxr-xr-x  7 parmentelat  staff  238 Sep  6 17:55 spin-1.3.0
229
230 finally, as far as possible we keep track of the urls used to pull
231 stuff in the first place so that upgrades are easier
232
233 . third, be careful when importing third party material, to stay away from demo-oriented material
234
235 e.g. at some point we were using demo_page.css and demo_table.css from the datatables demo and sample pages
236 unfortunately these are not tailored for production use as they are setting styles on a very wide scope 
237 that breaks a lot of stuff, so please refrain from using these altogether
238
239
240 ======== update django database to reflect changes in existing models without any migration system (e.g., south) =========
241
242 # older version
243 $python manage.py reset <your_app>
244
245 #Django 1.5.1 or later
246 $python manage.py flush
247
248 This will update the database tables for your app, but will completely destroy any data that existed in those tables. 
249 If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field) 
250 you can simply dump the data before and reload it afterwards, like so:
251
252 $python manage.py syncdb
253 $python manage.py dumpdata <your_app> > temp_data.json
254 $python manage.py flush
255 $python manage.py loaddata temp_data.json
256
257 If your changes break your old schema this won't work - in which case tools like south or django evolution are great.
258
259
260 Add a new model to the DB
261
262 $python manage.py schemamigration <your_app> --auto
263 $python manage.py migrate
264
265 ======== update django database to reflect changes in existing models with migration system (e.g., south) =========
266
267 As south is already installed , you just have to do:
268
269 # ./manage.py schemamigration portal --initial
270 # sqlite3 /var/unfold/unfold.sqlite3
271         sqlite> DROP TABLE "portal_institution";
272         sqlite> DROP TABLE "portal_pendinguser";
273         sqlite> DROP TABLE "portal_pendingauthority";
274         sqlite> DROP TABLE "portal_pendingslice";
275         sqlite> .quit
276 # ./manage.py migrate portal