Last active
March 2, 2017 00:09
-
-
Save jeffhorton/bb4985c50ca3a7e6cca3aeeeccaf5fb6 to your computer and use it in GitHub Desktop.
handy blocks copied from random places
This file contains hidden or 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
in hn comments related to this https://blog.sentry.io/2017/03/01/dodging-s3-downtime-with-nginx-and-haproxy.html | |
Heads up a simple yet production ready NGINX location block to proxy to a public s3 bucket looks like: | |
# matches /s3/* | |
location ~* /s3/(.+)$ { | |
set $s3_host 's3-us-west-2.amazonaws.com'; | |
set $s3_bucket 'somebucketname' | |
proxy_http_version 1.1; | |
proxy_ssl_verify on; | |
proxy_ssl_session_reuse on; | |
proxy_set_header Connection ''; | |
proxy_set_header Host $s3_host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Authorization ''; | |
proxy_hide_header x-amz-id-2; | |
proxy_hide_header x-amz-request-id; | |
proxy_buffering on; | |
proxy_intercept_errors on; | |
resolver 8.8.4.4 8.8.8.8; | |
resolver_timeout 10s; | |
proxy_pass https://$s3_host/$s3_bucket/$1; | |
} | |
Adding NGINX caching on-top of this is pretty trivial. | |
Also, heads up, in the directive proxy_cache_path, they should consider enabling "use_temp_path". This directive instructs NGINX to write them to the same directories where they will be cached. We recommend that you set this parameter to off to avoid unnecessary copying of data between file systems. use_temp_path was introduced in NGINX version 1.7.10 and NGINX Plus R6. | |
use_temp_path=off | |
Also, they should enable "proxy_cache_revalidate". This saves on bandwidth, because the server sends the full item only if it has been modified since the time recorded in the Last-Modified header. | |
proxy_cache_revalidate on; | |
--------------------- | |
node ecs config | |
var params = { | |
taskDefinition: 'task-name', | |
/* required */ | |
//cluster: 'default', | |
containerInstances: ["some-hex-number-instance"], | |
overrides: { | |
containerOverrides: [{ | |
name: 'a name', | |
command: ["command to pass in"], | |
environment: [{ | |
name: 'ENV_VAR', | |
value: val | |
}, { | |
name: 'ENV_VAR', | |
value: val | |
}], | |
}] | |
} | |
} | |
var ecs = new AWS.ECS(); | |
var response = ecs.startTask(params, function( err, data {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment