Hello I'm trying to create a CodeDeploy deployment for my golang application. I have an autoscaling group that uses a AMI I created that has all the libs I need installed. When I try to run CodeDeploy it exists with an error in my after_install
:
LifecycleEvent - AfterInstall
Script - scripts/after_install.sh
[stderr]/opt/codedeploy-agent/deployment-root/a65d9a2e-fddd-471c-8ea1-c018792d00bd/d-4IKP3PP4Y/deployment-archive/scripts/after_install.sh:
line 4: go: command not found
I know go is installed on the server I can verify by sshing into the server and running the go command. Initially I had my after_install
hook run as root so that's why I thought it complained about go not being installed.
I updated it to run as ubuntu
here is the appspec file
version: 0.0
os: linux
files:
- source: ./
destination: ./home/ubuntu/code
hooks:
AfterInstall:
- location: scripts/after_install.sh
timeout: 180
runas: ubuntu
ApplicationStart:
- location: scripts/application_start.sh
timeout: 180
runas: root
But I still get the error of go command not found. I SSH into the server as ubuntu
user and I can clearly see go is installed.
I took it one step further and ran the after_install.sh
file and it worked with no errors. What am I doing wrong here?
Just for the extra curious here is my after_install.sh
file
#!/bin/bash
cd /home/ubuntu/code/vibeify/cmd/vibeify
go build