1

I had ApplicationStop in my appspec.yml file in the previous deployment but removed it. Now, CodeDeploy is trying to find the file which was there in my previous deployment. I found other answers but none of them are working:

  1. sudo service codedeploy-agent stop On typing this in CloudShell, I am getting the error - sudo: service: command not found
  2. aws deploy create-deployment --application-name APPLICATION --deployment-group-name GROUP --ignore-application-stop-failures --s3-location bundleType=tar,bucket=BUCKET,key=KEY --description "Ignore ApplicationStop failures due to broken script" After typing this and replacing the APPLICATION, GROUP, BUCKET, and KEY, the code deployment starts. But, deployment fails anyway with error. enter image description here

My files: appspec.yml:

version: 0.0
os: linux
files:
  - source: /
    destination: /home/discordbot
hooks:
  AfterInstall:
    - location: scripts/RunMyBot.sh
      timeout: 300
      runas: root

RunMyBot.sh

#!bin/bash

easy_install pip
pip install -r /home/discordbot/requirements.txt

file="/lib/systemd/system/mypythonservice.service"
echo "[Unit]" > $file
echo "Description=My Python Service" > $file
echo "After=multi-user.target" >> $file

echo "[Service]" >> $file
echo "Type=idle" >> $file
echo "ExecStart=/usr/bin/python /home/discordbot/botMain.py" >> $file
echo "Restart=on-failure" >> $file

echo "[Install]" >> $file
echo "WantedBy=multi-user.target" >> $file
cat $file

sudo chmod 644 /lib/systemd/system/mypythonservice.service

sudo systemctl daemon-reload

sudo systemctl enable mypythonservice.service

I just can't get my code deployed successfully, 27 deployments have failed. My python code is simple which just needs to run all the time. It accepts commands from users and returns the output. Code resides in github.

DeadPool
  • 185
  • 2
  • 13

0 Answers0