-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.txt
284 lines (212 loc) · 10.1 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
VMoodle block
#############
Implements a packaged virtualization control feature for large "Moodle Arrays"
Version 2015062000
=============================
This is a major architecture change. All main processes for VMoodling are
deferered to the local_vmoodle plugin.
Important requirements for VMoodling :
Version 2014071301 summary
=============================
Essentially redraws the internal class organization to cope qith
core Moodle class loading strategy.
version 2013020801 summary
=============================
- Fixes security issue when used with local/technicalsignals plugin
- Adds new remote plugin and equipement control
- MultiSQL commands fixed
- Several fixes on meta administration
- added config file generator (to help cli migrations)
- impove Command error and success report
- integrates mahara patches for MNET stability.
Summary of prerequisites
################################################################
0. Alter the <moodle>/lib/classes/component.php in lone 48 to let subplugins be used in blocks. (add 'block' to the list).
1. Installing vmoodle block in codebase
2. Installing the master moodle as usual browsing to Administration -> notifications
3. Installing the config.php hook to vconfig.php
4. Configuring the VMoodle common parameters
Post install procedure
----------------------------------------------------------------
5. Having names resolved for all the virtual moodles, through an explicit DNS binding OR a wildcard dns binding
(local resolutions on the webserver could make it possible also).
6. Setting up the master Moodle with relevant startup settigns (including MNET activation).
7. Snapshoting the master Moodle as template for virtual moodling (may be long)
8. Deploying vmoodle instances (may be long).
0 Old patches information (vs. 1.9)
0.1 Add possibility to blocks to handle subplugins and install them:
####################################################################
The vmoodle block construction is using subplugins, that are plugins
handled inside the vmoodle block scope.
for Moodle 2.2
--------------
Conversely to version 1.9, now subplugins are handled as "standard architecture feature" for
any plugin.
Since 2.4
---------
An architecture flexibility regression caused the subplugin system for blocks to fail. We
now need an extra patch to get it finding plugin subcomponent path properly again.
This patch will alter 2 plugin related functions in /lib/moodlelib.php
around L§8030
/**
* Lists all plugin types
* @param bool $fullpaths false means relative paths from dirroot
* @return array Array of strings - name=>location
*/
function get_plugin_types($fullpaths=true) {
global $CFG;
static $info = null;
static $fullinfo = null;
if (!$info) {
$info = array('qtype' => 'question/type',
'mod' => 'mod',
'auth' => 'auth',
'enrol' => 'enrol',
'message' => 'message/output',
'block' => 'blocks',
'filter' => 'filter',
'editor' => 'lib/editor',
'format' => 'course/format',
'profilefield' => 'user/profile/field',
'report' => 'report',
'coursereport' => 'course/report', // must be after system reports
'gradeexport' => 'grade/export',
'gradeimport' => 'grade/import',
'gradereport' => 'grade/report',
'gradingform' => 'grade/grading/form',
'mnetservice' => 'mnet/service',
'webservice' => 'webservice',
'repository' => 'repository',
'portfolio' => 'portfolio',
'qbehaviour' => 'question/behaviour',
'qformat' => 'question/format',
'plagiarism' => 'plagiarism',
'tool' => $CFG->admin.'/tool',
'cachestore' => 'cache/stores',
'cachelock' => 'cache/locks',
'theme' => 'theme', // this is a bit hacky, themes may be in $CFG->themedir too
);
// PATCH : Allow subplugins in blocks
$subpluginowners = array_merge(array_values(get_plugin_list('mod')),
array_values(get_plugin_list('editor')), array_values(get_plugin_list('block')));
// /PATCH
foreach ($subpluginowners as $ownerdir) {
around L§8106
/**
* Simplified version of get_list_of_plugins()
* @param string $plugintype type of plugin
* @return array name=>fulllocation pairs of plugins of given type
*/
function get_plugin_list($plugintype) {
global $CFG;
$ignored = array('CVS', '_vti_cnf', 'simpletest', 'db', 'yui', 'tests');
if ($plugintype == 'auth') {
// Historically we have had an auth plugin called 'db', so allow a special case.
$key = array_search('db', $ignored);
if ($key !== false) {
unset($ignored[$key]);
}
}
if ($plugintype === '') {
$plugintype = 'mod';
}
$fulldirs = array();
if ($plugintype === 'mod') {
// mod is an exception because we have to call this function from get_plugin_types()
$fulldirs[] = $CFG->dirroot.'/mod';
// PATCH : Allow subplugins in blocks
} else if ($plugintype === 'block') {
// block is an exception because we have to call this function from get_plugin_types()
$fulldirs[] = $CFG->dirroot . '/blocks';
// /PATCH
} else if ($plugintype === 'editor') {
Since moodle 2.6
----------------
Subplugin handling has been fluidified, with a very light change in a core library.
You'll just have to add the 'block' item in the subplugin capable plugins : lib/classes/component.php at line 48.
protected static $supportsubplugins = array('mod', 'editor', 'tool', 'local', 'block');
0.2 Add possibility for blocks to handle xmlrpc the same way Moodle modules do:
###############################################################################
Moodle 2.2 supports now generic Mnet service declaration in all plugins.
0.3 Patch for automated key rotations and consolidation in VMoodled networks:
#############################################################################
This patch allows a "well known trusted peer" to force asynchronous renewal of his
own key. It is still needed in Moodle 2.x versions
Location : mnet/lib.php
Changes : start of mnet_get_public_key() (including signature)
Patch content :
// PATCH : VMoodle Mnet automated key renewal -- adding force mode
function mnet_get_public_key($uri, $application=null, $force=0) {
global $CFG, $DB;
$mnet = get_mnet_environment();
// The key may be cached in the mnet_set_public_key function...
// check this first
// cache location of key must be bypassed when we need an automated renew.
if (!$force){
$key = mnet_set_public_key($uri);
if ($key != false) {
return $key;
}
}
// /PATCH
if (empty($application)) {
$application = $DB->get_record('mnet_application', array('name'=>'moodle'));
}
//! PATCH : Mnet automated key renewal
$rq = xmlrpc_encode_request('system/keyswap', array($CFG->wwwroot, $mnet->public_key, $application->name, $force), array("encoding" => "utf-8"));
// /PATCH
1. Master configuration changes : Installing the config.php hook to vconfig.php
###############################################################################
Main config.php file must be changed in order to plug virtualization hooking.
config must have an include call to vconfig.php virtualization configuration router.
You can obtain this file from the vconfig-dist.php template, making your own
vconfig.php file in blocks/vmoodle and then install the hook point in the standard
config.php of Moodle.
/// VMOODLE Hack
include $CFG->dirroot.'/blocks/vmoodle/vconfig.php';
/// /VMOODLE Hack
must be located BEFORE the call to lib/setup.php include and AFTER the static configuration.
Setting up Apache configuration for virtual Moodling
####################################################
Moodle virtualization assumes correct routing of each instance to the same RootDirectory inthe server.
A way to do this is using VirtualDirectory. Here comes a sample of Apache configuration that allows
this kind of generic binding.
<VirtualHost 127.0.0.1>
ServerAdmin [email protected]
ServerName %mastermoodlehost%
ServerAlias *.%mastermoodledomain%
VirtualDocumentRoot "D:/wwwroot/%moodledir%"
ErrorLog logs/vmoodle_common-error_log
CustomLog logs/vmoodle_common-access_log common
</VirtualHost>
For example :
the master moodle site could be :
%mastermoodlehost% = moodle.mydomain.edu
%moodledomain% = mydomain.edu
Using a wildcard DNS
####################
Defining wildcard DNS record say, to resolve *.mydomain.edu
avoids having to bind each virtual moodle within the DNS server
before using it.
Any undefined moodle will respond with an error message.
Cron handling by virtualization
###############################
VMoodle provides from now an automated handling of cron execution
for virtualized hosts. It will be not any more needed to manually
edit the cron tab for each new VMoodle instance. A single cron call
to vcron.php in the VMoodle block implementation will schedule and
rotate all VMoodle crons. The VMoodle cron should be run at sufficiant
frequence so each VMoodle has the expected turnover.
The ROUND_ROBIN mode runs a VMoodle per turn scannnig the VMoodle
definitions in order.
The LOWEST_POSSIBLE_GAP mode guarantees a nominal period for each
VMoodle by dispatching defined VMoodle on available cron ticks
(still in table order).
The VMoodle interface adds three additional attributes in the display
for VMoodles :
amount of passed crons
date of last cron
time elapsed (in secs) since the last cron was run
On large implementations running heavy moodle cron jobs or a lot
of VMoodles, it can be a good idea to make cron run on a spare little
server that can run the codebase and has access to the database pool.