-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
dockerfile + compose for ol-www0 web_nginx #4725
Merged
+203
−14
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
153a4e0
dockerfile + compose for ol-www0 web_nginx
mekarpeles 5cfc3d6
tested working /static web_nginx docker setup
mekarpeles 312528b
moving web_nginx to openlibrary/docker from olsystem
mekarpeles e43076c
adds haproxy and fixes nginx to pass through
mekarpeles bd11f0b
upgrading covers_nginx to use new nginx
mekarpeles 102fcdc
upgrading infobase_nginx to use new nginx
mekarpeles f77ec00
Update docker/web_nginx.conf
mekarpeles 2ab901d
moving nginx to olbase
mekarpeles 64dfa4f
fixing nginx + haproxy conf
cdrini 1c259e3
logrotate + cron sh to ol-www0 nginx
mekarpeles 4d5d054
adding latest anon IP handler to nginx.conf
cdrini bf8b0dc
fix for logrotate
cdrini ce96416
Remove petabox_seed secret
cdrini a574919
Make all production nginxes use same start command
cdrini 991b353
Update web_nginx to use public_nginx.conf
cdrini 91de4cf
Persist archive-webserver-logs state-file between downs/ups
cdrini 7ffadc4
Remove the nginx default
cclauss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,14 @@ | ||
#!/bin/bash | ||
|
||
if [ -n "$CRONTAB_FILES" ] ; then | ||
crontab $CRONTAB_FILES | ||
service cron start | ||
fi | ||
|
||
# logrotate comes from olsystem which is volume mounted | ||
# logrotate requires files to be 644 | ||
# expect conflicts writing to file | ||
chmod 644 /etc/logrotate.d/nginx | ||
logrotate --verbose /etc/logrotate.d/nginx | ||
|
||
nginx -g "daemon off;" |
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,94 @@ | ||
|
||
## Gio and Sam | ||
# added an haproxy to better balance the requests | ||
# between the webnodes | ||
# http://www.openlibrary.org/admin?stats | ||
# | ||
# | ||
# old conf (requests balanced by nginx) | ||
#upstream webnodes { | ||
# server ol-web1.us.archive.org:8080; | ||
# server ol-web2.us.archive.org:8080; | ||
#} | ||
# | ||
# using haproxy | ||
upstream webnodes { | ||
server web_haproxy:7072; | ||
} | ||
|
||
server { | ||
include /etc/nginx/sites-available/public_nginx.conf; | ||
server_name openlibrary.org; | ||
|
||
# Set the referrer policy so browsers send referrers to our own servers | ||
# In July 2020, Chrome changed its default referrer policy so any cross-origin | ||
# requests only sent the root referrer `/`. Since openlibrary.org | ||
# has a different "origin" than analytics.archive.org, the full referrer | ||
# path is not sent. This changes the behavior back to the pre-July 2020 change. | ||
add_header Referrer-Policy "no-referrer-when-downgrade"; | ||
|
||
root /openlibrary; | ||
|
||
# Show closed-library page on errors. | ||
error_page 502 /static/status-500.html; | ||
error_page 500 /static/status-500.html; | ||
|
||
# Anand - Oct 2013 | ||
# Redirect all http URLs except the API calls (ending with .json or /api/*) to https | ||
set $api_call "$scheme:noapi"; | ||
if ($uri ~ '\.json$') { | ||
set $api_call "$scheme:api"; | ||
} | ||
if ($uri ~ '^/api/.*$') { | ||
set $api_call "$scheme:api"; | ||
} | ||
if ($api_call = "http:noapi") { | ||
rewrite ^(.*)$ https://$http_host$1 last; | ||
} | ||
location / { | ||
proxy_pass http://webnodes; | ||
proxy_set_header Host $http_host; | ||
|
||
# Gunicorn takes IP from this header | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
|
||
# Hack to make the app pick the right url scheme even when the | ||
# app server is http only. | ||
proxy_set_header X-Scheme $scheme; | ||
} | ||
|
||
location ~ ^/(images/.*|favicon.ico|robots.txt)$ { | ||
rewrite ^(.*)$ /static/$1 last; | ||
} | ||
|
||
location ~ ^/(y_key_[0-9a-f]+.html|google[0-9a-f]+.html|LiveSearchSiteAuth.xml)$ { | ||
root /olsystem/www; | ||
} | ||
|
||
location ~ ^/static/(docs|tour|sitemaps|jsondumps|images/shelfview|sampledump.txt.gz)(/.*)?$ { | ||
root /sitemaps; | ||
autoindex on; | ||
rewrite ^/static/(.*)$ /$1 break; | ||
} | ||
|
||
location /static { | ||
autoindex on; | ||
expires 1h; | ||
} | ||
|
||
location /static/build { | ||
expires max; | ||
} | ||
|
||
location /index { | ||
root /sitemaps; | ||
autoindex on; | ||
} | ||
} | ||
|
||
server { | ||
include /etc/nginx/sites-available/public_nginx.conf; | ||
server_name www.openlibrary.org *.openlibrary.org; | ||
|
||
rewrite ^(.*)$ http://openlibrary.org$1 permanent; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why we no longer need petabox_seed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Remove from olsystem; it's in docker-default.