5
votes

I'm using Amazon's Elastic Beanstalk to deploy my app via Git, and I've got submodules within my Git. Of course, when I look at the directories where the data for the submodules should be, nothing is there because the submodules have not been initialized.

Apparently Elastic Beanstalk doesn't support submodules. Is this correct? If so, how can I convince Git to let me have the features of a submodule but still upload all the code of the submodule when I push the main repo?

4

4 Answers

5
votes

Elastic Beanstalk does support sub-modules if you just make sure that Git is installed on the AMI you use by Customizing and Configuring AWS Elastic Beanstalk Environments. You can do that by providing a config in your git repo:

  • Create a configuration file with the extension .config (e.g., myapp.config) and place it in an .ebextensions top-level directory of your git repo

  • In that file, specify the dependencies:

   packages: 
      <name of package manager>:
         <package name>: <version>

for example:

   packages:
      yum:
         git: []
  • make sure you match the name of package manager to the AMI you're using, so for example yum for Amazon Linux, apt for Ubuntu.

  • you'll probably have to adapt your build script to initialize the sub-modules as EB won't do that for you

  • commit, push and deploy and go

0
votes

Which container? Java, Ruby, etc?

There are different deployment tools, you aren't just stuck with the command-line eb that is available at aws. I've been working on a config/rake gem (that uses eb_deployer) that I'll be putting out shortly that just uses a zip file, not a git push, so that would work. You might also try ebs-deploy.

0
votes

If you use awsebcli installed thru pip, then this may help you.

We found the source code for AWS-EB client 3.10.1 on PyPi.

The issue is in how git repos are handled while zipping your project's source code for uploading it to AWS. If you do not use git for your AWS project, the whole project directory (including any other git modules under subdirectories you may have in it) is zipped and sent to AWS. If you use git, then all the checked-in or staged code except the submodules is zipped and sent to AWS. Git submodules are skipped.

We wrote a fix for this issue by changing the behavior such that the submodules are also added to the zipped archive. You can see the fix at github.com/uppercasebrands/awsebcli-3.10.1/compare/eb-deploy-submodule on our git repo which is created from the original PyPi package.

You can install the fixed awsebcli-3.10.1 which now supports submodules by using pip:

pip install --upgrade git+https://github.com/uppercasebrands/awsebcli-3.10.1.git@eb-deploy-submodule

0
votes

If you are using CodePipeline, there is a way to use CodeBuild to get all submodules and provide this artifact to Elastic Beanstalk automatically: https://medium.com/@cristiano.ventura/working-with-git-submodules-in-codepipeline-83e843e5d0a