Search code examples
phpamazon-web-servicesamazon-elastic-beanstalkdevopsaws-codepipeline

Deployment Failed from Github via Code Pipeline


I am trying to deploy new things on our server.

It's failing every time i don't know why, every time i get:

[Instance: i-0767cd899da6be838] Command failed on instance. 
Return code: 2 Output: (TRUNCATED)... see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. - 
It's a private package and you forgot to add a custom repository to find it Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

Code Pipeline raise this message:

Deployment completed, but with errors: 
During an aborted deployment, some instances may have deployed the new application version. 
To ensure all instances are running the same version, re-deploy the appropriate application version. 
Failed to deploy application. 
Unsuccessful command execution on instance id(s) 'i-0767cd899da6be838'. 
Aborting the operation. 
[Instance: i-0767cd899da6be838] Command failed on instance. 
Return code: 2 Output: (TRUNCATED)... see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. - It's a private package and you forgot to add a custom repository to find it Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

I checked /var/log/eb-activity.log and /var/log/httpd/error_log in elastic beans but they have nothing.

This is composer.json may help to track issue:

{
    "require": {
        "php": "7.2",
        "algolia/algoliasearch-client-php": "^3.1",
        "authy/php": "3.0.5",
        "barryvdh/laravel-cors": "^0.11.3",
        "barryvdh/laravel-translation-manager": "^0.5.3",
        "berkayk/onesignal-laravel": "^1.0",
        "cviebrock/eloquent-sluggable": "^4.6",
        "darkaonline/l5-swagger": "5.7.*",
        "doctrine/dbal": "2.10.1",
        "dusterio/laravel-aws-worker": "^0.1.26",
        "fideloper/proxy": "^4.0",
        "google/apiclient": "^2.4",
        "guzzlehttp/guzzle": "^6.3",
        "intervention/image": "^2.4",
        "jenssegers/agent": "^2.6",
        "laravel/framework": "5.7.*",
        "laravel/scout": "^7.0",
        "laravel/slack-notification-channel": "v1.0.3",
        "laravel/socialite": "^4.4",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "^5.7",
        "league/flysystem-aws-s3-v3": "^1.0",
        "maatwebsite/excel": "3.1.25",
        "pusher/pusher-php-server": "^4.1",
        "segmentio/analytics-php": "^1.7",
        "sentry/sentry-laravel": "1.6.1",
        "spatie/laravel-activitylog": "v2.8.4",
        "spatie/laravel-medialibrary": "^6.19.0"
    },
    "minimum-stability": "dev"
}

Any help ?


Solution

  • I got my problem solved. At first i tried to apply solutions at this post but it didn't solve my problem.

    The only thing that solved my problem was by upgrading my composer version.

    So i upgraded my composer from 1.8.0 to 2.1.3 by:

    composer self-update 2.1.3
    

    I had to do this in the elastic beanstalk configuration file:

    commands:
      01updateComposer:
        command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update 2.1.3
    

    Hope this helps you guys one day.