Skip to content

Commit 8626417

Browse files
author
Kai Hendry
committed
Tidy up after merge
1 parent 3a22b9a commit 8626417

File tree

11 files changed

+78
-589
lines changed

11 files changed

+78
-589
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
lambda2sns
1+
process-bin
2+
push-bin
3+
packaged.yaml

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ install:
1010
deploy:
1111
# dev
1212
- provider: script
13-
script: aws configure set profile.uneet-dev.aws_access_key_id $AWS_ACCESS_KEY_ID &&
13+
script: >
14+
aws configure set profile.uneet-dev.aws_access_key_id $AWS_ACCESS_KEY_ID &&
1415
aws configure set profile.uneet-dev.aws_secret_access_key $AWS_SECRET_ACCESS_KEY &&
1516
aws configure set profile.uneet-dev.region ap-southeast-1 &&
1617
aws configure --profile uneet-dev list &&
@@ -20,7 +21,8 @@ deploy:
2021
branch: master
2122
# demo
2223
- provider: script
23-
script: aws configure set profile.uneet-demo.aws_access_key_id $AWS_915001051872_ID &&
24+
script: >
25+
aws configure set profile.uneet-demo.aws_access_key_id $AWS_915001051872_ID &&
2426
aws configure set profile.uneet-demo.aws_secret_access_key $AWS_915001051872_SECRET &&
2527
aws configure set profile.uneet-demo.region ap-southeast-1 &&
2628
aws configure --profile uneet-demo list &&
@@ -30,7 +32,12 @@ deploy:
3032
branch: master
3133
# production
3234
- provider: script
33-
script: AWS_ACCESS_KEY_ID=$AWS_192458993663_ID AWS_SECRET_ACCESS_KEY=$AWS_192458993663_SECRET make prod
35+
script: >
36+
aws configure set profile.uneet-prod.aws_access_key_id $AWS_192458993663_ID &&
37+
aws configure set profile.uneet-prod.aws_secret_access_key $AWS_192458993663_SECRET &&
38+
aws configure set profile.uneet-prod.region ap-southeast-1 &&
39+
aws configure --profile uneet-prod list &&
40+
make prod
3441
skip_cleanup: true
3542
on:
3643
branch: master

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ DEPLOY_S3_PREFIX = lambda2sqs
55

66
.PHONY: clean build test deploy
77

8+
build: push-bin process-bin validate
9+
810
push-bin: push/
911
cd push; GO111MODULE=on go mod tidy; GOOS=linux GOARCH=amd64 go build -o ../push-bin .
1012

1113
process-bin: process/
1214
cd process; GO111MODULE=on go mod tidy; GOOS=linux GOARCH=amd64 go build -o ../process-bin .
1315

14-
test:
15-
go test ./...
16-
1716
push-logs:
1817
sam logs -n ut_lambda2sqs_push -t
1918

@@ -27,11 +26,12 @@ destroy:
2726
aws cloudformation delete-stack \
2827
--stack-name $(STACK_NAME)
2928

30-
dev: push-bin process-bin
29+
validate: template.yaml
3130
sam validate --template template.yaml
32-
sam package --template-file template.yaml --s3-bucket dev-media-unee-t --s3-prefix $(DEPLOY_S3_PREFIX) --output-template-file packaged.yaml
33-
AWS_PROFILE=uneet-dev sam deploy --template-file ./packaged.yaml --stack-name $(STACK_NAME) --capabilities CAPABILITY_IAM
3431

32+
dev: build
33+
AWS_PROFILE=uneet-dev sam package --template-file template.yaml --s3-bucket dev-media-unee-t --s3-prefix $(DEPLOY_S3_PREFIX) --output-template-file packaged.yaml
34+
AWS_PROFILE=uneet-dev sam deploy --template-file ./packaged.yaml --stack-name $(STACK_NAME) --capabilities CAPABILITY_IAM
3535

3636
demo: build
3737
AWS_PROFILE=uneet-demo sam package --template-file template.yaml --s3-bucket demo-media-unee-t --s3-prefix $(DEPLOY_S3_PREFIX) --output-template-file packaged.yaml
@@ -41,7 +41,6 @@ prod: build
4141
AWS_PROFILE=uneet-prod sam package --template-file template.yaml --s3-bucket prod-media-unee-t --s3-prefix $(DEPLOY_S3_PREFIX) --output-template-file packaged.yaml
4242
AWS_PROFILE=uneet-prod sam deploy --template-file ./packaged.yaml --stack-name $(STACK_NAME) --capabilities CAPABILITY_IAM --parameter-overrides DefaultSecurityGroup=sg-9f5b5ef8 PrivateSubnets=subnet-0df289b6d96447a84,subnet-0e41c71ad02ee7e99,subnet-01cb9ee064743ac56
4343

44-
4544
lint:
4645
cfn-lint template.yaml
4746

go.mod

Lines changed: 0 additions & 16 deletions
This file was deleted.

go.sum

Lines changed: 0 additions & 37 deletions
This file was deleted.

loglambdas.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
STAGE=dev
44

5-
domain() {
6-
case $1 in
7-
prod) echo auroradb.unee-t.com
8-
;;
9-
*) echo auroradb.$1.unee-t.com
10-
;;
11-
esac
12-
}
13-
145
show_help() {
156
cat << EOF
167
Usage: ${0##*/} [-p]
@@ -43,11 +34,12 @@ done
4334
AWS_PROFILE=uneet-$STAGE
4435
shift "$((OPTIND-1))" # Discard the options and sentinel --
4536

46-
echo Connecting to ${STAGE^^} $(domain $STAGE)
37+
echo Connecting to ${STAGE^^}
4738

48-
MYSQL_PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_ROOT_PASSWORD --with-decryption --query Parameters[0].Value --output text)
49-
MYSQL_USER=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_USER --with-decryption --query Parameters[0].Value --output text)
39+
MYSQL_PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names UNTEDB_ROOT_PASS --with-decryption --query Parameters[0].Value --output text)
40+
MYSQL_USER=$(aws --profile $AWS_PROFILE ssm get-parameters --names UNTEDB_ROOT_USER --with-decryption --query Parameters[0].Value --output text)
41+
MYSQL_HOST=$(aws --profile $AWS_PROFILE ssm get-parameters --names UNTEDB_HOST --with-decryption --query Parameters[0].Value --output text)
5042

5143
echo $STAGE
5244
echo "SELECT * FROM log_lambdas ORDER BY id DESC LIMIT 10\G;" |
53-
mysql -s -h $(domain $STAGE) -P 3306 -u root --password=$MYSQL_PASSWORD unee_t_enterprise
45+
mysql -s -h $MYSQL_HOST -P 3306 -u $MYSQL_USER --password=$MYSQL_PASSWORD unee_t_enterprise

0 commit comments

Comments
 (0)