Giter VIP home page Giter VIP logo

Comments (8)

amartyag avatar amartyag commented on June 3, 2024

Hi,
Looks like composer is trying to find the json file in pwd (which looks like /opt/codedeploy-agent).
You can check the stdout of your script in: /opt/codedeploy-agent/deployment-root/deployment-group-id/deployment-id/logs/scripts.log

You can modify the script like this, which might solve the issue:
#!/bin/bash
echo pwd
cd path_to_composer_json
sudo composer install
sudo vendor/bin/phing www

from aws-codedeploy-agent.

dbclkclk avatar dbclkclk commented on June 3, 2024

@amartyag To try to * cd path_to_composer_json* , that's within my actually deploy directory. My question is, isn't the path /deployment-group-id/deployment-id/, especially deployment-id generated dynamically? I dont want to have a case when on each deploy, a deployment-id folder is generated and I can't reference the correct composer.json file.

from aws-codedeploy-agent.

feverLu avatar feverLu commented on June 3, 2024

deployment-id is different for each deployment(as a unique id), it shows on the deployment page console too. Every time, a deployment-id folder will be generated, but your default directory will be /opt/codedeploy-agent/deployment-root/deployment-group-id/deployment-id, so actually just change to the relative directory inside your deployment archive will work.

from aws-codedeploy-agent.

dbclkclk avatar dbclkclk commented on June 3, 2024

@feverLu I dont think I get you. If this is being automated and I have a build.sh script that runs on each deploy, how do I know from my build.sh script what's the current named folder the project was deployed in (if this is something random)? Example:


 #!/bin/bash
cd  /deployment-root/deployment-group-[`[HOW DO I KNOW WHAT ID IT IS AT DEPLOY TIME WITHOUT FINDING THIS OUT FROM CONSOLE AND CHANGING THIS EVERY TIME`]/deployment-[`HOW DO I KNOW WHAT ID IT IS AT DEPLOY TIME WITHOUT FINDING THIS OUT FROM CONSOLE AND CHANGING THIS EVERY TIME`]
  sudo composer install
 sudo vendor/bin/phing www

Make sense?

from aws-codedeploy-agent.

dbclkclk avatar dbclkclk commented on June 3, 2024

Also please note, I mentioned this in my previous comment:

 /deployment-[`HOW DO I KNOW WHAT ID IT IS AT DEPLOY TIME WITHOUT FINDING THIS OUT FROM CONSOLE AND CHANGING THIS EVERY TIME I DEPLOY`]

from aws-codedeploy-agent.

dbclkclk avatar dbclkclk commented on June 3, 2024

I guess this isn't possible

from aws-codedeploy-agent.

bdashrad avatar bdashrad commented on June 3, 2024

@dbclkclk This doesn't look like a bug, but rather a misconfiguration. Have a look at https://github.com/awslabs/aws-codedeploy-samples/ for examples.

If I were you, instead of trying to guess the directory, I would put my build script in a standard location and set the permissions of the file correctly before calling in in appspec.yml.

Your tree could look something like this:

deploy/
├── appspec.yml
├── deploy_hooks
│   └── build.sh
├── composer
    ├── composer.json
└── html
    ├── index.php
    └── some_content

And appspec.yml should look like:

version: 0.0
os: linux
files:
  - source: html/
    destination: /var/www/html
  - source: composer/
    destination: /opt/composer
permissions:
  - object: /var/www/html
    owner: www-data
    group: www-data
    mode: 744
    type:
      - file
hooks:
  BeforeInstall:
    - location: deploy_hooks/build.sh
      runas: root

Then point your build.sh to the location you moved the files to:

build.sh

#!/bin/bash
echo pwd
cd /opt/composer
composer install
vendor/bin/phing www

from aws-codedeploy-agent.

ambareesha avatar ambareesha commented on June 3, 2024

You can get the current deployment-id and deployment-group-id from the environment variables: https://blogs.aws.amazon.com/application-management/post/Tx1PX2XMPLYPULD/Using-CodeDeploy-Environment-Variables

You can use these to build up your absolute path.

from aws-codedeploy-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.