Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beanstalk config #6

Merged
merged 1 commit into from
Dec 29, 2017
Merged

Beanstalk config #6

merged 1 commit into from
Dec 29, 2017

Conversation

dornera
Copy link
Collaborator

@dornera dornera commented Dec 29, 2017

Current beanstalk config + Travis Deploy settings.

@gravesm gravesm temporarily deployed to mitlibraries-hamlet-stagi-pr-6 December 29, 2017 14:42 Inactive
@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling 286a98b on beanstalk into 56c8d52 on master.

Copy link
Owner

@thatandromeda thatandromeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks 🌈 and I'm excited to see it working. There are a couple of comments I would like you to address before we merge this.

content: |
# update mod_wsgi
cd /tmp
wget -q "https://github.com/GrahamDumpleton/mod_wsgi/archive/4.4.21.tar.gz" && \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is wget from github really the preferred way of doing this? No package management system, no hash checking or anything to ensure that we're getting what we expect to get?

This is kind of YOLO for my tastes, especially with root ownership, but if it's the only option then 🤷‍♀️ I guess.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping this changes with a newer release and we don't need it. But a lot of people seem to be using it.. https://serverfault.com/questions/884469/mod-wsgi-call-to-site-addsitedir-failed-on-aws-elastic-beanstalk-python-3

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'll add a comment so future-us isn't confused about that.

content: |
RewriteEngine On
<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆 🍻

@@ -0,0 +1,6 @@
<Directory /opt/python/current/app/{{cookiecutter.project_name}}/staticfiles/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually do what we expect or does the project name need to be filled in here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly copy and paste will fix

AddOutputFilterByType DEFLATE text/css
# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 9
# Netscape 4.x has some problems.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I don't really care about Netscape support ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OA + DISJ goals we gotta take everyone into consideration

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁

.travis.yml Outdated
deploy:
provider: elasticbeanstalk
access_key_id: AKIAI4BFBKEXWULNKVGQ
secret_access_key:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we don't want this to be here. Do we have a strategy for having it NOT be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially okay since secret is encrypted, but I think we can encrypt both. Will double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah FYI: https://stackoverflow.com/questions/7678835/how-secure-are-amazon-aws-access-keys

Gonna ignore encrypting access key, and will just stick to secret encryption. Will create a different user with limited rights for deploying from Travis to beanstalk


# GENERAL CONFIGURATION
# -----------------------------------------------------------------------------
#SET SECRET KEY IN .ebextensions config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helpful!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Do we actually do that? How/where?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, plan is no passes/etc in .ebextensions now will change

]

private_ip = get_linux_ec2_private_ip()
if private_ip:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# STATIC FILE CONFIGURATION
# -----------------------------------------------------------------------------

MIDDLEWARE += (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitenoise wants to be before most other middleware (http://whitenoise.evans.io/en/stable/) so this will need to be MIDDLEWARE.insert(1, 'whitenoise.middleware.WhiteNoiseMiddleware').

COMPRESS_OFFLINE = True

#MODEL FILES STORED ON S3
MODELS_DIR = os.environ.get('MODELS_DIR')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure docs/docs.md contains info on whatever env needs to be set in order for all of this to work? (The docs file is horribly disorganized right now so you can just put it somewhere in the AWS stuff and I'll sort out the organization later.)

@gravesm gravesm temporarily deployed to mitlibraries-hamlet-stagi-pr-6 December 29, 2017 16:15 Inactive
@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling 7991fe8 on beanstalk into 56c8d52 on master.

@gravesm gravesm temporarily deployed to mitlibraries-hamlet-stagi-pr-6 December 29, 2017 16:34 Inactive
@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling 8c3df92 on beanstalk into 56c8d52 on master.

@gravesm gravesm temporarily deployed to mitlibraries-hamlet-stagi-pr-6 December 29, 2017 16:39 Inactive
@dornera
Copy link
Collaborator Author

dornera commented Dec 29, 2017

I think I got everything? Libraries CI/CD slowly becoming a reality?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling 0e83ad0 on beanstalk into 56c8d52 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling f3aa902 on beanstalk into 56c8d52 on master.

Includes:
* test that we can autodeploy the beanstalk branch, then swap config
  to master
* add bucket_name (not included with travis setup)
* configure with restricted account for travis
* update docs
@gravesm gravesm requested a deployment to mitlibraries-hamlet-stagi-pr-6 December 29, 2017 19:12 Abandoned
@thatandromeda thatandromeda merged commit eea1b93 into master Dec 29, 2017
@thatandromeda thatandromeda deleted the beanstalk branch December 29, 2017 19:13
@coveralls
Copy link

Coverage Status

Coverage remained the same at 36.0% when pulling 27c6402 on beanstalk into 5e29df9 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants