This repository was archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
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
1 parent
f61a8c4
commit 62947e1
Showing
10 changed files
with
192 additions
and
5 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
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 @@ | ||
basic_auth.config |
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,14 @@ | ||
files: | ||
"/etc/httpd/conf.d/cors.conf" : | ||
mode: "000644" | ||
owner: root | ||
group: root | ||
content: | | ||
<Location "/"> | ||
Header set Access-Control-Allow-Origin: https://www.openbook.social | ||
Header set Access-Control-Allow-Methods: "POST, GET, PUT, DELETE, OPTIONS" | ||
Header add Access-Control-Allow-Headers: "Authorization, Content-Type, Accept" | ||
Header set Access-Control-Allow-Credentials: true | ||
|
||
SetOutputFilter DEFLATE | ||
</Location> |
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 @@ | ||
option_settings: | ||
aws:elasticbeanstalk:container:python: | ||
WSGIPath: openbook/wsgi.py |
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,11 @@ | ||
files: | ||
"/etc/httpd/conf.d/health_host.conf" : | ||
mode: "000644" | ||
owner: root | ||
group: root | ||
content: | | ||
<Location "/health/"> | ||
AuthType None | ||
Require all granted | ||
RequestHeader set HOST "openbook.social" | ||
</Location> |
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,2 @@ | ||
* | ||
!.gitignore |
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 @@ | ||
import os | ||
import argparse | ||
from jinja2 import Environment, FileSystemLoader | ||
|
||
|
||
def make_eb_basic_auth_config(htpasswd_contents): | ||
# Capture our current directory | ||
UTILS_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
# Create the jinja2 environment. | ||
# Notice the use of trim_blocks, which greatly helps control whitespace. | ||
j2_env = Environment(loader=FileSystemLoader(UTILS_DIR)) | ||
return j2_env.get_template('templates/eb/basic_auth.config.yml').render( | ||
HTPASSWD=htpasswd_contents | ||
) | ||
|
||
|
||
def write_eb_config(dest, htpasswd_contents): | ||
contents = make_eb_basic_auth_config(htpasswd_contents) | ||
fh = open(dest, 'w') | ||
fh.write(contents) | ||
fh.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='EB Config Maker') | ||
# Optional argument | ||
parser.add_argument('--dest', type=str, | ||
help='The destination of the generated eb config', | ||
default='./.ebextensions/basic_auth.config') | ||
|
||
parser.add_argument('--htpasswd', type=str, | ||
required=True, | ||
help='The htpasswd file contents') | ||
|
||
args = parser.parse_args() | ||
|
||
write_eb_config(args.dest, htpasswd_contents=args.htpasswd) |
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,42 @@ | ||
import os | ||
import argparse | ||
from jinja2 import Environment, FileSystemLoader | ||
|
||
|
||
def make_eb_config(application_name, default_region): | ||
# Capture our current directory | ||
UTILS_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
# Create the jinja2 environment. | ||
# Notice the use of trim_blocks, which greatly helps control whitespace. | ||
j2_env = Environment(loader=FileSystemLoader(UTILS_DIR)) | ||
return j2_env.get_template('templates/eb/config.yml').render( | ||
APPLICATION_NAME=application_name, | ||
DEFAULT_REGION=default_region | ||
) | ||
|
||
|
||
def write_eb_config(dest, application_name, default_region): | ||
contents = make_eb_config(application_name, default_region) | ||
fh = open(dest, 'w') | ||
fh.write(contents) | ||
fh.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='EB Config Maker') | ||
# Optional argument | ||
parser.add_argument('--dest', type=str, | ||
help='The destination of the generated eb config', | ||
default='./.elasticbeanstalk/config.yml') | ||
|
||
parser.add_argument('--name', type=str, | ||
required=True, | ||
help='The name of the application') | ||
|
||
parser.add_argument('--region', type=str, | ||
required=True, | ||
help='The default application region') | ||
|
||
args = parser.parse_args() | ||
|
||
write_eb_config(args.dest, application_name=args.name, default_region=args.region) |
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,18 @@ | ||
files: | ||
"/etc/httpd/conf.d/basic_auth.conf" : | ||
mode: "000644" | ||
owner: root | ||
group: root | ||
content: | | ||
<Location "/"> | ||
AuthType Basic | ||
AuthName "Restricted Content" | ||
AuthUserFile /etc/apache2/.htpasswd | ||
Require valid-user | ||
</Location> | ||
"/etc/apache2/.htpasswd" : | ||
mode: "000644" | ||
owner: root | ||
group: root | ||
content: | | ||
{{ HTPASSWD }} |
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,22 @@ | ||
branch-defaults: | ||
master: | ||
environment: $CIRCLE_BRANCH-{{ APPLICATION_NAME }} | ||
global: | ||
application_name: {{ APPLICATION_NAME }} | ||
default_region: {{ DEFAULT_REGION }} | ||
default_ec2_keyname: null | ||
default_platform: python-3.6 | ||
include_git_submodules: true | ||
instance_profile: null | ||
platform_name: null | ||
platform_version: null | ||
profile: null | ||
repository: null | ||
sc: git | ||
workspace_type: Application | ||
Resources: | ||
AWSEBAutoScalingGroup: | ||
Type: "AWS::AutoScaling::AutoScalingGroup" | ||
Properties: | ||
HealthCheckType: "ELB" | ||
HealthCheckGracePeriod: "600" |