-
Notifications
You must be signed in to change notification settings - Fork 1
/
wercker.yml
76 lines (69 loc) · 2.75 KB
/
wercker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
box: wercker/default
deploy:
steps:
- install-packages:
packages: unzip
- script:
name: Install Beanstalk CLI
code: |-
wget --quiet https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.4.0.zip
unzip -qq AWS-ElasticBeanstalk-CLI-2.4.0.zip
sudo mkdir -p /usr/local/aws/elasticbeanstalk
sudo mv AWS-ElasticBeanstalk-CLI-2.4.0/* /usr/local/aws/elasticbeanstalk/
export PATH="/usr/local/aws/elasticbeanstalk/eb/linux/python2.7:$PATH"
export AWS_CREDENTIAL_FILE="/home/ubuntu/.elasticbeanstalk/aws_credential_file"
mkdir -p "/home/ubuntu/.elasticbeanstalk/"
mkdir -p "$WERCKER_SOURCE_DIR/.elasticbeanstalk/"
# Store the key and secret key in the the aws_credential_file
# This key and secret_key must be set as environment variable
# in your deploy target.
- create-file:
name: Create AWS credential file
filename: $AWS_CREDENTIAL_FILE
content: |-
AWSAccessKeyId=$KEY
AWSSecretKey=$SECRET_KEY
# I'm not sure which information is mendatory, I've copied
# the full content from the config file on my local dev machine
# after a "eb init".
- create-file:
name: Add beanstalk config
filename: $WERCKER_SOURCE_DIR/.elasticbeanstalk/config
content: |-
[global]
ApplicationName=php-hello-world
DevToolsEndpoint=git.elasticbeanstalk.us-east-1.amazonaws.com
EnvironmentName=wercker
Region=us-east-1
ServiceEndpoint=https://elasticbeanstalk.us-east-1.amazonaws.com
[branches]
master=wercker
[branch:master]
ApplicationVersionName=master
EnvironmentName=wercker
InstanceProfileName=aws-elasticbeanstalk-ec2-role
# Check if beanstalk CLI is there
- script:
name: Beanstalk there?
code: eb status
# Remove the existing repository and re-add everything
# in a new repository that will be used to push it to beanstalk
# The last line in this script add the beanstalk hooks to the
# repository
- script:
name: Create deploy repository
code: |-
git config --global user.email "pleasemailus@wercker.com"
git config --global user.name "wercker"
rm -rf $WERCKER_SOURCE_DIR/.git
echo ".elasticbeanstalk/" > .gitignore
git init
git add .
git commit -m "deploy commit"
sudo bash /usr/local/aws/elasticbeanstalk/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh
# Do the actual deploy via the aws.push hook that the Beanstalk CLI adds
- script:
name: Push it!
code: |-
git checkout master
git aws.push