forked from komarserjio/notejam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
before_deploy.sh
executable file
·44 lines (36 loc) · 1.29 KB
/
before_deploy.sh
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
#!/bin/bash
# This script is run before an AWS deployment is done.
# Get, install, configure AWS
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip -o awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
export PATH=~/bin:$PATH
aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID}
aws configure set ws_secret_access_key ${AWS_SECRET_ACCESS_KEY}
aws configure set default.region ${AWS_DEFAULT_ZONE}
RDSHOST=$(aws rds describe-db-instances --db-instance-identifier aurorac --query 'DBInstances[0].Endpoint.Address')
cat > laravel/notejam/app/config/local/database.php << EOL
<?php
return array(
'default' => 'mysql',
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => ${RDSHOST},
'port' => 3306,
'database' => 'toptalc',
'username' => 'aurorac_master',
'password' => '${RDS_PASSWORD}',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
)
)
);
EOL
# rebuild image as files has changed
docker build -f docker/Dockerfile_apache -t notejam:latest .
mkdir build
docker save notejam:latest > build/notejam.tar
zip -r build/bundle.zip build/notejam.tar appspec.yml dockerup.sh
#echo ${RDSHOST} > laravel/notejam/app/config/local/database.php