Is the elastic beanstalk "git aws.push" just different?

We are saving our PHP project on github.

For quick deployment, we use the .bat file for git, pushing the changes to the Beanstalk AWS cloud cloud:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git aws.push --environment envname" 

We do a commit every time before clicking, and it works just fine, as expected.

Unfortunately, for some reason, sometime it clicks very quickly (just presses the difference in the changes to the PHP code), but sometimes it sends the whole 300mb project (with all the media).

Is there a git way to push only the modified difference? Maybe there are any additional options for push commands or preparing git before submitting? Or maybe there is some way to tell AWS EB to pull the latest commit from the github repository?

Thanks for any help.

+3
source share
3 answers

OK, after several months of trouble, I decided the cause of the problem.

The problem is that on

 aws.push 

The Elastic Beanstalk team checks if your current files are tied to git or if they are ahead of the repository. If your files are identical to the last git commit, then EB pulls only the difference, but if your files are ahead of the last git commit , then it pulls the whole folder

To avoid problems, I made a deploy.bat file for windows that try to commit changes before the aws.push command:

 cls git add . git commit -a git aws.push --environment myenvironment pause 

Now, if you have already committed before running this .bat file, you will only upload the difference. Otherwise, you will be prompted with a git commit message before downloading the conversation.

PS - Please note that if you try again to click on a version that is already included in EB, it will also try to download the entire folder.

Pss. If for any reason you see that EB is trying to pull out the entire folder, just close the window, make small changes to the source code (for example, adding a new line or comment), save, commit the changes to git and run the deploy.bat file again.

It works like a charm!

Edit:

For those using the new standalone eb cli, the code would be:

 cls git add . git commit -a eb deploy your_environmant_name pause 
+2
source

With the release of git aws.push your entire git repository will be archived and uploaded to Elastic Beanstalk, hence there will be a long click time. This is a way to implement this command. There is a good discussion and request for a change in this thread .
I'm not sure which files are inserted so heavily into your code, but overall it is better not to store them in a git application.
If these are multimedia files, save them to S3 (or any other place accessible on the Internet). If most of the files are external libraries located in your git, you can preinstall them using a pre-deployment EB script .

+2
source

I applied a workaround because it is an Amazon error.

I am setting up a git account on the server (I used Gitlab, free private repositories and unlimited collaborators), you can use whatever you want (github, gitlab, your server).

The process between you and the git server is reliable, you always push the changes, always. On the EC2 server, I install the git repository (you can use the .ebextensions / *. Config configuration file or do it manually, I suggest that you do not install the manual in all your instances), which is connected to my git server and from the EC2 server do git pull and git aws .push.

You can configure, for example, Web Hook to notify when you press git, and then do git pull and git aws.push automatically. in my case, I prefer to decide when to deploy using SSH, and this is not always when I click on my git server.

Thus, making git aws.push from the EC2 server to the Elastic Beanstalk server is very fast, it does not matter if it pushes all or only the changes.

+2
source

Source: https://habr.com/ru/post/978492/


All Articles