4

I'm migrating away from Envoyer to AWS code deploy to auto-deploy my Laravel app.

So I added this to my afterInstall script:

cd /project directory
composer install


if [ -f artisan ]
then
    php artisan migrate --force
fi

if [ -f artisan ]
then
    php artisan config:cache
    php artisan queue:restart
fi

But the deployment fails with this error

MessageScript at specified location: scripts/after-install.sh run as user user failed with exit code 1 Log TailLifecycleEvent - AfterInstall Script - scripts/after-install.sh [stderr]No passwd entry for user 'user'

which is weird. The AMI instance I've created already has the default user login as well as ubuntu as sudoers:

grep -Po '^sudo.+:\K.*$' /etc/group
ubuntu,forge

So why is it asking for a password?

halfer
  • 19,824
  • 17
  • 99
  • 186
abbood
  • 23,101
  • 16
  • 132
  • 246

1 Answers1

3

I had to change the runAs section in the appspec file

in the script specified in "location".
  AfterInstall:
    - location: scripts/after-install.sh
      runas: forge // used to be 'user'
abbood
  • 23,101
  • 16
  • 132
  • 246