Skip to content

Instantly share code, notes, and snippets.

@haskins-io
Last active March 3, 2017 20:31
Show Gist options
  • Save haskins-io/249940f5289e088b28632f13f372cb28 to your computer and use it in GitHub Desktop.
Save haskins-io/249940f5289e088b28632f13f372cb28 to your computer and use it in GitHub Desktop.
a method of deployment a .war to an EC2 using AWS CodeDepoy <- I'm working on this it may not work

The idea at the moment is that the scripts and yaml file are reusable. A deployment would consist of adding a new .war file into the artifcat folder. All the files would then be zipped up and uploaded to S3. A deployment would then be triggered.

version: 0.0
os: linux
files:
- source: artifact/root.war
destination: /var/lib/tomacat6/webapps
hooks:
BeforeInstall:
- location: scripts/deploy_application.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_tomcat.sh
timeout: 300
runas: root
ApplicationStop:
- location: scripts/stop_tomcat.sh
timeout: 300
runas: root
#!/usr/bin/env bash
DATE=$(date +"%Y%m%d%H%M")
mv /usr/lib/tomcat6/webapps/root.war /home/ubuntu/backups/root-$DATE.war
#!/usr/bin/env bash
service tomcat6 start
#!/usr/bin/env bash
isExistApp=`pgrep tomcat6`
if [[ -n $isExistApp ]]; then
service tomcat6 stop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment