Allowing Composer To Access Private GitHub Repos In An Elastic Beanstalk Environment

From Littledamien Wiki
Jump to navigation Jump to search

Overview[edit]

The goal is to run composer as part of an Elastic Beanstalk instance deployment where some of the app's dependencies are private repos hosted on GitHub.

Solution[edit]

Add an environment variable to the EBS instance (through the EBS AWS console: AWS Console' > Elastic Beanstalk > Select the EBS instance > Configuration > Software > Edit > Environment Properties) [1]

  • Variable name: COMPOSER_AUTH
  • Variable value: {"github-oauth":{"github.com":"XXXXXXXXXXX"}}
    Where XXXXXXXXXXX is the current GitHub personal access token used to grant this host permission to access the private GitHub repo.

Caveats[edit]

The COMPOSER_AUTH environment variable value will need to be updated after a GitHub PAT expires and is regenerated.

Notes[edit]

[[Category::Elastic Beanstalk]]