4

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.

Asadullah Ali
  • 1,056
  • 14
  • 31

2 Answers2

0

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

Charles Menguy
  • 40,830
  • 17
  • 95
  • 117
stevenlee
  • 11
  • 2
  • When I run eb deploy from the root folder the application updates as expected, however the main.js does not change. I figured this out by checking timestamps of the main.js on the eb server at /var/app/current/cloud/main.js Am I missing a step? – Michael Peterson May 11 '16 at 22:10
0

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.

Daniel V
  • 124
  • 4
  • Every time I edit code in the main.js file and then use `eb deploy`, it successfully uploads, but then I get the 502 error when clicking the address to the server. Had that issue? By the way, `eb deploy` works when I download the Parse server example code and add it to the server, just not when I try and upload with new cloud code. Any help would be much appreciated! – justColbs Apr 30 '16 at 03:28
  • If you are trying to 'eb deploy' from the 'cloud' subfolder then it will replace your entire deployment with just the main.js. Are you always using the deploy from your root folder? – Daniel V May 01 '16 at 13:58
  • @DanielV - When I run eb deploy from the root folder the application updates as expected, however the main.js does not change. I figured this out by checking timestamps of the main.js on the eb server at /var/app/current/cloud/main.js Am I missing a step? – Michael Peterson May 11 '16 at 22:09
  • Hmm, as long as the "cloud" folder containing the main.js is under the root it should update just fine. That is how I update mine. – Daniel V May 14 '16 at 03:17