From 1281a9fbbf9fc56770923f5d01cb3ad2fbacf8db Mon Sep 17 00:00:00 2001 From: alok Date: Fri, 8 Jun 2018 12:21:36 -0700 Subject: [PATCH] WIP for amazon codedeploy --- aws-scripts/say_hello.sh | 1 + aws-setup/AppSpec.yml | 22 ++++++++++++++++++++++ aws-setup/copy_code.sh | 1 + aws-setup/user-data.sh | 7 +++++++ 4 files changed, 31 insertions(+) create mode 100644 aws-scripts/say_hello.sh create mode 100644 aws-setup/AppSpec.yml create mode 100644 aws-setup/copy_code.sh create mode 100644 aws-setup/user-data.sh diff --git a/aws-scripts/say_hello.sh b/aws-scripts/say_hello.sh new file mode 100644 index 000000000..0a9c27341 --- /dev/null +++ b/aws-scripts/say_hello.sh @@ -0,0 +1 @@ +echo "Hi, I am in aws-scripts and its seems to have worked." \ No newline at end of file diff --git a/aws-setup/AppSpec.yml b/aws-setup/AppSpec.yml new file mode 100644 index 000000000..b9c76b877 --- /dev/null +++ b/aws-setup/AppSpec.yml @@ -0,0 +1,22 @@ +version: 0.0 +os: linux +files: + - source: ../ + destination: /projects/ +hooks: + BeforeInstall: + - location: aws-scripts/say_hello.sh + timeout: 300 + runas: root + AfterInstall: + - location: aws-scripts/say_hello.sh #maybe start the server + timeout: 300 + runas: root + ApplicationStart: + - location: aws-scripts/say_hello.sh #maybe start the server. + timeout: 300 + runas: root + ApplicationStop: + - location: aws-scripts/say_hello.sh + timeout: 300 + runas: root \ No newline at end of file diff --git a/aws-setup/copy_code.sh b/aws-setup/copy_code.sh new file mode 100644 index 000000000..2b9fc1c3d --- /dev/null +++ b/aws-setup/copy_code.sh @@ -0,0 +1 @@ +scp -i main.pem -r ~/Documents/goworkspace/src/github.com/harmony-benchmark/ ec2-user@ec2-34-219-218-239.us-west-2.compute.amazonaws.com:/home/ec2-user/projects/ diff --git a/aws-setup/user-data.sh b/aws-setup/user-data.sh new file mode 100644 index 000000000..afef732c8 --- /dev/null +++ b/aws-setup/user-data.sh @@ -0,0 +1,7 @@ +sudo yum update +sudo yum install wget +REGION=$(curl 16.9.254.169.254/latest/meta-data/placement/availability-zone | sed 's/[a-z]$//' ) +cd /home/ec2-user +wget https://aws-codedeploy-$REGION.s3.amazonaws.com/lates/install +chmod +x ./install +sudo ./install auto \ No newline at end of file