cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/broadcast.js +6 -3
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/cloudcms-server.iml +1 -0
- package/d1/index.js +629 -0
- package/d1/index.js.works +203 -0
- package/d1/package.json +86 -0
- package/d1/package.json.works +14 -0
- package/duster/helpers/sample/nyt.js +2 -1
- package/framework/controllers.js +4 -4
- package/index.js +21 -14
- package/insight/insight.js +1 -1
- package/launchpad/index.js +203 -11
- package/launchpad/launchers/cluster.js +103 -110
- package/launchpad/launchers/redis.js +70 -0
- package/launchpad/launchers/single.js +36 -22
- package/locks/locks.js +63 -9
- package/locks/providers/cluster.js +3 -1
- package/locks/providers/memory.js +10 -7
- package/locks/providers/redis.js +62 -82
- package/middleware/admin/admin.js +3 -3
- package/middleware/authentication/adapters/session.js +11 -8
- package/middleware/authentication/authentication.js +28 -16
- package/middleware/authentication/authenticators/default.js +5 -2
- package/middleware/authentication/authenticators/session.js +5 -2
- package/middleware/authentication/providers/saml.js +2 -2
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +63 -38
- package/middleware/awareness/plugins/api_event.js +105 -0
- package/middleware/awareness/plugins/editorial.js +8 -7
- package/middleware/awareness/plugins/resources.js +13 -5
- package/middleware/awareness/providers/abstract-async.js +107 -84
- package/middleware/awareness/providers/abstract.js +1 -1
- package/middleware/awareness/providers/memory.js +0 -14
- package/middleware/awareness/providers/redis.js +186 -279
- package/middleware/cache/cache.js +4 -2
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cache/providers/shared-memory.js +3 -3
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/driver-config/driver-config.js +0 -6
- package/middleware/form/form.js +3 -3
- package/middleware/modules/modules.js +17 -8
- package/middleware/perf/perf.js +3 -2
- package/middleware/proxy/proxy.js +8 -21
- package/middleware/stores/store.js +0 -1
- package/middleware/stores/stores.js +4 -4
- package/middleware/virtual-config/virtual-config.js +11 -11
- package/middleware/virtual-files/virtual-files.js +0 -3
- package/middleware/wcm/wcm.js +4 -4
- package/middleware/welcome/welcome.js +0 -3
- package/notifications/notifications.js +74 -12
- package/notifications/providers/kafka.js +182 -0
- package/notifications/providers/stomp.js +4 -0
- package/package.json +33 -30
- package/server/index.js +508 -416
- package/server/standalone.js +9 -0
- package/temp/clusterlock/index.js +3 -3
- package/temp/clusterlock/package.json +1 -1
- package/temp/passport-saml/LICENSE +23 -0
- package/temp/passport-saml/README.md +406 -0
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/index.js +6 -0
- package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
- package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
- package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
- package/temp/passport-saml/lib/node-saml/types.js +8 -0
- package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/utility.js +19 -0
- package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
- package/temp/passport-saml/lib/node-saml/xml.js +140 -0
- package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
- package/temp/passport-saml/lib/passport-saml/index.js +11 -0
- package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
- package/temp/passport-saml/lib/passport-saml/types.js +11 -0
- package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
- package/temp/passport-saml/package.json +96 -0
- package/util/auth.js +16 -10
- package/util/cloudcms.js +108 -120
- package/util/proxy-factory.js +103 -237
- package/util/redis.js +113 -0
- package/util/renditions.js +12 -6
- package/util/request.js +12 -6
- package/util/util.js +16 -2
- package/.last_command +0 -7
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/temp/memored/.jshintrc +0 -4
- package/temp/memored/README.md +0 -240
- package/temp/memored/demo/demo1.js +0 -37
- package/temp/memored/demo/demo2.js +0 -32
- package/temp/memored/gulpfile.js +0 -8
- package/temp/memored/index.js +0 -343
- package/temp/memored/package.json +0 -54
- package/temp/memored/spec/memored.spec.js +0 -265
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var redis = require("redis");
|
|
4
|
-
var logFactory = require("../../../util/logger");
|
|
1
|
+
var redisClientFactory = require("../../../clients/redis");
|
|
2
|
+
const redisHelper = require("../../../util/redis");
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Redis distributed cache.
|
|
@@ -11,123 +9,163 @@ var logFactory = require("../../../util/logger");
|
|
|
11
9
|
exports = module.exports = function(cacheConfig)
|
|
12
10
|
{
|
|
13
11
|
var client = null;
|
|
14
|
-
|
|
15
|
-
var logger =
|
|
16
|
-
logger.setLevel("error");
|
|
17
|
-
|
|
18
|
-
// allow for global redis default
|
|
19
|
-
// allow for redis broadcast specific
|
|
20
|
-
// otherwise default to error
|
|
21
|
-
if (typeof(process.env.CLOUDCMS_REDIS_DEBUG_LEVEL) !== "undefined") {
|
|
22
|
-
logger.setLevel(("" + process.env.CLOUDCMS_REDIS_DEBUG_LEVEL).toLowerCase(), true);
|
|
23
|
-
}
|
|
24
|
-
else if (typeof(process.env.CLOUDCMS_CACHE_REDIS_DEBUG_LEVEL) !== "undefined") {
|
|
25
|
-
logger.setLevel(("" + process.env.CLOUDCMS_CACHE_REDIS_DEBUG_LEVEL).toLowerCase(), true);
|
|
26
|
-
}
|
|
12
|
+
|
|
13
|
+
var logger = redisHelper.redisLogger("REDIS_CACHE", "CLOUDCMS_CACHE_", "error")
|
|
27
14
|
|
|
28
15
|
var r = {};
|
|
29
16
|
|
|
30
17
|
r.init = function(callback)
|
|
31
18
|
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (typeof(redisEndpoint) === "undefined" || !redisEndpoint)
|
|
44
|
-
{
|
|
45
|
-
redisEndpoint = process.env.CLOUDCMS_CACHE_REDIS_ENDPOINT;
|
|
46
|
-
}
|
|
47
|
-
if (typeof(redisEndpoint) === "undefined" || !redisEndpoint)
|
|
48
|
-
{
|
|
49
|
-
redisEndpoint = process.env.CLOUDCMS_REDIS_ENDPOINT;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var redisOptions = {};
|
|
53
|
-
|
|
54
|
-
//redis.debug_mode = true;
|
|
55
|
-
|
|
56
|
-
client = redis.createClient(redisPort, redisEndpoint, redisOptions);
|
|
57
|
-
|
|
58
|
-
callback();
|
|
19
|
+
redisClientFactory.create(cacheConfig, function(err, _client) {
|
|
20
|
+
|
|
21
|
+
if (err) {
|
|
22
|
+
return callback(err);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
client = _client;
|
|
26
|
+
|
|
27
|
+
return callback();
|
|
28
|
+
|
|
29
|
+
});
|
|
59
30
|
};
|
|
60
31
|
|
|
61
32
|
r.write = function(key, value, seconds, callback)
|
|
62
33
|
{
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
logger.info('write, key = ' + key + ', value = ' + value + ', seconds = ' + seconds + ', typeofval: ' + typeof(value));
|
|
35
|
+
(async function() {
|
|
36
|
+
|
|
37
|
+
var reply = null;
|
|
38
|
+
var err = null;
|
|
39
|
+
|
|
40
|
+
try
|
|
41
|
+
{
|
|
42
|
+
var config = {};
|
|
43
|
+
if (seconds >= 0) {
|
|
44
|
+
config["EX"] = seconds;
|
|
68
45
|
}
|
|
46
|
+
|
|
47
|
+
reply = await client.set(key, JSON.stringify(value), config);
|
|
48
|
+
}
|
|
49
|
+
catch (e)
|
|
50
|
+
{
|
|
51
|
+
err = e;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (reply) {
|
|
69
55
|
logger.info("write -> reply = " + reply);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
logger.info("write.ex -> reply = " + reply);
|
|
80
|
-
callback(err, reply);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (err) {
|
|
59
|
+
logger.error("write error. key: " + key + " value: " + JSON.stringify(value) + ". error:" + err + ", value type: " + typeof(value));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
callback(err, reply);
|
|
63
|
+
|
|
64
|
+
})();
|
|
83
65
|
};
|
|
84
66
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
r.read = function(key, callback)
|
|
68
|
+
{
|
|
69
|
+
logger.info('read, key = ' + key);
|
|
88
70
|
|
|
71
|
+
(async function() {
|
|
72
|
+
|
|
73
|
+
var err = null;
|
|
74
|
+
var reply = null;
|
|
75
|
+
|
|
76
|
+
try
|
|
77
|
+
{
|
|
78
|
+
reply = await client.get(key);
|
|
79
|
+
}
|
|
80
|
+
catch (e)
|
|
81
|
+
{
|
|
82
|
+
err = e;
|
|
83
|
+
}
|
|
84
|
+
|
|
89
85
|
if (err) {
|
|
90
|
-
logger.error("read error. key: " + key + ". error:" + err);
|
|
86
|
+
logger.error("read error. key: " + key + ". error: " + err);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (reply) {
|
|
90
|
+
logger.info("read. key: " + key + " -> reply = " + reply);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
|
|
94
93
|
var result = null;
|
|
95
|
-
|
|
94
|
+
try
|
|
96
95
|
{
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
result = JSON.parse(reply);
|
|
97
|
+
}
|
|
99
98
|
catch (ex)
|
|
100
99
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
result = null;
|
|
101
|
+
err = ex;
|
|
102
|
+
|
|
103
|
+
if (err)
|
|
104
|
+
{
|
|
104
105
|
logger.error("error parsing reply. key: " + key + ". error:" + err);
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
}
|
|
108
|
+
|
|
108
109
|
callback(err, result);
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
})();
|
|
111
|
+
};
|
|
111
112
|
|
|
112
113
|
r.remove = function(key, callback)
|
|
113
114
|
{
|
|
114
|
-
logger.info(
|
|
115
|
-
|
|
115
|
+
logger.info('remove, key = ' + key);
|
|
116
|
+
|
|
117
|
+
(async function() {
|
|
118
|
+
|
|
119
|
+
var err = null;
|
|
120
|
+
|
|
121
|
+
try
|
|
122
|
+
{
|
|
123
|
+
await client.del(key);
|
|
124
|
+
logger.info("remove. key: " + key);
|
|
125
|
+
}
|
|
126
|
+
catch (e)
|
|
127
|
+
{
|
|
128
|
+
err = e;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (err) {
|
|
132
|
+
logger.error("del error. key: " + key + ". error: " + err);
|
|
133
|
+
}
|
|
134
|
+
|
|
116
135
|
callback(err);
|
|
117
|
-
});
|
|
136
|
+
})();
|
|
118
137
|
};
|
|
119
138
|
|
|
120
139
|
r.keys = function(prefix, callback)
|
|
121
|
-
|
|
122
|
-
logger.info('keys
|
|
123
|
-
|
|
140
|
+
{
|
|
141
|
+
logger.info('keys, prefix = ' + prefix);
|
|
142
|
+
|
|
143
|
+
(async function() {
|
|
144
|
+
|
|
145
|
+
var err = null;
|
|
146
|
+
var reply = null;
|
|
147
|
+
|
|
148
|
+
try
|
|
149
|
+
{
|
|
150
|
+
reply = await client.keys(prefix + '*');
|
|
151
|
+
}
|
|
152
|
+
catch (e)
|
|
153
|
+
{
|
|
154
|
+
err = e;
|
|
155
|
+
}
|
|
156
|
+
|
|
124
157
|
if (err) {
|
|
125
|
-
logger.error("error reading prefix: " + prefix + ". error:" + err);
|
|
158
|
+
logger.error("error reading keys for prefix: " + prefix + ". error:" + err);
|
|
126
159
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
160
|
+
|
|
161
|
+
if (reply) {
|
|
162
|
+
logger.info("keys -> reply = " + reply);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
callback(err, reply);
|
|
166
|
+
|
|
167
|
+
})();
|
|
168
|
+
};
|
|
131
169
|
|
|
132
170
|
return r;
|
|
133
171
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var path = require("path");
|
|
2
|
-
var memored = require(
|
|
1
|
+
//var path = require("path");
|
|
2
|
+
var memored = require("memored");
|
|
3
3
|
|
|
4
|
-
var cluster = require("cluster");
|
|
4
|
+
//var cluster = require("cluster");
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shared cluster memory using memored
|
|
@@ -436,8 +436,18 @@ exports = module.exports = function()
|
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
// only allow one "thread" at a time to load the branch
|
|
439
|
-
_LOCK(cacheKey, function(releaseLockFn) {
|
|
440
|
-
|
|
439
|
+
_LOCK(cacheKey, function(err, releaseLockFn) {
|
|
440
|
+
|
|
441
|
+
if (err) {
|
|
442
|
+
return callback(err);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
var branch = CACHED_BRANCHES[cacheKey];
|
|
446
|
+
if (branch) {
|
|
447
|
+
callback(null, Chain(branch));
|
|
448
|
+
return releaseLockFn();
|
|
449
|
+
}
|
|
450
|
+
|
|
441
451
|
var loadFn = function(finished) {
|
|
442
452
|
|
|
443
453
|
Chain(repository).trap(function(e) {
|
|
@@ -464,23 +474,21 @@ exports = module.exports = function()
|
|
|
464
474
|
|
|
465
475
|
if (err) {
|
|
466
476
|
|
|
477
|
+
callback(err);
|
|
478
|
+
|
|
467
479
|
// release the lock
|
|
468
|
-
releaseLockFn();
|
|
469
|
-
|
|
470
|
-
// do the callback
|
|
471
|
-
return callback(err);
|
|
480
|
+
return releaseLockFn();
|
|
472
481
|
}
|
|
473
482
|
|
|
474
483
|
// success!
|
|
475
484
|
|
|
476
485
|
// store in cache
|
|
477
486
|
CACHED_BRANCHES[cacheKey] = branch;
|
|
478
|
-
|
|
487
|
+
|
|
488
|
+
callback(null, branch);
|
|
489
|
+
|
|
479
490
|
// release the lock
|
|
480
|
-
releaseLockFn();
|
|
481
|
-
|
|
482
|
-
// do the callback
|
|
483
|
-
return callback(null, branch);
|
|
491
|
+
return releaseLockFn();
|
|
484
492
|
});
|
|
485
493
|
}
|
|
486
494
|
|
|
@@ -1439,11 +1447,10 @@ exports = module.exports = function()
|
|
|
1439
1447
|
|
|
1440
1448
|
// the range requested (for streaming)
|
|
1441
1449
|
//var range = req.headers["range"];
|
|
1442
|
-
|
|
1450
|
+
|
|
1443
1451
|
cloudcmsUtil.preview(contentStore, gitana, repositoryId, branchId, nodeId, nodePath, attachmentId, locale, previewId, size, mimetype, forceReload, function(err, filePath, cacheInfo, releaseLock) {
|
|
1444
1452
|
|
|
1445
|
-
if (err)
|
|
1446
|
-
{
|
|
1453
|
+
if (err) {
|
|
1447
1454
|
req.log("Error on preview node: " + err.message + ", err: " + JSON.stringify(err));
|
|
1448
1455
|
}
|
|
1449
1456
|
|
|
@@ -1475,8 +1482,7 @@ exports = module.exports = function()
|
|
|
1475
1482
|
// UZI: file deleted by invalidate before this gets called
|
|
1476
1483
|
contentStore.sendFile(res, filePath, cacheInfo, function(err) {
|
|
1477
1484
|
|
|
1478
|
-
if (err)
|
|
1479
|
-
{
|
|
1485
|
+
if (err) {
|
|
1480
1486
|
util.handleSendFileError(req, res, filePath, cacheInfo, req.log, err);
|
|
1481
1487
|
}
|
|
1482
1488
|
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
var path = require('path');
|
|
2
|
-
var http = require('http');
|
|
3
|
-
var request = require('request');
|
|
4
1
|
var util = require("../../util/util");
|
|
5
|
-
var Gitana = require("gitana");
|
|
6
|
-
|
|
7
|
-
var fs = require("fs");
|
|
8
2
|
|
|
9
3
|
/**
|
|
10
4
|
* Retrieves local driver configuration for hosts from Cloud CMS.
|
package/middleware/form/form.js
CHANGED
|
@@ -120,7 +120,7 @@ exports = module.exports = function()
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// post form to Cloud CMS using public method
|
|
123
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
|
|
123
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + url;
|
|
124
124
|
|
|
125
125
|
var headers = {};
|
|
126
126
|
headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
|
|
@@ -183,8 +183,8 @@ exports = module.exports = function()
|
|
|
183
183
|
req.branch(function(err, branch) {
|
|
184
184
|
|
|
185
185
|
var url = branch.getUri() + "/alpaca/datasource";
|
|
186
|
-
|
|
187
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + url;
|
|
186
|
+
|
|
187
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + url;
|
|
188
188
|
|
|
189
189
|
var headers = {};
|
|
190
190
|
headers["Authorization"] = req.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
|
|
@@ -55,14 +55,20 @@ exports = module.exports = function()
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
var source = moduleConfig.source40;
|
|
59
|
+
if (!source)
|
|
60
|
+
{
|
|
61
|
+
source = moduleConfig.source;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!source)
|
|
59
65
|
{
|
|
60
66
|
return callback({
|
|
61
67
|
"message": "Missing module config source settings"
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
70
|
|
|
65
|
-
var sourceType =
|
|
71
|
+
var sourceType = source.type;
|
|
66
72
|
if (!sourceType)
|
|
67
73
|
{
|
|
68
74
|
return callback({
|
|
@@ -70,7 +76,7 @@ exports = module.exports = function()
|
|
|
70
76
|
});
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
var sourceUrl =
|
|
79
|
+
var sourceUrl = source.uri;
|
|
74
80
|
if (!sourceUrl)
|
|
75
81
|
{
|
|
76
82
|
return callback({
|
|
@@ -78,12 +84,12 @@ exports = module.exports = function()
|
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
var sourcePath =
|
|
87
|
+
var sourcePath = source.path;
|
|
82
88
|
if (!sourcePath) {
|
|
83
89
|
sourcePath = "/";
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
var sourceBranch =
|
|
92
|
+
var sourceBranch = source.branch;
|
|
87
93
|
if (!sourceBranch) {
|
|
88
94
|
sourceBranch = "master";
|
|
89
95
|
}
|
|
@@ -101,15 +107,18 @@ exports = module.exports = function()
|
|
|
101
107
|
|
|
102
108
|
var targetStore = stores["modules"];
|
|
103
109
|
var targetOffsetPath = moduleId;
|
|
104
|
-
|
|
110
|
+
|
|
111
|
+
//logFn("From: " + sourceType + ", " + sourceUrl + ", " + sourcePath + ", " + sourceBranch);
|
|
112
|
+
//logFn("To: " + targetStore + ", path: " + targetOffsetPath);
|
|
113
|
+
|
|
105
114
|
util.gitCheckout(host, sourceType, sourceUrl, sourcePath, sourceBranch, targetStore, targetOffsetPath, false, logFn, function (err) {
|
|
106
115
|
|
|
107
|
-
|
|
116
|
+
logFn("After util.gitCheckout: " + JSON.stringify(err));
|
|
108
117
|
|
|
109
118
|
// invalidate any caching within the stores layer
|
|
110
119
|
storeService.invalidate(host);
|
|
111
120
|
|
|
112
|
-
|
|
121
|
+
logFn("After store.invalidate");
|
|
113
122
|
|
|
114
123
|
// broadcast: module_after_deploy
|
|
115
124
|
process.broadcast.publish("module_after_deploy", {
|
package/middleware/perf/perf.js
CHANGED
|
@@ -194,8 +194,9 @@ exports = module.exports = function()
|
|
|
194
194
|
car = filename;
|
|
195
195
|
}
|
|
196
196
|
var regex1 = new RegExp("-[0-9a-f]{32}$"); // md5
|
|
197
|
-
var regex2 = new RegExp("-[0-9]{13}$"); // timestamp
|
|
198
|
-
|
|
197
|
+
var regex2 = new RegExp("-[0-9]{13}$"); // timestamp?
|
|
198
|
+
var regex3 = new RegExp("-[0-9]{10}$"); // epoch millis
|
|
199
|
+
if (regex1.test(car) || regex2.test(car) || regex3.test(car))
|
|
199
200
|
{
|
|
200
201
|
var x = car.lastIndexOf("-");
|
|
201
202
|
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
-
// var fs = require('fs');
|
|
3
|
-
// var http = require('http');
|
|
4
|
-
// var https = require('https');
|
|
5
|
-
|
|
6
|
-
// var httpProxy = require('http-proxy');
|
|
7
|
-
|
|
8
|
-
// var oauth2 = require("../../util/oauth2")();
|
|
9
|
-
|
|
10
|
-
// var async = require("async");
|
|
11
2
|
|
|
12
3
|
var util = require("../../util/util");
|
|
13
|
-
// var auth = require("../../util/auth");
|
|
14
4
|
|
|
15
5
|
var proxyFactory = require("../../util/proxy-factory");
|
|
16
6
|
|
|
@@ -82,20 +72,17 @@ exports = module.exports = function()
|
|
|
82
72
|
contentStore.existsFile(filePath, function(exists) {
|
|
83
73
|
|
|
84
74
|
if (!exists) {
|
|
85
|
-
callback();
|
|
86
|
-
return;
|
|
75
|
+
return callback();
|
|
87
76
|
}
|
|
88
77
|
|
|
89
78
|
contentStore.fileStats(filePath, function(err, stats) {
|
|
90
79
|
|
|
91
80
|
if (err) {
|
|
92
|
-
callback();
|
|
93
|
-
return;
|
|
81
|
+
return callback();
|
|
94
82
|
}
|
|
95
83
|
|
|
96
|
-
if (stats.size
|
|
97
|
-
callback();
|
|
98
|
-
return;
|
|
84
|
+
if (stats.size === 0) {
|
|
85
|
+
return callback();
|
|
99
86
|
}
|
|
100
87
|
|
|
101
88
|
var handleGoodStream = function()
|
|
@@ -117,8 +104,7 @@ exports = module.exports = function()
|
|
|
117
104
|
// check cacheInfo for expireTime
|
|
118
105
|
contentStore.readFile(filePath + ".cache", function(err, cacheInfoText) {
|
|
119
106
|
|
|
120
|
-
if (err || !cacheInfoText)
|
|
121
|
-
{
|
|
107
|
+
if (err || !cacheInfoText) {
|
|
122
108
|
return handleBadStream();
|
|
123
109
|
}
|
|
124
110
|
|
|
@@ -215,7 +201,7 @@ exports = module.exports = function()
|
|
|
215
201
|
contentStore.writeFile(filePath + ".cache", JSON.stringify(cacheInfo), function() {
|
|
216
202
|
_end.call(res, data, encoding);
|
|
217
203
|
});
|
|
218
|
-
|
|
204
|
+
};
|
|
219
205
|
|
|
220
206
|
callback();
|
|
221
207
|
});
|
|
@@ -237,7 +223,7 @@ exports = module.exports = function()
|
|
|
237
223
|
{
|
|
238
224
|
req.url = "/";
|
|
239
225
|
}
|
|
240
|
-
|
|
226
|
+
|
|
241
227
|
// caching scenario
|
|
242
228
|
_handleCacheRead(req, function (err, readStream) {
|
|
243
229
|
|
|
@@ -257,6 +243,7 @@ exports = module.exports = function()
|
|
|
257
243
|
"message": "Missing baseURL from request bound gitana-config"
|
|
258
244
|
});
|
|
259
245
|
}
|
|
246
|
+
|
|
260
247
|
proxyFactory.acquireProxyHandler(proxyTarget, null, function(err, proxyHandler) {
|
|
261
248
|
if (err) {
|
|
262
249
|
return next(err);
|
|
@@ -46,7 +46,7 @@ exports = module.exports = function()
|
|
|
46
46
|
var engineId = storeConfiguration[storeType];
|
|
47
47
|
|
|
48
48
|
var engine = ENGINES[engineId];
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
var engineType = process.configuration.storeEngines[engineId].type;
|
|
51
51
|
var engineConfiguration = process.configuration.storeEngines[engineId].config;
|
|
52
52
|
|
|
@@ -176,7 +176,7 @@ exports = module.exports = function()
|
|
|
176
176
|
if (!stores) {
|
|
177
177
|
return afterCheck();
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
return process.cache.read("module-descriptors-" + host, function(err, moduleDescriptorsForHost) {
|
|
181
181
|
|
|
182
182
|
if (err) {
|
|
@@ -417,7 +417,7 @@ exports = module.exports = function()
|
|
|
417
417
|
var moduleStoreType = moduleDescriptors[i].store;
|
|
418
418
|
var modulePath = moduleDescriptors[i].path;
|
|
419
419
|
|
|
420
|
-
|
|
420
|
+
console.log("Config Store - Module Path: " + modulePath + ", type: " + moduleStoreType);
|
|
421
421
|
|
|
422
422
|
var storePath = path.join(modulePath, "config");
|
|
423
423
|
if (moduleStoreType === "modules")
|
|
@@ -520,7 +520,7 @@ exports = module.exports = function()
|
|
|
520
520
|
callback();
|
|
521
521
|
});
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
|
|
524
524
|
process.cache.read("module-descriptors-" + host, function(err, moduleDescriptors) {
|
|
525
525
|
|
|
526
526
|
moduleDescriptors = null;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
//var path = require('path');
|
|
2
|
-
//var http = require('http');
|
|
3
|
-
//var request = require('request');
|
|
4
1
|
var util = require("../../util/util");
|
|
5
2
|
|
|
6
3
|
/**
|
|
@@ -33,9 +30,12 @@ exports = module.exports = function()
|
|
|
33
30
|
// force key to "virtualdriver"
|
|
34
31
|
configuration.virtualDriver.key = VIRTUAL_DRIVER_CACHE_KEY;
|
|
35
32
|
|
|
33
|
+
//console.log("a1: " + JSON.stringify(configuration.virtualDriver, null, 2));
|
|
34
|
+
|
|
36
35
|
// either connect anew or re-use an existing connection to Cloud CMS for this application
|
|
37
36
|
Gitana.connect(configuration.virtualDriver, function(err) {
|
|
38
|
-
|
|
37
|
+
|
|
38
|
+
//console.log("a2:" + err);
|
|
39
39
|
if (err)
|
|
40
40
|
{
|
|
41
41
|
return callback(err);
|
|
@@ -83,7 +83,7 @@ exports = module.exports = function()
|
|
|
83
83
|
|
|
84
84
|
var URL = configuration.virtualDriver.baseURL;
|
|
85
85
|
if (!URL) {
|
|
86
|
-
URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
|
|
86
|
+
URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
|
|
87
87
|
}
|
|
88
88
|
URL += "/virtual/driver/config";
|
|
89
89
|
var requestConfig = {
|
|
@@ -143,10 +143,10 @@ exports = module.exports = function()
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
var _LOCK = function(lockKey, workFunction)
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
};
|
|
146
|
+
// var _LOCK = function(lockKey, workFunction)
|
|
147
|
+
// {
|
|
148
|
+
// process.locks.lock(lockKey, workFunction);
|
|
149
|
+
// };
|
|
150
150
|
|
|
151
151
|
var r = {};
|
|
152
152
|
|
|
@@ -213,7 +213,7 @@ exports = module.exports = function()
|
|
|
213
213
|
}
|
|
214
214
|
if (!gitanaJson.baseURL)
|
|
215
215
|
{
|
|
216
|
-
gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT));
|
|
216
|
+
gitanaJson.baseURL = util.cleanupURL(util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH));
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// mark as retrieved from virtual driver
|
|
@@ -336,7 +336,7 @@ exports = module.exports = function()
|
|
|
336
336
|
// defaults
|
|
337
337
|
if (!configuration.baseURL)
|
|
338
338
|
{
|
|
339
|
-
configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT);
|
|
339
|
+
configuration.baseURL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH);
|
|
340
340
|
}
|
|
341
341
|
if (!configuration.key) {
|
|
342
342
|
configuration.key = "virtual";
|