-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bluebird-tech/aws_docker
AWS Beanstalk
- Loading branch information
Showing
6 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Elastic Beanstalk Files | ||
.elasticbeanstalk/* | ||
!.elasticbeanstalk/*.cfg.yml | ||
!.elasticbeanstalk/*.global.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
FROM golang:1.4.2 | ||
FROM golang:1.4.2-onbuild | ||
|
||
RUN go get github.com/tools/godep | ||
|
||
CMD cd /go/src/app && godep restore && go install && app | ||
RUN cd /go/src/app | ||
RUN godep restore | ||
RUN go build -o bin/application | ||
ENV PORT 3000 | ||
EXPOSE 3000 | ||
CMD ["./run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Deploy to Elastic Beanstalk | ||
|
||
## 0. Run a demo application from the web ui. | ||
|
||
> This is the fastest way to get a service role and instance profile | ||
> -- <cite>[Service Roles, Instance Profiles, and User Policies][1]</cite> | ||
## 1. Install the EB client | ||
|
||
```sh | ||
pip install --user awsebcli | ||
# add $HOME/.local/bin to your PATH | ||
``` | ||
|
||
## 2. Create EB app and environment | ||
|
||
```sh | ||
NAME=puffin-api | ||
REGION="eu-central-1" | ||
PASSWORD=$(pwgen 30 1) | ||
|
||
eb init \ | ||
--region eu-central-1 \ | ||
--platform "Go 1.4 (Preconfigured - Docker)" \ | ||
$NAME | ||
|
||
eb create $NAME \ | ||
--cname $NAME \ | ||
--region $REGION \ | ||
--database \ | ||
--database.engine postgres \ | ||
--database.user root \ | ||
--database.password $PASSWORD | ||
|
||
echo $PASSWORD | ||
``` | ||
|
||
## 3. Deploy a new version | ||
|
||
```sh | ||
eb use <environment> | ||
eb deploy | ||
``` | ||
|
||
[1]:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
export DATABASE_URL="postgres://${RDS_USERNAME}:${RDS_PASSWORD}@${RDS_HOSTNAME}/${RDS_DB_NAME}?sslmode=disable" | ||
bin/application |