Skip to content

Instantly share code, notes, and snippets.

image: node:9.11.1
stages:
- build
- test
- deploy
before_script:
- apt-get update --quiet --yes
#!/bin/bash
APPHOME=/home/ubuntu/App
cd $APPHOME
BASE=$APPHOME
PID=$BASE/app.pid
LOG=$BASE/app.log
CMD="$BASE/start.sh" # Point to your program run command
#!/bin/bash
echo "Copying files to /var/www/html"
sudo cp -R * /var/www/html
sudo nginx -s reload
echo "NGINX restarted"
#!/bin/bash
HOME=/home/ubuntu
APP=$HOME/App
CMD=$APP/app.sh
PIDF=$APP/app.pid
LOG=$HOME/deploy.log
APPLOG=$APP/app.log
/bin/echo "$(date '+%Y-%m-%d %X'): ** Validate Service Hook Started **" >> $LOG
#!/bin/bash
HOME=/home/ubuntu
APP=$HOME/App
LOG=$HOME/deploy.log
/bin/echo "$(date '+%Y-%m-%d %X'): ** Before Install Hook Started **" >> $LOG
# Before the installation code
/bin/echo "$(date '+%Y-%m-%d %X'): ** Before Install Hook Completed **" >> $LOG
#!/bin/bash
HOME=/home/ubuntu
APP=$HOME/App
PIDF=$APP/app.pid
CMD=$APP/app.sh
LOG=$HOME/deploy.log
/bin/echo "$(date '+%Y-%m-%d %X'): Initializing Deployment for $APPLICATION_NAME - $DEPLOYMENT_ID " >> $LOG
#!/bin/bash
HOME=/home/ubuntu
LOG=$HOME/deploy.log
# verify that the application directory has the correct owner/group
/usr/bin/sudo /bin/chown -R ubuntu:ubuntu /home/ubuntu/App
echo -e "Done" >> $LOG
/bin/echo "$(date '+%Y-%m-%d %X'): ** After Install Hook Completed **" >> $LOG
#!/bin/bash
HOME=/home/ubuntu
APP=$HOME/App
CMD=$APP/app.sh
LOG=$HOME/deploy.log
pwd >> $LOG
cd $APP
version: 0.0
os: linux
files:
- source: ./ # This line assumes that your deployment code is located in
destination: /home/ubuntu/App
permissions:
# sets application runner script as executable - This example assumes the sample 'my_app.sh' script has been added to the the directory 'my_app' and serves as the application launcher
- object: /home/ubuntu/App/
pattern: "app.sh"
owner: ubuntu
$ wget https://INSERT-BUCKET-NAME.s3.amazonaws.com/latest/install
$ chmod +x ./install
$ sudo ./install auto
$ sudo service codedeploy-agent status
If the CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running.
If you see a message like error: No AWS CodeDeploy agent running, start the service and run the following two commands, one at a time:
$ sudo service codedeploy-agent start