Comments (8)
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.
@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.
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.
@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.
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.
I guess this isn't possible
from aws-codedeploy-agent.
@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.
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)
- [Feature Request] macOS support
- Move After to proper systemd unit file section
- [Feature Request]Appspec.yml validation
- Error validating the SSL configuration: Invalid server certificate HOT 9
- Debian package depends on ruby version < 3.1, even though 3.1 and 3.2 is supported HOT 5
- Windows Deployment Group logs should be in the log folder
- Code deploy falling very frequently HOT 1
- CodeDeplot Access denied when calling "codedeploy-commands.eu-central-1.amazonaws.com:443" HOT 1
- [Feature Request] Debian (12 Bookworm) support HOT 1
- [problem] CodeDeploy Agent systemd service bash-completion error
- [Error] AL2023 - max_revisions - Error deleting directories HOT 3
- CodeDeploy 'Downloading failed bundle.zip from s3 bucket' at "DownloadBundle" step HOT 1
- Service is running but with errors HOT 1
- Codedeploy failing randomly at Install not finding appspec.yml
- Switch to use s3 multipart download when fetching artifacts
- DownloadBundle deployment lifecycle events for troubleshooting UnknownError: execution expired HOT 1
- Failed deployment DownloadBundle events with error "No such file or directory - getcwd" HOT 1
- Add the CodeDeploy agent to the PATH HOT 1
- CodeDeploy agent support for RHEL 9 HOT 1
- Announcement: Releasing Agent 1.7.0 to all regions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-codedeploy-agent.