I have setup Code Deploy service on aws and It's working great, but what I want is to run composer update
command after deploying.
I have defined composer update
command in AfterInstall hook, but It doesn't seem to work.
Here's my appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /var/www/laravel/
hooks:
AfterInstall:
- location: hooks/after-install.sh
runas: root
and here's the after-install.sh file code:
#!/bin/bash
php /var/www/laravel/artisan clear-compiled
php /var/www/laravel/artisan optimize
php /var/www/laravel/artisan view:clear
php /var/www/laravel/artisan cache:clear
chown -R ubuntu:www-data /var/www/laravel
sudo find /var/www/laravel -type d -exec chmod 755 {} +
sudo find /var/www/laravel -type f -exec chmod 644 {} +
chmod -R 777 /var/www/laravel/storage
composer update
all other commands work except the composer update, any help is appreciated.
Thakns
You must include absolute path for the directory where your project resides (where you have composer.json
file for the dependencies).
Replace composer update
with composer update -d /var/www/laravel
and It will work like charm.