Hi guys,
After not touching my config.yml for sometime and then getting the push from AWS to upgrade python version from 2 to 3, I’ve had to change my EBCLI setup for python with in the config.yml
What I was doing was depending on the environment that I was deploying to, I would copy in appropriate config file into config directory of the node app so that when I starts it starts knowing that its, i.e. dev or int or syst, prod etc.
As soon as I went from this approach with old Python
# Install AWS EB cli
- run:
name: Install awsEBcli
command: |
python --version
sudo apt-get -y -qq update
sudo apt-get install -y python-pip libpython-dev python-virtualenv python-setuptools
virtualenv venv
source venv/bin/activate
pip install --upgrade setuptools pip
pip install awsebcli urllib3[secure]==1.22 idna==2.6
eb --version
# Copy Environment specific files
- run:
name: App Properties and Constant file
command: |
if [ "${CIRCLE_BRANCH}" == "integration" ]; then
echo ""
rm .gitignore
echo ""
echo "Move CONFIG JS File"
mv .deploy/config.js.integration config/config.js
if [ $? != 0 ]; then
echo "FAILED: Move Config.js: $? - Unsuccessful"
else
echo "SUCCESS: Config.js mv done 3 of 4"
fi
To Python3 like this
# Install AWS EB cli
- run:
name: Install awsEBcli
command: |
sudo apt-get -y -qq update
sudo apt-get install python3-pip python3-dev python3-venv python3-setuptools
python --version
python3 -m venv venv
source venv/bin/activate
python --version
pip install --upgrade pip
pip install wheel
pip install awsebcli
eb --version
# Copy Environment specific files
- run:
name: App Properties and Constant file
command: |
if [ "${CIRCLE_BRANCH}" == "integration" ]; then
echo ""
rm .gitignore
echo ""
echo "Move CONFIG JS File"
mv .deploy/config.js.dev config/config.js
if [ $? != 0 ]; then
echo "FAILED: Move Config.js: $? - Unsuccessful"
else
echo "SUCCESS: Config.js mv done 1 of 2"
fi
fi
I’ve SSH’d into the build circle build machine and can see that the files have actually moved into the correct directory. However, why ins’t my EBS Deploy using it
# Deploy to the correct Elastic Beanstalk Environment corresponding to the current branch
- run:
name: Deploy to EBS
command: |
source venv/bin/activate
if ..........
elif [ "${CIRCLE_BRANCH}" == "integration" ]; then
echo "START EBS Beanstalk Int Deployment"
echo "Start Initialise Region"
eb init --region ap-southeast-2 --platform "64bit Amazon Linux 2 v5.4.5 running Node.js 14" [appname]
eb use [app-name]-env
eb labs cleanup-versions --older-than 2 --debug --verbose --force
echo " Start Deploy to Environment"
eb deploy [app-name]-env --label "$COMMIT_MESSAGE"
echo "COMPLETE EBS Beanstalk Deployment done "
fi
Any assistance would be greatly appreciated.