-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Collins
committed
Oct 6, 2016
1 parent
d30759b
commit 2430102
Showing
9 changed files
with
142 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,5 @@ | ||
packages: | ||
yum: | ||
git: [] | ||
postgresql94-devel: [] | ||
libjpeg-turbo-devel: [] |
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,46 @@ | ||
#This sample requires you to create a separate configuration file that defines the custom | ||
# option settings for CacheCluster properties. | ||
|
||
Resources: | ||
MyCacheSecurityGroup: | ||
Type: "AWS::EC2::SecurityGroup" | ||
Properties: | ||
GroupDescription: "Lock cache down to webserver access only" | ||
SecurityGroupIngress : | ||
- IpProtocol : "tcp" | ||
FromPort : | ||
Fn::GetOptionSetting: | ||
OptionName : "CachePort" | ||
DefaultValue: "6379" | ||
ToPort : | ||
Fn::GetOptionSetting: | ||
OptionName : "CachePort" | ||
DefaultValue: "6379" | ||
SourceSecurityGroupName: | ||
Ref: "AWSEBSecurityGroup" | ||
MyElastiCache: | ||
Type: "AWS::ElastiCache::CacheCluster" | ||
Properties: | ||
CacheNodeType: | ||
Fn::GetOptionSetting: | ||
OptionName : "CacheNodeType" | ||
DefaultValue : "cache.t1.micro" | ||
NumCacheNodes: | ||
Fn::GetOptionSetting: | ||
OptionName : "NumCacheNodes" | ||
DefaultValue : "1" | ||
Engine: | ||
Fn::GetOptionSetting: | ||
OptionName : "Engine" | ||
DefaultValue : "redis" | ||
VpcSecurityGroupIds: | ||
- | ||
Fn::GetAtt: | ||
- MyCacheSecurityGroup | ||
- GroupId | ||
|
||
Outputs: | ||
ElastiCache: | ||
Description : "ID of ElastiCache Cache Cluster with Redis Engine" | ||
Value : | ||
Ref : "MyElastiCache" |
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,6 @@ | ||
option_settings: | ||
"aws:elasticbeanstalk:customoption": | ||
CacheNodeType : cache.t1.micro | ||
NumCacheNodes : 1 | ||
Engine : redis | ||
CachePort : 6379 |
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,17 @@ | ||
container_commands: | ||
01_migrate: | ||
command: "source /opt/python/run/venv/bin/activate && python manage.py migrate" | ||
leader_only: True | ||
02_collectstatic: | ||
command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput" | ||
option_settings: | ||
"aws:elasticbeanstalk:application:environment": | ||
DJANGO_SETTINGS_MODULE: "config.settings.production" | ||
REDIS_ENDPOINT_ADDRESS: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Address"]}`' | ||
REDIS_PORT: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Port"]}`' | ||
"aws:elasticbeanstalk:container:python": | ||
WSGIPath: "../config/wsgi.py" | ||
NumProcesses: 3 | ||
NumThreads: 20 | ||
"aws:elasticbeanstalk:container:python:staticfiles": | ||
"/static/": "www/static/" |
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,8 @@ | ||
-----BEGIN DH PARAMETERS----- | ||
MIIBCAKCAQEAyxepj6FexDqBTjoa41Jt+1RzBMOqpsCSu0RT8k5taJ5OU2gwqRoo | ||
v9euM+T1zWqCoFkehucnGtJ7tc+GaFHHDkBnI9xbJ8+f+OE9CNVa2UaCa4DfOadD | ||
wXWNB1jqlQJcKr+txqyDjRvzmwL4J6nQQ//KcuLQLxFWxkTBOpxrWVU0p0OwkRin | ||
vP7zr5pxhDW22BF95o634Ol7X9IppukKeaYwXfAwd6ysxhLWQKFIQPadf0Ga2UfZ | ||
K1UVGac9yUPUZzZeswd3eIIVlp4wFibnUwf/dUqZXtl5heZk/6jXNjW9Y4b5XKis | ||
tuNP0vEit/nqNOFhlIHuWL/teH71pXLJWwIBAg== | ||
-----END DH PARAMETERS----- |
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,37 @@ | ||
"""Converts a .env file to Elastic Beanstalk environment variables""" | ||
|
||
import os | ||
from sys import exit | ||
from subprocess import check_call | ||
|
||
try: | ||
import dotenv | ||
except ImportError: | ||
print("Please install the 'dotenv' library: 'pip install dotenv'") | ||
exit() | ||
|
||
def main(): | ||
if not os.path.exists('.env'): | ||
print('ERROR!! .env file is missing!') | ||
print("Please copy 'env.example' to '.env' and add appropriate values") | ||
exit() | ||
command = ['eb', 'setenv'] | ||
failures = [] | ||
for key, value in dotenv.Dotenv('.env').items(): | ||
if key.startswith('POSTGRES'): | ||
print('Skipping POSTGRES values - Amazon RDS provides these') | ||
continue | ||
if value: | ||
command.append("{}={}".format(key, value)) | ||
else: | ||
failures.append(key) | ||
if failures: | ||
for failure in failures: | ||
print("{} requires a value".format(failure)) | ||
else: | ||
print(' '.join(command)) | ||
check_call(command) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,3 @@ | ||
# This file is here because many Platforms as a Service look for | ||
# requirements.txt in the root directory of a project. | ||
-r requirements/production.txt |