Shell script and destination source for appspec.yml file for Codedeploy

184 Views Asked by At

I am fairly new to this. I am trying to put into practice ETL. I have a flask application with requirement.txt file in the root directory. I am trying to build a appspec.yml file in order to deploy the code on ec2/on-premise using Codedeploy. My source is Github(version2). But I am getting a Script error in the BeforeInstall stage stating 'requiements.txt' does not exist.

Here is the structure of my project

requirements.txt
app.py
scripts/
--install_dependencies.sh
--start-server.sh

The following is my appspec.yml file

version: 0.0
os: linux

files:
  - source: /
    destination: /var/www/html/myapp

file_exists_behaviour: OVERWRITE

hooks:
  BeforeInstall:
    - location: scripts/install_dependencies.sh
      runas: root
  ApplicationStart:
    - location: scripts/start_server.sh
      runas: root

The following is my install_dependencies.sh file

#!/bin/bash

# Activate the virtual environment (if applicable)
# source /path/to/your/virtualenv/bin/activate
cd /var/www/html/myapp

# Install the required Python packages
pip install -r requirements.txt

I get an error stating no No directory /var/www/html/myapp exists and requiements.txt does not exist.

I am fairly new to AWS and I did read the documentation but I am unable to troubleshoot this issue.

0

There are 0 best solutions below