mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
fast deploy on aws
This commit is contained in:
parent
8f44c77b47
commit
ef8a46fec4
18
demo-shell-ng2/.ebextensions/deploy_npm.config
Normal file
18
demo-shell-ng2/.ebextensions/deploy_npm.config
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
files:
|
||||||
|
"/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh" :
|
||||||
|
mode: "000775"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
function error_exit
|
||||||
|
{
|
||||||
|
eventHelper.py --msg "$1" --severity ERROR
|
||||||
|
exit $2
|
||||||
|
}
|
||||||
|
|
||||||
|
export HOME=/home/ec2-user
|
||||||
|
echo "export home"
|
||||||
|
|
||||||
|
sudo curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
|
||||||
|
sudo yum install -y nodejs
|
77
demo-shell-ng2/app.js
Normal file
77
demo-shell-ng2/app.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
var port = process.env.PORT || 3000,
|
||||||
|
http = require('http'),
|
||||||
|
fs = require('fs'),
|
||||||
|
url = require('url'),
|
||||||
|
mime = require('mime'),
|
||||||
|
html = fs.readFileSync('index.html');
|
||||||
|
|
||||||
|
var log = function(entry) {
|
||||||
|
fs.appendFileSync('/tmp/sample-app.log', new Date().toISOString() + ' - ' + entry + '\n');
|
||||||
|
};
|
||||||
|
|
||||||
|
var server = http.createServer(function (req, res) {
|
||||||
|
|
||||||
|
// Parse the request containing file name
|
||||||
|
var pathname = url.parse(req.url).pathname;
|
||||||
|
|
||||||
|
// Print the name of the file for which request is made.
|
||||||
|
console.log("Request for " + pathname + " received.");
|
||||||
|
|
||||||
|
if (req.method === 'POST') {
|
||||||
|
var body = '';
|
||||||
|
|
||||||
|
req.on('data', function(chunk) {
|
||||||
|
body += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('end', function() {
|
||||||
|
if (req.url === '/') {
|
||||||
|
log('Received message: ' + body);
|
||||||
|
} else if (req.url = '/scheduled') {
|
||||||
|
log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.writeHead(200, 'OK', {'Content-Type': 'text/plain'});
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var filename = pathname.substr(1);
|
||||||
|
if(filename === ''){
|
||||||
|
filename = 'index.html';
|
||||||
|
}
|
||||||
|
// Read the requested file content from file system
|
||||||
|
fs.readFile(filename, function (err, data) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err, filename);
|
||||||
|
// HTTP Status: 404 : NOT FOUND
|
||||||
|
// Content Type: text/plain
|
||||||
|
res.writeHead(404, {'Content-Type': 'text/html'});
|
||||||
|
}else{
|
||||||
|
//Page found
|
||||||
|
// HTTP Status: 200 : OK
|
||||||
|
// Content Type: text/plain
|
||||||
|
var type = mime.lookup(filename);
|
||||||
|
console.log('type',type);
|
||||||
|
if (!res.getHeader('content-type')) {
|
||||||
|
var charset = mime.charsets.lookup(type);
|
||||||
|
res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
|
||||||
|
}
|
||||||
|
if(type.indexOf('image') > -1){
|
||||||
|
var img = fs.readFileSync(pathname.substr(1));
|
||||||
|
res.end(img, 'binary');
|
||||||
|
}else{
|
||||||
|
res.write(data.toString());
|
||||||
|
}
|
||||||
|
// Write the content of the file to response body
|
||||||
|
}
|
||||||
|
// Send the response body
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen on port 3000, IP defaults to 127.0.0.1
|
||||||
|
server.listen(port);
|
||||||
|
|
||||||
|
// Put a friendly message on the terminal
|
||||||
|
console.log('Server running at http://127.0.0.1:' + port + '/');
|
@ -7,6 +7,7 @@
|
|||||||
"postinstall": "typings install",
|
"postinstall": "typings install",
|
||||||
"clean": "rimraf node_modules typings",
|
"clean": "rimraf node_modules typings",
|
||||||
"start": "npm run tslint && concurrently \"npm run tsc:w\" \"license-check\" \"npm run serve\" ",
|
"start": "npm run tslint && concurrently \"npm run tsc:w\" \"license-check\" \"npm run serve\" ",
|
||||||
|
"aws": "node app.js",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"tsc:w": "tsc -w",
|
"tsc:w": "tsc -w",
|
||||||
"serve": "wsrv -o -s -l -p 3000 -x ./server/versions.js",
|
"serve": "wsrv -o -s -l -p 3000 -x ./server/versions.js",
|
||||||
@ -66,15 +67,18 @@
|
|||||||
"reflect-metadata": "0.1.3",
|
"reflect-metadata": "0.1.3",
|
||||||
"rxjs": "5.0.0-beta.6",
|
"rxjs": "5.0.0-beta.6",
|
||||||
"zone.js": "0.6.12",
|
"zone.js": "0.6.12",
|
||||||
|
|
||||||
"rimraf": "2.5.2",
|
"rimraf": "2.5.2",
|
||||||
"material-design-icons": "2.2.3",
|
"material-design-icons": "2.2.3",
|
||||||
"material-design-lite": "1.1.3",
|
"material-design-lite": "1.1.3",
|
||||||
"ng2-translate": "2.2.0",
|
"ng2-translate": "2.2.0",
|
||||||
"pdfjs-dist": "1.5.258",
|
"pdfjs-dist": "1.5.258",
|
||||||
"flag-icon-css": "2.3.0",
|
"flag-icon-css": "2.3.0",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
"alfresco-js-api": "0.2.1",
|
"alfresco-js-api": "0.2.1",
|
||||||
|
=======
|
||||||
|
"alfresco-js-api": "0.1.0",
|
||||||
|
>>>>>>> fast deploy on aws
|
||||||
"ng2-alfresco-core": "0.2.0",
|
"ng2-alfresco-core": "0.2.0",
|
||||||
"ng2-alfresco-datatable": "0.2.0",
|
"ng2-alfresco-datatable": "0.2.0",
|
||||||
"ng2-alfresco-documentlist": "0.2.0",
|
"ng2-alfresco-documentlist": "0.2.0",
|
||||||
@ -89,6 +93,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "2.0.0",
|
"concurrently": "2.0.0",
|
||||||
"license-check": "1.1.5",
|
"license-check": "1.1.5",
|
||||||
|
"mime": "^1.3.4",
|
||||||
"tslint": "3.8.1",
|
"tslint": "3.8.1",
|
||||||
"typescript": "1.8.10",
|
"typescript": "1.8.10",
|
||||||
"typings": "1.0.4",
|
"typings": "1.0.4",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user