babel plugin for hybrid local and cloud deployment
npm install location-aware-hybrid-cloudnpm install location-aware-hybrid-cloud --save to install through npm manager.This project would be used by companies and research teams that have multiple
applications or computational modules in different clouds. Examples include investment banks, hedge funds, or tech companies driven by concerns for safety, privacy, or amount of computation.
A simple demo program:
/* @cloud
Provider:aws
S3:true
Region: us-east-2
*/
`$3
You need to have an Google Cloud Service account, create corresponding project first on the Google Cloud Console, and get the credential key files. More can be see at the github project Go through the Setup Google Cloud Part to setup before deployment.
The provider is gcf as google cloud function and passing arguements includes the region that is supposed to deploy, projectId which is created in google cloud console and path for the credential key file.
`
/* @cloud
Provider: goog
Region: us-central1
Project: testgfc-164121
Credentions: /Users/star/.gcloud/testgfc-bcc6039af0aa.json
*/
`
$3
Put the JS code in src\files\main.js
Old Way:
* Step 1:
sudo npm install -g install node module dependencies globally
* Step 2: npm run build genereate es5, node.js compatible file. The result files are in dist folder.
* Step 4: npm run deploy to deploy the cloud functions to the clouds
* Step 5: npm run start to run the application
*
New Way:
* Step 1:
`sudo npm install -g` (install node module dependencies)
* Step 2: `npm run lahc` (genereate es5, node.js compatible file, deploy, and run)
Project Structure:
!Alt text$3
1. extract-cloud: to extract cloud function from customer js file, and build a serverless.yml file for each function.
2. deploy-cloud: to deploy the extracted cloud function on to AWS Lambda through serverless
3. prepare-local: it will get back the uri of cloud function from AWS and generate a local.js file with request to AWS.
4. live: run through all the above command in one mode
Finally, run "node local.js" or "npm run start" to execute the functions.$3
1. Install node
2. Create package.json https://docs.npmjs.com/getting-started/using-a-package.json
3. Install babel https://babeljs.io/docs/setup/#installation (Ex $ npm install babel-core babel-cli)
https://www.youtube.com/watch?v=sZ0z7B7QmjI
https://github.com/bradtraversy/youtube_es2015_source/tree/master/01_babel
4. $ cd src
5. $ npm run buildHow to contribute
The project has two parts with Babel transpile and serverless deployment.
Babel transpile files are in the src folder as index.js executor.js and parser.js
1. index.js is the start of program and defines the input directory output directory and running mode.
Modify the bellow to change default setting.
Example command node index.js -m live -i input -d output`javascript
var yargOptions = {
mode: {
alias: 'm',
describe: 'Mode in which to run the CLI',
default: 'extract-cloud',
demand: true,
choices: ['extract-cloud', 'deploy-cloud', 'prepare-local', 'live'],
type: 'string'
},
'input-dir': {
alias: 'i',
default: './files',
describe: 'Root directory containing the code to be parsed and deployed',
demand: true,
type: 'string'
},
'output-dir': {
alias: 'd',
default: './cloud',
describe: 'Target directory where the CLI outputs all the runnable files',
demand: true,
type: 'string'
}
};
``