How to deploy cloud code on AWS hosted Parse serve

2020-07-17 07:55发布

问题:

I am new to AWS elastic beanstalk. I have deployed the Parse example server using deploy to AWS button in the Parse Server Example Link. I want to update the cloud code in main.js but I don't know how can I deploy the cloud code the way I was deploying with Parse in terminal.

回答1:

Try this command:

eb deploy

It will zip your repository, upload to S3 and deploy to eb.

Get the CLI tool: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html



回答2:

You need to have the Parse Server Example locally on your machine. Then, setup the EB CLI tool in that folder so that you can deploy using the eb deploy.

Make sure that you indicate to the ParseServer in index.js that you want CloudCode enabled:

var api = new ParseServer({
  ...
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  ...

I am using environment variables for configuration of the path.

To update your Parse Cloud Code there is "cloud" folder in the file structure that contains a main.js file. Paste your existing Cloud Code into this file and then deploy the update to AWS. This is all I had to do for mine and it works.